Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 5222 → Rev 6324

/contrib/toolchain/binutils/gas/as
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/contrib/toolchain/binutils/gas/Makefile
15,7 → 15,7
 
LIBPATH:= -L$(LIB_DIR) -L/home/autobuild/tools/win32/mingw32/lib
 
LDFLAGS = -static -nostdlib --stack 12582912 -T$(SDK_DIR)/sources/newlib/app.lds --image-base 0
LDFLAGS = -static -nostdlib --stack 12582912 -T$(SDK_DIR)/sources/newlib/app.lds --image-base 0 --subsystem native
 
 
SRCS = \
/contrib/toolchain/binutils/gas/app.c
1,7 → 1,5
/* This is the Assembler Pre-Processor
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2012
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
160,7 → 158,10
for (p = line_comment_chars; *p; p++)
lex[(unsigned char) *p] = LEX_IS_LINE_COMMENT_START;
 
for (p = line_separator_chars; *p; p++)
#ifndef tc_line_separator_chars
#define tc_line_separator_chars line_separator_chars
#endif
for (p = tc_line_separator_chars; *p; p++)
lex[(unsigned char) *p] = LEX_IS_LINE_SEPARATOR;
 
#ifdef tc_parallel_separator_chars
246,7 → 247,7
char *
app_push (void)
{
register struct app_save *saved;
struct app_save *saved;
 
saved = (struct app_save *) xmalloc (sizeof (*saved));
saved->state = state;
283,7 → 284,7
void
app_pop (char *arg)
{
register struct app_save *saved = (struct app_save *) arg;
struct app_save *saved = (struct app_save *) arg;
 
/* There is no do_scrub_end (). */
state = saved->state;
359,7 → 360,7
char *from;
char *fromend;
size_t fromlen;
register int ch, ch2 = 0;
int ch, ch2 = 0;
/* Character that started the string we're working on. */
static char quotechar;
 
1217,9 → 1218,16
while (ch != EOF && !IS_NEWLINE (ch))
ch = GET ();
if (ch == EOF)
{
as_warn (_("end of file in comment; newline inserted"));
PUT ('\n');
}
else /* IS_NEWLINE (ch) */
{
/* To process non-zero add_newlines. */
UNGET (ch);
}
state = 0;
PUT ('\n');
break;
}
/* Looks like `# 123 "filename"' from cpp. */
/contrib/toolchain/binutils/gas/as.c
1,5 → 1,5
/* as.c - GAS main program.
Copyright 1987-2013 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
97,7 → 97,7
int verbose = 0;
 
/* Keep the output file. */
int keep_it = 0;
static int keep_it = 0;
 
segT reg_section;
segT expr_section;
224,6 → 224,11
VERSION, TARGET_ALIAS, BFD_VERSION_STRING);
}
 
#ifdef DEFAULT_FLAG_COMPRESS_DEBUG
enum compressed_debug_section_type flag_compress_debug
= COMPRESS_DEBUG_GABI_ZLIB;
#endif
 
static void
show_usage (FILE * stream)
{
245,15 → 250,22
 
fprintf (stream, _("\
--alternate initially turn on alternate macro syntax\n"));
#ifdef HAVE_ZLIB_H
#ifdef DEFAULT_FLAG_COMPRESS_DEBUG
fprintf (stream, _("\
--compress-debug-sections\n\
compress DWARF debug sections using zlib\n"));
--compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi}]\n\
compress DWARF debug sections using zlib [default]\n"));
fprintf (stream, _("\
--nocompress-debug-sections\n\
don't compress DWARF debug sections\n"));
#endif /* HAVE_ZLIB_H */
#else
fprintf (stream, _("\
--compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi}]\n\
compress DWARF debug sections using zlib\n"));
fprintf (stream, _("\
--nocompress-debug-sections\n\
don't compress DWARF debug sections [default]\n"));
#endif
fprintf (stream, _("\
-D produce assembler debugging messages\n"));
fprintf (stream, _("\
--debug-prefix-map OLD=NEW\n\
286,6 → 298,8
fprintf (stream, _("\
--size-check=[error|warning]\n\
ELF .size directive check (default --size-check=error)\n"));
fprintf (stream, _("\
--sectname-subst enable section name substitution sequences\n"));
#endif
fprintf (stream, _("\
-f skip whitespace and comment preprocessing\n"));
449,6 → 463,7
OPTION_EXECSTACK,
OPTION_NOEXECSTACK,
OPTION_SIZE_CHECK,
OPTION_SECTNAME_SUBST,
OPTION_ALTERNATE,
OPTION_AL,
OPTION_HASH_TABLE_SIZE,
473,7 → 488,7
,{"a", optional_argument, NULL, 'a'}
/* Handle -al=<FILE>. */
,{"al", optional_argument, NULL, OPTION_AL}
,{"compress-debug-sections", no_argument, NULL, OPTION_COMPRESS_DEBUG}
,{"compress-debug-sections", optional_argument, NULL, OPTION_COMPRESS_DEBUG}
,{"nocompress-debug-sections", no_argument, NULL, OPTION_NOCOMPRESS_DEBUG}
,{"debug-prefix-map", required_argument, NULL, OPTION_DEBUG_PREFIX_MAP}
,{"defsym", required_argument, NULL, OPTION_DEFSYM}
483,6 → 498,7
,{"execstack", no_argument, NULL, OPTION_EXECSTACK}
,{"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK}
,{"size-check", required_argument, NULL, OPTION_SIZE_CHECK}
,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST}
#endif
,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF2}
626,7 → 642,7
case OPTION_VERSION:
/* This output is intended to follow the GNU standards document. */
printf (_("GNU assembler %s\n"), BFD_VERSION_STRING);
printf (_("Copyright 2013 Free Software Foundation, Inc.\n"));
printf (_("Copyright (C) 2015 Free Software Foundation, Inc.\n"));
printf (_("\
This program is free software; you may redistribute it under the terms of\n\
the GNU General Public License version 3 or later.\n\
657,15 → 673,31
exit (EXIT_SUCCESS);
 
case OPTION_COMPRESS_DEBUG:
#ifdef HAVE_ZLIB_H
flag_compress_debug = 1;
if (optarg)
{
#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
if (strcasecmp (optarg, "none") == 0)
flag_compress_debug = COMPRESS_DEBUG_NONE;
else if (strcasecmp (optarg, "zlib") == 0)
flag_compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
else if (strcasecmp (optarg, "zlib-gnu") == 0)
flag_compress_debug = COMPRESS_DEBUG_GNU_ZLIB;
else if (strcasecmp (optarg, "zlib-gabi") == 0)
flag_compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
else
as_fatal (_("Invalid --compress-debug-sections option: `%s'"),
optarg);
#else
as_warn (_("cannot compress debug sections (zlib not installed)"));
#endif /* HAVE_ZLIB_H */
as_fatal (_("--compress-debug-sections=%s is unsupported"),
optarg);
#endif
}
else
flag_compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
break;
 
case OPTION_NOCOMPRESS_DEBUG:
flag_compress_debug = 0;
flag_compress_debug = COMPRESS_DEBUG_NONE;
break;
 
case OPTION_DEBUG_PREFIX_MAP:
834,6 → 866,10
else
as_fatal (_("Invalid --size-check= option: `%s'"), optarg);
break;
 
case OPTION_SECTNAME_SUBST:
flag_sectname_subst = 1;
break;
#endif
case 'Z':
flag_always_generate_output = 1;
1107,33 → 1143,7
read_a_source_file ("");
}
#ifdef OBJ_ELF
static void
create_obj_attrs_section (void)
{
segT s;
char *p;
offsetT size;
const char *name;
 
size = bfd_elf_obj_attr_size (stdoutput);
if (size)
{
name = get_elf_backend_data (stdoutput)->obj_attrs_section;
if (!name)
name = ".gnu.attributes";
s = subseg_new (name, 0);
elf_section_type (s)
= get_elf_backend_data (stdoutput)->obj_attrs_section_type;
bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA);
frag_now_fix ();
p = frag_more (size);
bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size);
}
}
#endif
 
int
main (int argc, char ** argv)
{
1257,11 → 1267,6
md_end ();
#endif
 
#ifdef OBJ_ELF
if (IS_ELF)
create_obj_attrs_section ();
#endif
 
#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
if ((flag_execstack || flag_noexecstack)
&& OUTPUT_FLAVOR == bfd_target_elf_flavour)
1283,21 → 1288,46
directives from the user or by the backend, emit it now. */
cfi_finish ();
 
if (seen_at_least_1_file ()
&& (flag_always_generate_output || had_errors () == 0))
keep_it = 1;
else
keep_it = 0;
if (seen_at_least_1_file ())
{
int n_warns, n_errs;
char warn_msg[50];
char err_msg[50];
 
/* This used to be done at the start of write_object_file in
write.c, but that caused problems when doing listings when
keep_it was zero. This could probably be moved above md_end, but
I didn't want to risk the change. */
subsegs_finish ();
 
if (keep_it)
write_object_file ();
 
n_warns = had_warnings ();
n_errs = had_errors ();
 
if (n_warns == 1)
sprintf (warn_msg, _("%d warning"), n_warns);
else
sprintf (warn_msg, _("%d warnings"), n_warns);
if (n_errs == 1)
sprintf (err_msg, _("%d error"), n_errs);
else
sprintf (err_msg, _("%d errors"), n_errs);
 
if (flag_fatal_warnings && n_warns != 0)
{
if (n_errs == 0)
as_bad (_("%s, treating warnings as errors"), warn_msg);
n_errs += n_warns;
}
 
if (n_errs == 0)
keep_it = 1;
else if (flag_always_generate_output)
{
/* The -Z flag indicates that an object file should be generated,
regardless of warnings and errors. */
keep_it = 1;
fprintf (stderr, _("%s, %s, generating bad object file\n"),
err_msg, warn_msg);
}
}
 
fflush (stderr);
 
#ifndef NO_LISTING
1304,12 → 1334,6
listing_print (listing_filename, argv_orig);
#endif
 
if (flag_fatal_warnings && had_warnings () > 0 && had_errors () == 0)
as_bad (_("%d warnings, treating warnings as errors"), had_warnings ());
 
if (had_errors () > 0 && ! flag_always_generate_output)
keep_it = 0;
 
input_scrub_end ();
 
END_PROGRESS (myname);
1316,7 → 1340,7
 
/* Use xexit instead of return, because under VMS environments they
may not place the same interpretation on the value given. */
if (had_errors () > 0)
if (had_errors () != 0)
xexit (EXIT_FAILURE);
 
/* Only generate dependency file if assembler was successful. */
/contrib/toolchain/binutils/gas/as.h
1,5 → 1,5
/* as.h - global header file
Copyright 1987-2013 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
370,8 → 370,8
/* True if we should generate a traditional format object file. */
COMMON int flag_traditional_format;
 
/* TRUE if debug sections should be compressed. */
COMMON int flag_compress_debug;
/* Type of compressed debug sections we should generate. */
COMMON enum compressed_debug_section_type flag_compress_debug;
 
/* TRUE if .note.GNU-stack section with SEC_CODE should be created */
COMMON int flag_execstack;
589,6 → 589,9
size_check_warning
}
flag_size_check;
 
/* If section name substitution sequences should be honored */
COMMON int flag_sectname_subst;
#endif
 
#ifndef DOLLAR_AMBIGU
/contrib/toolchain/binutils/gas/asintl.h
1,5 → 1,5
/* asintl.h - gas-specific header for gettext code.
Copyright 1998, 1999, 2000, 2005, 2007 Free Software Foundation, Inc.
Copyright (C) 1998-2015 Free Software Foundation, Inc.
 
Written by Tom Tromey <tromey@cygnus.com>
 
/contrib/toolchain/binutils/gas/atof-generic.c
1,6 → 1,5
/* atof_generic.c - turn a string of digits into a Flonum
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
2001, 2003, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/bignum.h
1,5 → 1,5
/* bignum.h-arbitrary precision integers
Copyright 1987, 1992, 2003, 2005, 2007 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/bit_fix.h
1,6 → 1,5
/* bit_fix.h
Copyright 1987, 1992, 2000, 2001, 2003, 2005, 2007
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/compress-debug.c
1,5 → 1,5
/* compress-debug.c - compress debug sections
Copyright 2010 Free Software Foundation, Inc.
Copyright (C) 2010-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
20,21 → 20,15
 
#include "config.h"
#include <stdio.h>
#include <zlib.h>
#include "ansidecl.h"
#include "compress-debug.h"
 
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
 
/* Initialize the compression engine. */
 
struct z_stream_s *
compress_init (void)
{
#ifndef HAVE_ZLIB_H
return NULL;
#else
static struct z_stream_s strm;
 
strm.zalloc = NULL;
42,7 → 36,6
strm.opaque = NULL;
deflateInit (&strm, Z_DEFAULT_COMPRESSION);
return &strm;
#endif /* HAVE_ZLIB_H */
}
 
/* Stream the contents of a frag to the compression engine. Output
49,15 → 42,9
from the engine goes into the current frag on the obstack. */
 
int
compress_data (struct z_stream_s *strm ATTRIBUTE_UNUSED,
const char **next_in ATTRIBUTE_UNUSED,
int *avail_in ATTRIBUTE_UNUSED,
char **next_out ATTRIBUTE_UNUSED,
int *avail_out ATTRIBUTE_UNUSED)
compress_data (struct z_stream_s *strm, const char **next_in,
int *avail_in, char **next_out, int *avail_out)
{
#ifndef HAVE_ZLIB_H
return -1;
#else
int out_size = 0;
int x;
 
77,7 → 64,6
*avail_out = strm->avail_out;
 
return out_size;
#endif /* HAVE_ZLIB_H */
}
 
/* Finish the compression and consume the remaining compressed output.
85,14 → 71,9
needed. */
 
int
compress_finish (struct z_stream_s *strm ATTRIBUTE_UNUSED,
char **next_out ATTRIBUTE_UNUSED,
int *avail_out ATTRIBUTE_UNUSED,
int *out_size ATTRIBUTE_UNUSED)
compress_finish (struct z_stream_s *strm, char **next_out,
int *avail_out, int *out_size)
{
#ifndef HAVE_ZLIB_H
return -1;
#else
int x;
 
strm->avail_in = 0;
113,5 → 94,4
if (strm->avail_out != 0)
return -1;
return 1;
#endif /* HAVE_ZLIB_H */
}
/contrib/toolchain/binutils/gas/compress-debug.h
1,5 → 1,5
/* compress-debug.h - Header file for compressed debug sections.
Copyright 2010 Free Software Foundation, Inc.
Copyright (C) 2010-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/cond.c
1,6 → 1,5
/* cond.c - conditional assembly pseudo-ops, and .include
Copyright 1990, 1991, 1992, 1993, 1995, 1997, 1998, 2000, 2001, 2002,
2003, 2005, 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 1990-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
78,7 → 77,7
SKIP_WHITESPACE ();
name = input_line_pointer;
 
if (!is_name_beginner (*name))
if (!is_name_beginner (*name) && *name != '"')
{
as_bad (_("invalid identifier for \".ifdef\""));
obstack_1grow (&cond_obstack, 0);
86,9 → 85,9
return;
}
 
c = get_symbol_end ();
c = get_symbol_name (& name);
symbolP = symbol_find (name);
*input_line_pointer = c;
(void) restore_line_pointer (c);
 
initialize_cframe (&cframe);
 
129,7 → 128,7
struct conditional_frame cframe;
int t;
char *stop = NULL;
char stopc;
char stopc = 0;
 
if (flag_mri)
stop = mri_comment_field (&stopc);
262,7 → 261,7
s_ifc (int arg)
{
char *stop = NULL;
char stopc;
char stopc = 0;
char *s1, *s2;
int len1, len2;
int res;
/contrib/toolchain/binutils/gas/config/atof-ieee.c
1,6 → 1,5
/* atof_ieee.c - turn a Flonum into an IEEE floating point number
Copyright 1987, 1992, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2005,
2007, 2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/config/obj-coff-seh.c
1,6 → 1,5
/* seh pdata/xdata coff object file format
Copyright 2009, 2010
Free Software Foundation, Inc.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
 
This file is part of GAS.
 
170,7 → 169,14
return 0;
}
 
/* Switch back to the code section, whatever that may be. */
static void
obj_coff_seh_code (int ignored ATTRIBUTE_UNUSED)
{
subseg_set (seh_ctx_cur->code_seg, 0);
}
 
static void
switch_xdata (int subseg, segT code_seg)
{
x_segcur = seh_hash_find_or_make (code_seg, ".xdata");
323,8 → 329,7
 
if (*input_line_pointer == '@')
{
symbol_name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&symbol_name);
 
seh_ctx_cur->handler.X_op = O_constant;
seh_ctx_cur->handler.X_add_number = 0;
337,7 → 342,7
else
as_bad (_("unknown constant value '%s' for handler"), symbol_name);
 
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
}
else
expression (&seh_ctx_cur->handler);
353,8 → 358,7
{
do
{
symbol_name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&symbol_name);
 
if (strcasecmp (symbol_name, "@unwind") == 0)
seh_ctx_cur->handler_flags |= UNW_FLAG_UHANDLER;
363,7 → 367,7
else
as_bad (_(".seh_handler constant '%s' unknown"), symbol_name);
 
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
}
while (skip_whitespace_and_comma (0));
}
448,10 → 452,9
 
SKIP_WHITESPACE ();
 
symbol_name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&symbol_name);
seh_ctx_cur->func_name = xstrdup (symbol_name);
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
 
demand_empty_rest_of_line ();
 
543,14 → 546,13
SKIP_WHITESPACE ();
if (*input_line_pointer == '%')
++input_line_pointer;
symbol_name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (& symbol_name);
 
for (i = 0; i < 16; i++)
if (! strcasecmp (regs[i], symbol_name))
break;
 
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
 
/* Error if register not found, or EAX used as a frame pointer. */
if (i == 16 || (kind == 0 && i == 0))
/contrib/toolchain/binutils/gas/config/obj-coff-seh.h
1,6 → 1,5
/* seh pdata/xdata coff object file format
Copyright 2009, 2010, 2012
Free Software Foundation, Inc.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
 
This file is part of GAS.
 
57,6 → 56,7
.seh_savereg
.seh_savexmm
.seh_pushframe
.seh_code
*/
 
/* architecture specific pdata/xdata handling. */
74,6 → 74,7
{"seh_32", obj_coff_seh_32, 1}, \
{"seh_no32", obj_coff_seh_32, 0}, \
{"seh_handler", obj_coff_seh_handler, 0}, \
{"seh_code", obj_coff_seh_code, 0}, \
{"seh_handlerdata", obj_coff_seh_handlerdata, 0},
 
/* Type definitions. */
149,6 → 150,7
static void obj_coff_seh_proc (int);
static void obj_coff_seh_handler (int);
static void obj_coff_seh_handlerdata (int);
static void obj_coff_seh_code (int);
 
#define UNDSEC bfd_und_section_ptr
 
202,4 → 204,3
PEX64_SCOPE_ENTRY_SIZE * (IDX))
 
#endif
 
/contrib/toolchain/binutils/gas/config/obj-coff.c
1,7 → 1,5
/* coff object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
Free Software Foundation, Inc.
Copyright (C) 1989-2015 Free Software Foundation, Inc.
 
This file is part of GAS.
 
24,7 → 22,6
 
#include "as.h"
#include "safe-ctype.h"
#include "obstack.h"
#include "subsegs.h"
#include "struc-symbol.h"
 
390,6 → 387,7
 
memset (s, 0, sz);
coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s;
coffsymbol (symbol_get_bfdsym (symbolP))->native->is_sym = TRUE;
 
S_SET_DATA_TYPE (symbolP, T_NULL);
S_SET_STORAGE_CLASS (symbolP, 0);
605,8 → 603,7
 
SKIP_WHITESPACES ();
 
symbol_name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&symbol_name);
symbol_name_length = strlen (symbol_name);
symbol_name_copy = xmalloc (symbol_name_length + 1);
strcpy (symbol_name_copy, symbol_name);
622,7 → 619,7
if (S_IS_STRING (def_symbol_in_progress))
SF_SET_STRING (def_symbol_in_progress);
 
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
 
demand_empty_rest_of_line ();
}
975,8 → 972,7
}
 
S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1);
symbol_name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&symbol_name);
 
#ifdef tc_canonicalize_symbol_name
symbol_name = tc_canonicalize_symbol_name (symbol_name);
990,8 → 986,8
as_warn (_("tag not found for .tag %s"), symbol_name);
 
SF_SET_TAGGED (def_symbol_in_progress);
*input_line_pointer = name_end;
 
(void) restore_line_pointer (name_end);
demand_empty_rest_of_line ();
}
 
1026,8 → 1022,8
 
if (is_name_beginner (*input_line_pointer))
{
char *symbol_name = input_line_pointer;
char name_end = get_symbol_end ();
char *symbol_name;
char name_end = get_symbol_name (&symbol_name);
 
#ifdef tc_canonicalize_symbol_name
symbol_name = tc_canonicalize_symbol_name (symbol_name);
1061,7 → 1057,7
}
/* Otherwise, it is the name of a non debug symbol and its value
will be calculated later. */
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
}
else
{
1172,8 → 1168,7
 
do
{
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (&name);
if (*name == 0)
{
as_warn (_("badly formed .weak directive ignored"));
1183,7 → 1178,7
c = 0;
symbolP = symbol_find_or_make (name);
*input_line_pointer = c;
SKIP_WHITESPACE ();
SKIP_WHITESPACE_AFTER_NAME ();
S_SET_WEAK (symbolP);
 
if (c == ',')
1566,16 → 1561,12
return;
}
 
section_name = input_line_pointer;
c = get_symbol_end ();
 
c = get_symbol_name (&section_name);
name = xmalloc (input_line_pointer - section_name + 1);
strcpy (name, section_name);
 
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
 
SKIP_WHITESPACE ();
 
exp = 0;
flags = SEC_NO_FLAGS;
 
/contrib/toolchain/binutils/gas/config/obj-coff.h
1,7 → 1,5
/* coff object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
Free Software Foundation, Inc.
Copyright (C) 1989-2015 Free Software Foundation, Inc.
 
This file is part of GAS.
 
77,11 → 75,6
#endif
#endif
 
#ifdef TC_OR32
#include "coff/or32.h"
#define TARGET_FORMAT "coff-or32-big"
#endif
 
#ifdef TC_I960
#include "coff/i960.h"
#define TARGET_FORMAT "coff-Intel-little"
/contrib/toolchain/binutils/gas/config/tc-i386-intel.c
1,6 → 1,5
/* tc-i386.c -- Assemble Intel syntax code for ix86/x86-64
Copyright 2009, 2010
Free Software Foundation, Inc.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
142,9 → 141,7
int adjust = 0;
char *gotfree_input_line = lex_got (&i.reloc[this_operand],
&adjust,
&intel_state.reloc_types,
(i.bnd_prefix != NULL
|| add_bnd_prefix));
&intel_state.reloc_types);
 
if (!gotfree_input_line)
break;
171,13 → 168,18
for (j = 0; i386_types[j].name; ++j)
if (strcasecmp (i386_types[j].name, name) == 0)
break;
 
if (i386_types[j].name && *pc == ' ')
{
char *pname = ++input_line_pointer;
char c = get_symbol_end ();
char *pname;
char c;
 
++input_line_pointer;
c = get_symbol_name (&pname);
 
if (strcasecmp (pname, "ptr") == 0)
{
/* FIXME: What if c == '"' ? */
pname[-1] = *pc;
*pc = c;
if (intel_syntax > 0 || operands != 1)
185,7 → 187,7
return i386_types[j].op;
}
 
*input_line_pointer = c;
(void) restore_line_pointer (c);
input_line_pointer = pname - 1;
}
 
293,6 → 295,8
else if (!intel_state.index)
{
if (intel_state.in_scale
|| current_templates->start->base_opcode == 0xf30f1b /* bndmk */
|| (current_templates->start->base_opcode & ~1) == 0x0f1a /* bnd{ld,st}x */
|| i386_regtab[reg_num].reg_type.bitfield.baseindex)
intel_state.index = i386_regtab + reg_num;
else
415,23 → 419,21
if (this_operand >= 0 && intel_state.in_bracket)
{
expressionS *scale = NULL;
int has_index = (intel_state.index != NULL);
 
if (intel_state.index)
--scale;
 
if (!intel_state.in_scale++)
intel_state.scale_factor = 1;
 
ret = i386_intel_simplify_symbol (e->X_add_symbol);
if (ret && !scale && intel_state.index)
if (ret && !has_index && intel_state.index)
scale = symbol_get_value_expression (e->X_op_symbol);
 
if (ret)
ret = i386_intel_simplify_symbol (e->X_op_symbol);
if (ret && !scale && intel_state.index)
if (ret && !scale && !has_index && intel_state.index)
scale = symbol_get_value_expression (e->X_add_symbol);
 
if (ret && scale && (scale + 1))
if (ret && scale)
{
resolve_expression (scale);
if (scale->X_op != O_constant
/contrib/toolchain/binutils/gas/config/tc-i386.c
1,8 → 1,5
/* tc-i386.c -- Assemble code for the Intel 80386
Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
2012
Free Software Foundation, Inc.
Copyright (C) 1989-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
516,6 → 513,16
static enum x86_elf_abi x86_elf_abi = I386_ABI;
#endif
 
#if defined (TE_PE) || defined (TE_PEP)
/* Use big object file format. */
static int use_big_obj = 0;
#endif
 
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
/* 1 if generating code for a shared library. */
static int shared = 0;
#endif
 
/* 1 for intel syntax,
0 if att syntax. */
static int intel_syntax = 0;
541,6 → 548,10
/* 1 if pseudo index register, eiz/riz, is allowed . */
static int allow_index_reg = 0;
 
/* 1 if the assembler should ignore LOCK prefix, even if it was
specified explicitly. */
static int omit_lock_prefix = 0;
 
static enum check_kind
{
check_none = 0,
614,6 → 625,9
evexw1
} evexwig;
 
/* Value to encode in EVEX RC bits, for SAE-only instructions. */
static enum rc_type evexrcig = rne;
 
/* Pre-defined "_GLOBAL_OFFSET_TABLE_". */
static symbolS *GOT_symbol;
 
752,6 → 766,8
CPU_L1OM_FLAGS, 0, 0 },
{ STRING_COMMA_LEN ("k1om"), PROCESSOR_K1OM,
CPU_K1OM_FLAGS, 0, 0 },
{ STRING_COMMA_LEN ("iamcu"), PROCESSOR_IAMCU,
CPU_IAMCU_FLAGS, 0, 0 },
{ STRING_COMMA_LEN ("k6"), PROCESSOR_K6,
CPU_K6_FLAGS, 0, 0 },
{ STRING_COMMA_LEN ("k6_2"), PROCESSOR_K6,
772,6 → 788,10
CPU_BDVER2_FLAGS, 0, 0 },
{ STRING_COMMA_LEN ("bdver3"), PROCESSOR_BD,
CPU_BDVER3_FLAGS, 0, 0 },
{ STRING_COMMA_LEN ("bdver4"), PROCESSOR_BD,
CPU_BDVER4_FLAGS, 0, 0 },
{ STRING_COMMA_LEN ("znver1"), PROCESSOR_ZNVER,
CPU_ZNVER1_FLAGS, 0, 0 },
{ STRING_COMMA_LEN ("btver1"), PROCESSOR_BT,
CPU_BTVER1_FLAGS, 0, 0 },
{ STRING_COMMA_LEN ("btver2"), PROCESSOR_BT,
816,6 → 836,12
CPU_AVX512ER_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".avx512pf"), PROCESSOR_UNKNOWN,
CPU_AVX512PF_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".avx512dq"), PROCESSOR_UNKNOWN,
CPU_AVX512DQ_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".avx512bw"), PROCESSOR_UNKNOWN,
CPU_AVX512BW_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".avx512vl"), PROCESSOR_UNKNOWN,
CPU_AVX512VL_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".noavx"), PROCESSOR_UNKNOWN,
CPU_ANY_AVX_FLAGS, 0, 1 },
{ STRING_COMMA_LEN (".vmx"), PROCESSOR_UNKNOWN,
828,6 → 854,10
CPU_XSAVE_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".xsaveopt"), PROCESSOR_UNKNOWN,
CPU_XSAVEOPT_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".xsavec"), PROCESSOR_UNKNOWN,
CPU_XSAVEC_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".xsaves"), PROCESSOR_UNKNOWN,
CPU_XSAVES_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".aes"), PROCESSOR_UNKNOWN,
CPU_AES_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".pclmul"), PROCESSOR_UNKNOWN,
902,6 → 932,26
CPU_MPX_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".sha"), PROCESSOR_UNKNOWN,
CPU_SHA_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".clflushopt"), PROCESSOR_UNKNOWN,
CPU_CLFLUSHOPT_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".prefetchwt1"), PROCESSOR_UNKNOWN,
CPU_PREFETCHWT1_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".se1"), PROCESSOR_UNKNOWN,
CPU_SE1_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".clwb"), PROCESSOR_UNKNOWN,
CPU_CLWB_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".pcommit"), PROCESSOR_UNKNOWN,
CPU_PCOMMIT_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".avx512ifma"), PROCESSOR_UNKNOWN,
CPU_AVX512IFMA_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".avx512vbmi"), PROCESSOR_UNKNOWN,
CPU_AVX512VBMI_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".clzero"), PROCESSOR_UNKNOWN,
CPU_CLZERO_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".mwaitx"), PROCESSOR_UNKNOWN,
CPU_MWAITX_FLAGS, 0, 0 },
{ STRING_COMMA_LEN (".ospke"), PROCESSOR_UNKNOWN,
CPU_OSPKE_FLAGS, 0, 0 },
};
 
#ifdef I386COFF
1094,86 → 1144,10
/* nopw %cs:0L(%[re]ax,%[re]ax,1) */
static const char alt_10[] =
{0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00};
/* data16
nopw %cs:0L(%[re]ax,%[re]ax,1) */
static const char alt_long_11[] =
{0x66,
0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00};
/* data16
data16
nopw %cs:0L(%[re]ax,%[re]ax,1) */
static const char alt_long_12[] =
{0x66,
0x66,
0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00};
/* data16
data16
data16
nopw %cs:0L(%[re]ax,%[re]ax,1) */
static const char alt_long_13[] =
{0x66,
0x66,
0x66,
0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00};
/* data16
data16
data16
data16
nopw %cs:0L(%[re]ax,%[re]ax,1) */
static const char alt_long_14[] =
{0x66,
0x66,
0x66,
0x66,
0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00};
/* data16
data16
data16
data16
data16
nopw %cs:0L(%[re]ax,%[re]ax,1) */
static const char alt_long_15[] =
{0x66,
0x66,
0x66,
0x66,
0x66,
0x66,0x2e,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00};
/* nopl 0(%[re]ax,%[re]ax,1)
nopw 0(%[re]ax,%[re]ax,1) */
static const char alt_short_11[] =
{0x0f,0x1f,0x44,0x00,0x00,
0x66,0x0f,0x1f,0x44,0x00,0x00};
/* nopw 0(%[re]ax,%[re]ax,1)
nopw 0(%[re]ax,%[re]ax,1) */
static const char alt_short_12[] =
{0x66,0x0f,0x1f,0x44,0x00,0x00,
0x66,0x0f,0x1f,0x44,0x00,0x00};
/* nopw 0(%[re]ax,%[re]ax,1)
nopl 0L(%[re]ax) */
static const char alt_short_13[] =
{0x66,0x0f,0x1f,0x44,0x00,0x00,
0x0f,0x1f,0x80,0x00,0x00,0x00,0x00};
/* nopl 0L(%[re]ax)
nopl 0L(%[re]ax) */
static const char alt_short_14[] =
{0x0f,0x1f,0x80,0x00,0x00,0x00,0x00,
0x0f,0x1f,0x80,0x00,0x00,0x00,0x00};
/* nopl 0L(%[re]ax)
nopl 0L(%[re]ax,%[re]ax,1) */
static const char alt_short_15[] =
{0x0f,0x1f,0x80,0x00,0x00,0x00,0x00,
0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00};
static const char *const alt_short_patt[] = {
static const char *const alt_patt[] = {
f32_1, f32_2, alt_3, alt_4, alt_5, alt_6, alt_7, alt_8,
alt_9, alt_10, alt_short_11, alt_short_12, alt_short_13,
alt_short_14, alt_short_15
alt_9, alt_10
};
static const char *const alt_long_patt[] = {
f32_1, f32_2, alt_3, alt_4, alt_5, alt_6, alt_7, alt_8,
alt_9, alt_10, alt_long_11, alt_long_12, alt_long_13,
alt_long_14, alt_long_15
};
 
/* Only align for at least a positive non-zero boundary. */
if (count <= 0 || count > MAX_MEM_FOR_RS_ALIGN_CODE)
1184,14 → 1158,9
 
1. For PROCESSOR_I386, PROCESSOR_I486, PROCESSOR_PENTIUM and
PROCESSOR_GENERIC32, f32_patt will be used.
2. For PROCESSOR_PENTIUMPRO, PROCESSOR_PENTIUM4, PROCESSOR_NOCONA,
PROCESSOR_CORE, PROCESSOR_CORE2, PROCESSOR_COREI7, and
PROCESSOR_GENERIC64, alt_long_patt will be used.
3. For PROCESSOR_ATHLON, PROCESSOR_K6, PROCESSOR_K8 and
PROCESSOR_AMDFAM10, PROCESSOR_BD and PROCESSOR_BT, alt_short_patt
will be used.
2. For the rest, alt_patt will be used.
 
When -mtune= isn't used, alt_long_patt will be used if
When -mtune= isn't used, alt_patt will be used if
cpu_arch_isa_flags has CpuNop. Otherwise, f32_patt will
be used.
 
1224,7 → 1193,7
/* We use cpu_arch_isa_flags to check if we SHOULD
optimize with nops. */
if (fragP->tc_frag_data.isa_flags.bitfield.cpunop)
patt = alt_long_patt;
patt = alt_patt;
else
patt = f32_patt;
break;
1236,20 → 1205,20
case PROCESSOR_L1OM:
case PROCESSOR_K1OM:
case PROCESSOR_GENERIC64:
patt = alt_long_patt;
break;
case PROCESSOR_K6:
case PROCESSOR_ATHLON:
case PROCESSOR_K8:
case PROCESSOR_AMDFAM10:
case PROCESSOR_BD:
case PROCESSOR_ZNVER:
case PROCESSOR_BT:
patt = alt_short_patt;
patt = alt_patt;
break;
case PROCESSOR_I386:
case PROCESSOR_I486:
case PROCESSOR_PENTIUM:
case PROCESSOR_PENTIUMPRO:
case PROCESSOR_IAMCU:
case PROCESSOR_GENERIC32:
patt = f32_patt;
break;
1268,17 → 1237,19
case PROCESSOR_I386:
case PROCESSOR_I486:
case PROCESSOR_PENTIUM:
case PROCESSOR_IAMCU:
case PROCESSOR_K6:
case PROCESSOR_ATHLON:
case PROCESSOR_K8:
case PROCESSOR_AMDFAM10:
case PROCESSOR_BD:
case PROCESSOR_ZNVER:
case PROCESSOR_BT:
case PROCESSOR_GENERIC32:
/* We use cpu_arch_isa_flags to check if we CAN optimize
with nops. */
if (fragP->tc_frag_data.isa_flags.bitfield.cpunop)
patt = alt_short_patt;
patt = alt_patt;
else
patt = f32_patt;
break;
1291,12 → 1262,12
case PROCESSOR_L1OM:
case PROCESSOR_K1OM:
if (fragP->tc_frag_data.isa_flags.bitfield.cpunop)
patt = alt_long_patt;
patt = alt_patt;
else
patt = f32_patt;
break;
case PROCESSOR_GENERIC64:
patt = alt_long_patt;
patt = alt_patt;
break;
}
}
1327,15 → 1298,15
}
else
{
/* Maximum length of an instruction is 15 byte. If the
padding is greater than 15 bytes and we don't use jump,
/* Maximum length of an instruction is 10 byte. If the
padding is greater than 10 bytes and we don't use jump,
we have to break it into smaller pieces. */
int padding = count;
while (padding > 15)
while (padding > 10)
{
padding -= 15;
padding -= 10;
memcpy (fragP->fr_literal + fragP->fr_fix + padding,
patt [14], 15);
patt [9], 10);
}
 
if (padding)
1419,23 → 1390,6
}
}
 
static INLINE void
cpu_flags_set (union i386_cpu_flags *x, unsigned int v)
{
switch (ARRAY_SIZE(x->array))
{
case 3:
x->array[2] = v;
case 2:
x->array[1] = v;
case 1:
x->array[0] = v;
break;
default:
abort ();
}
}
 
static INLINE int
cpu_flags_equal (const union i386_cpu_flags *x,
const union i386_cpu_flags *y)
1517,6 → 1471,20
return x;
}
 
static int
valid_iamcu_cpu_flags (const i386_cpu_flags *flags)
{
if (cpu_arch_isa == PROCESSOR_IAMCU)
{
static const i386_cpu_flags iamcu_flags = CPU_IAMCU_COMPAT_FLAGS;
i386_cpu_flags compat_flags;
compat_flags = cpu_flags_and_not (*flags, iamcu_flags);
return cpu_flags_all_zero (&compat_flags);
}
else
return 1;
}
 
#define CPU_FLAGS_ARCH_MATCH 0x1
#define CPU_FLAGS_64BIT_MATCH 0x2
#define CPU_FLAGS_AES_MATCH 0x4
1665,8 → 1633,6
static const i386_operand_type imm16_32s = OPERAND_TYPE_IMM16_32S;
static const i386_operand_type imm16_32_32s = OPERAND_TYPE_IMM16_32_32S;
static const i386_operand_type vec_imm4 = OPERAND_TYPE_VEC_IMM4;
static const i386_operand_type regbnd = OPERAND_TYPE_REGBND;
static const i386_operand_type vec_disp8 = OPERAND_TYPE_VEC_DISP8;
 
enum operand_type
{
1741,6 → 1707,7
{
return (match_reg_size (t, j)
&& !((i.types[j].bitfield.unspecified
&& !i.broadcast
&& !t->operand_types[j].bitfield.unspecified)
|| (i.types[j].bitfield.fword
&& !t->operand_types[j].bitfield.fword)
1921,47 → 1888,46
}
 
static INLINE int
fits_in_signed_byte (offsetT num)
fits_in_signed_byte (addressT num)
{
return (num >= -128) && (num <= 127);
return num + 0x80 <= 0xff;
}
 
static INLINE int
fits_in_unsigned_byte (offsetT num)
fits_in_unsigned_byte (addressT num)
{
return (num & 0xff) == num;
return num <= 0xff;
}
 
static INLINE int
fits_in_unsigned_word (offsetT num)
fits_in_unsigned_word (addressT num)
{
return (num & 0xffff) == num;
return num <= 0xffff;
}
 
static INLINE int
fits_in_signed_word (offsetT num)
fits_in_signed_word (addressT num)
{
return (-32768 <= num) && (num <= 32767);
return num + 0x8000 <= 0xffff;
}
 
static INLINE int
fits_in_signed_long (offsetT num ATTRIBUTE_UNUSED)
fits_in_signed_long (addressT num ATTRIBUTE_UNUSED)
{
#ifndef BFD64
return 1;
#else
return (!(((offsetT) -1 << 31) & num)
|| (((offsetT) -1 << 31) & num) == ((offsetT) -1 << 31));
return num + 0x80000000 <= 0xffffffff;
#endif
} /* fits_in_signed_long() */
 
static INLINE int
fits_in_unsigned_long (offsetT num ATTRIBUTE_UNUSED)
fits_in_unsigned_long (addressT num ATTRIBUTE_UNUSED)
{
#ifndef BFD64
return 1;
#else
return (num & (((offsetT) 2 << 31) - 1)) == num;
return num <= 0xffffffff;
#endif
} /* fits_in_unsigned_long() */
 
2228,8 → 2194,8
SKIP_WHITESPACE ();
if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
char *string = input_line_pointer;
int e = get_symbol_end ();
char *string;
int e = get_symbol_name (&string);
 
if (strcmp (string, "prefix") == 0)
ask_naked_reg = 1;
2237,7 → 2203,7
ask_naked_reg = -1;
else
as_bad (_("bad argument to syntax directive."));
*input_line_pointer = e;
(void) restore_line_pointer (e);
}
demand_empty_rest_of_line ();
 
2289,8 → 2255,8
 
if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
char *string = input_line_pointer;
int e = get_symbol_end ();
char *string;
int e = get_symbol_name (&string);
 
if (strcmp (string, "none") == 0)
*kind = check_none;
2300,7 → 2266,7
*kind = check_error;
else
as_bad (_("bad argument to %s_check directive."), str);
*input_line_pointer = e;
(void) restore_line_pointer (e);
}
else
as_bad (_("missing argument for %s_check directive"), str);
2328,6 → 2294,11
arch = default_arch;
}
 
/* If we are targeting Intel MCU, we must enable it. */
if (get_elf_backend_data (stdoutput)->elf_machine_code != EM_IAMCU
|| new_flag.bitfield.cpuiamcu)
return;
 
/* If we are targeting Intel L1OM, we must enable it. */
if (get_elf_backend_data (stdoutput)->elf_machine_code != EM_L1OM
|| new_flag.bitfield.cpul1om)
2349,8 → 2320,8
 
if (!is_end_of_line[(unsigned char) *input_line_pointer])
{
char *string = input_line_pointer;
int e = get_symbol_end ();
char *string;
int e = get_symbol_name (&string);
unsigned int j;
i386_cpu_flags flags;
 
2391,7 → 2362,11
else
flags = cpu_flags_and_not (cpu_arch_flags,
cpu_arch[j].flags);
if (!cpu_flags_equal (&flags, &cpu_arch_flags))
 
if (!valid_iamcu_cpu_flags (&flags))
as_fatal (_("`%s' isn't valid for Intel MCU"),
cpu_arch[j].name);
else if (!cpu_flags_equal (&flags, &cpu_arch_flags))
{
if (cpu_sub_arch_name)
{
2406,7 → 2381,7
cpu_arch_flags = flags;
cpu_arch_isa_flags = flags;
}
*input_line_pointer = e;
(void) restore_line_pointer (e);
demand_empty_rest_of_line ();
return;
}
2423,9 → 2398,12
if (*input_line_pointer == ','
&& !is_end_of_line[(unsigned char) input_line_pointer[1]])
{
char *string = ++input_line_pointer;
int e = get_symbol_end ();
char *string;
char e;
 
++input_line_pointer;
e = get_symbol_name (&string);
 
if (strcmp (string, "nojumps") == 0)
no_cond_jump_promotion = 1;
else if (strcmp (string, "jumps") == 0)
2433,7 → 2411,7
else
as_bad (_("no such architecture modifier: `%s'"), string);
 
*input_line_pointer = e;
(void) restore_line_pointer (e);
}
 
demand_empty_rest_of_line ();
2456,6 → 2434,13
as_fatal (_("Intel K1OM is 64bit ELF only"));
return bfd_arch_k1om;
}
else if (cpu_arch_isa == PROCESSOR_IAMCU)
{
if (OUTPUT_FLAVOR != bfd_target_elf_flavour
|| flag_code == CODE_64BIT)
as_fatal (_("Intel MCU is 32bit ELF only"));
return bfd_arch_iamcu;
}
else
return bfd_arch_i386;
}
2484,8 → 2469,18
else
return bfd_mach_x64_32;
}
else if (!strcmp (default_arch, "i386"))
else if (!strcmp (default_arch, "i386")
|| !strcmp (default_arch, "iamcu"))
{
if (cpu_arch_isa == PROCESSOR_IAMCU)
{
if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
as_fatal (_("Intel MCU is 32bit ELF only"));
return bfd_mach_i386_iamcu;
}
else
return bfd_mach_i386_i386;
}
else
as_fatal (_("unknown architecture"));
}
2798,7 → 2793,6
reloc (unsigned int size,
int pcrel,
int sign,
int bnd_prefix,
bfd_reloc_code_real_type other)
{
if (other != NO_RELOC)
2811,6 → 2805,9
case BFD_RELOC_X86_64_GOT32:
return BFD_RELOC_X86_64_GOT64;
break;
case BFD_RELOC_X86_64_GOTPLT64:
return BFD_RELOC_X86_64_GOTPLT64;
break;
case BFD_RELOC_X86_64_PLTOFF64:
return BFD_RELOC_X86_64_PLTOFF64;
break;
2834,10 → 2831,13
if (other == BFD_RELOC_SIZE32)
{
if (size == 8)
return BFD_RELOC_SIZE64;
other = BFD_RELOC_SIZE64;
if (pcrel)
{
as_bad (_("there are no pc-relative size relocations"));
return NO_RELOC;
}
}
#endif
 
/* Sign-checking 4-byte relocations in 16-/32-bit code is pointless. */
2871,9 → 2871,7
{
case 1: return BFD_RELOC_8_PCREL;
case 2: return BFD_RELOC_16_PCREL;
case 4: return (bnd_prefix && object_64bit
? BFD_RELOC_X86_64_PC32_BND
: BFD_RELOC_32_PCREL);
case 4: return BFD_RELOC_32_PCREL;
case 8: return BFD_RELOC_64_PCREL;
}
as_bad (_("cannot do %u byte pc-relative relocation"), size);
2932,6 → 2930,7
|| fixP->fx_r_type == BFD_RELOC_386_GOTOFF
|| fixP->fx_r_type == BFD_RELOC_386_PLT32
|| fixP->fx_r_type == BFD_RELOC_386_GOT32
|| fixP->fx_r_type == BFD_RELOC_386_GOT32X
|| fixP->fx_r_type == BFD_RELOC_386_TLS_GD
|| fixP->fx_r_type == BFD_RELOC_386_TLS_LDM
|| fixP->fx_r_type == BFD_RELOC_386_TLS_LDO_32
2945,6 → 2944,8
|| fixP->fx_r_type == BFD_RELOC_X86_64_PLT32
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOT32
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOTPCREL
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOTPCRELX
|| fixP->fx_r_type == BFD_RELOC_X86_64_REX_GOTPCRELX
|| fixP->fx_r_type == BFD_RELOC_X86_64_TLSGD
|| fixP->fx_r_type == BFD_RELOC_X86_64_TLSLD
|| fixP->fx_r_type == BFD_RELOC_X86_64_DTPOFF32
3148,14 → 3149,8
 
/* Check the REX.W bit. */
w = (i.rex & REX_W) ? 1 : 0;
if (i.tm.opcode_modifier.vexw)
{
if (w)
abort ();
 
if (i.tm.opcode_modifier.vexw == VEXW1)
w = 1;
}
 
i.vex.bytes[2] = (w << 7
| register_specifier << 3
3326,7 → 3321,7
if (i.rounding->type != saeonly)
i.vex.bytes[3] |= 0x10 | (i.rounding->type << 5);
else
i.vex.bytes[3] |= 0x10;
i.vex.bytes[3] |= 0x10 | (evexrcig << 5);
}
 
if (i.mask && i.mask->mask)
3356,6 → 3351,34
i.operands = 0;
}
 
if (i.tm.cpu_flags.bitfield.cpumwaitx && i.operands > 0)
{
/* MONITORX/MWAITX instructions have fixed operands with an opcode
suffix which is coded in the same place as an 8-bit immediate
field would be.
Here we check those operands and remove them afterwards. */
unsigned int x;
 
if (i.operands != 3)
abort();
 
for (x = 0; x < 2; x++)
if (register_number (i.op[x].regs) != x)
goto bad_register_operand;
 
/* Check for third operand for mwaitx/monitorx insn. */
if (register_number (i.op[x].regs)
!= (x + (i.tm.extension_opcode == 0xfb)))
{
bad_register_operand:
as_bad (_("can't use register '%s%s' as operand %d in '%s'."),
register_prefix, i.op[x].regs->reg_name, x+1,
i.tm.name);
}
 
i.operands = 0;
}
 
/* These AMD 3DNow! and SSE2 instructions have an opcode suffix
which is coded in the same place as an 8-bit immediate field
would be. Here we fake an 8-bit immediate operand from the
3611,11 → 3634,20
as_warn (_("translating to `%sp'"), i.tm.name);
}
 
if (i.tm.opcode_modifier.vex || i.tm.opcode_modifier.evex)
{
if (flag_code == CODE_16BIT)
{
as_bad (_("instruction `%s' isn't supported in 16-bit mode."),
i.tm.name);
return;
}
 
if (i.tm.opcode_modifier.vex)
build_vex_prefix (t);
 
if (i.tm.opcode_modifier.evex)
else
build_evex_prefix ();
}
 
/* Handle conversion of 'int $3' --> special int3 insn. XOP or FMA4
instructions may define INT_OPCODE as well, so avoid this corner
3937,7 → 3969,7
/* Skip optional white space before operand. */
if (is_space_char (*l))
++l;
if (!is_operand_char (*l) && *l != END_OF_INSN)
if (!is_operand_char (*l) && *l != END_OF_INSN && *l != '"')
{
as_bad (_("invalid character %s before operand %d"),
output_invalid (*l),
3944,7 → 3976,7
i.operands + 1);
return NULL;
}
token_start = l; /* after white space */
token_start = l; /* After white space. */
paren_not_balanced = 0;
while (paren_not_balanced || *l != ',')
{
3963,7 → 3995,7
else
break; /* we are done */
}
else if (!is_operand_char (*l) && !is_space_char (*l))
else if (!is_operand_char (*l) && !is_space_char (*l) && *l != '"')
{
as_bad (_("invalid character %s in operand %d"),
output_invalid (*l),
4374,11 → 4406,9
if (i.reg_operands == 2 && !i.mask)
{
gas_assert (i.types[0].bitfield.regxmm
|| i.types[0].bitfield.regymm
|| i.types[0].bitfield.regzmm);
|| i.types[0].bitfield.regymm);
gas_assert (i.types[2].bitfield.regxmm
|| i.types[2].bitfield.regymm
|| i.types[2].bitfield.regzmm);
|| i.types[2].bitfield.regymm);
if (operand_check == check_none)
return 0;
if (register_number (i.op[0].regs)
4395,7 → 4425,23
}
as_warn (_("mask, index, and destination registers should be distinct"));
}
else if (i.reg_operands == 1 && i.mask)
{
if ((i.types[1].bitfield.regymm
|| i.types[1].bitfield.regzmm)
&& (register_number (i.op[1].regs)
== register_number (i.index_reg)))
{
if (operand_check == check_error)
{
i.error = invalid_vector_register_set;
return 1;
}
if (operand_check != check_none)
as_warn (_("index and destination registers should be distinct"));
}
}
}
 
/* Check if broadcast is supported by the instruction and is applied
to the memory operand. */
4421,6 → 4467,10
broadcasted_opnd_size <<= 4; /* Broadcast 1to16. */
else if (i.broadcast->type == BROADCAST_1TO8)
broadcasted_opnd_size <<= 3; /* Broadcast 1to8. */
else if (i.broadcast->type == BROADCAST_1TO4)
broadcasted_opnd_size <<= 2; /* Broadcast 1to4. */
else if (i.broadcast->type == BROADCAST_1TO2)
broadcasted_opnd_size <<= 1; /* Broadcast 1to2. */
else
goto bad_broadcast;
 
4672,9 → 4722,9
&& !operand_types[0].bitfield.regymm
&& !operand_types[0].bitfield.regzmm)
|| (!operand_types[t->operands > 1].bitfield.regmmx
&& !!operand_types[t->operands > 1].bitfield.regxmm
&& !!operand_types[t->operands > 1].bitfield.regymm
&& !!operand_types[t->operands > 1].bitfield.regzmm))
&& operand_types[t->operands > 1].bitfield.regxmm
&& operand_types[t->operands > 1].bitfield.regymm
&& operand_types[t->operands > 1].bitfield.regzmm))
&& (t->base_opcode != 0x0fc7
|| t->extension_opcode != 1 /* cmpxchg8b */))
continue;
4689,7 → 4739,7
&& ((!operand_types[0].bitfield.regmmx
&& !operand_types[0].bitfield.regxmm)
|| (!operand_types[t->operands > 1].bitfield.regmmx
&& !!operand_types[t->operands > 1].bitfield.regxmm)))
&& operand_types[t->operands > 1].bitfield.regxmm)))
continue;
 
/* Do not verify operands when there are none. */
4746,6 → 4796,10
}
}
 
/* Force 0x8b encoding for "mov foo@GOT, %eax". */
if (i.reloc[0] == BFD_RELOC_386_GOT32 && t->base_opcode == 0xa0)
continue;
 
/* We check register size if needed. */
check_register = t->opcode_modifier.checkregsize;
overlap0 = operand_type_and (i.types[0], operand_types[0]);
5435,16 → 5489,13
return 0;
}
#if REGISTER_WARNINGS
else
as_warn (_("using `%s%s' instead of `%s%s' due to `%c' suffix"),
register_prefix,
(i.op[op].regs + REGNAM_EAX - REGNAM_AX)->reg_name,
register_prefix,
i.op[op].regs->reg_name,
i.suffix);
register_prefix, i.op[op].regs->reg_name, i.suffix);
#endif
}
/* Warn if the r prefix on a general reg is missing. */
/* Warn if the r prefix on a general reg is present. */
else if (i.types[op].bitfield.reg64
&& (i.tm.operand_types[op].bitfield.reg32
|| i.tm.operand_types[op].bitfield.acc))
5487,7 → 5538,7
i.suffix);
return 0;
}
/* Warn if the e prefix on a general reg is missing. */
/* Warn if the r prefix on a general reg is missing. */
else if ((i.types[op].bitfield.reg16
|| i.types[op].bitfield.reg32)
&& (i.tm.operand_types[op].bitfield.reg32
5532,9 → 5583,10
i.suffix);
return 0;
}
/* Warn if the e prefix on a general reg is present. */
/* Warn if the e or r prefix on a general reg is present. */
else if ((!quiet_warnings || flag_code == CODE_64BIT)
&& i.types[op].bitfield.reg32
&& (i.types[op].bitfield.reg32
|| i.types[op].bitfield.reg64)
&& (i.tm.operand_types[op].bitfield.reg16
|| i.tm.operand_types[op].bitfield.acc))
{
5547,14 → 5599,11
i.suffix);
return 0;
}
else
#if REGISTER_WARNINGS
as_warn (_("using `%s%s' instead of `%s%s' due to `%c' suffix"),
register_prefix,
(i.op[op].regs + REGNAM_AX - REGNAM_EAX)->reg_name,
register_prefix,
i.op[op].regs->reg_name,
i.suffix);
register_prefix, i.op[op].regs->reg_name, i.suffix);
#endif
}
return 1;
6139,8 → 6188,8
op = i.tm.operand_types[vvvv];
op.bitfield.regmem = 0;
if ((dest + 1) >= i.operands
|| (op.bitfield.reg32 != 1
&& !op.bitfield.reg64 != 1
|| (!op.bitfield.reg32
&& op.bitfield.reg64
&& !operand_type_equal (&op, &regxmm)
&& !operand_type_equal (&op, &regymm)
&& !operand_type_equal (&op, &regzmm)
6722,13 → 6771,7
 
/* 1 possible extra opcode + 4 byte displacement go in var part.
Pass reloc in fr_var. */
frag_var (rs_machine_dependent, 5,
((!object_64bit
|| i.reloc[0] != NO_RELOC
|| (i.bnd_prefix == NULL && !add_bnd_prefix))
? i.reloc[0]
: BFD_RELOC_X86_64_PC32_BND),
subtype, sym, off, p);
frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p);
}
 
static void
6804,10 → 6847,7
}
 
fixP = fix_new_exp (frag_now, p - frag_now->fr_literal, size,
i.op[0].disps, 1, reloc (size, 1, 1,
(i.bnd_prefix != NULL
|| add_bnd_prefix),
i.reloc[0]));
i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0]));
 
/* All jumps handled here are signed, but don't use a signed limit
check for 32 and 16 bit jumps as we want to allow wrap around at
6873,7 → 6913,7
}
else
fix_new_exp (frag_now, p - frag_now->fr_literal, size,
i.op[1].imms, 0, reloc (size, 0, 0, 0, i.reloc[1]));
i.op[1].imms, 0, reloc (size, 0, 0, i.reloc[1]));
if (i.op[0].imms->X_op != O_constant)
as_bad (_("can't handle non absolute segment in `%s'"),
i.tm.name);
6910,6 → 6950,15
unsigned int j;
unsigned int prefix;
 
/* Some processors fail on LOCK prefix. This options makes
assembler ignore LOCK prefix and serves as a workaround. */
if (omit_lock_prefix)
{
if (i.tm.base_opcode == LOCK_PREFIX_OPCODE)
return;
i.prefix[LOCK_PREFIX] = 0;
}
 
/* Since the VEX/EVEX prefix contains the implicit prefix, we
don't need the explicit prefix. */
if (!i.tm.opcode_modifier.vex && !i.tm.opcode_modifier.evex)
6945,6 → 6994,17
abort ();
}
 
#if defined (OBJ_MAYBE_ELF) || defined (OBJ_ELF)
/* For x32, add a dummy REX_OPCODE prefix for mov/add with
R_X86_64_GOTTPOFF relocation so that linker can safely
perform IE->LE optimization. */
if (x86_elf_abi == X86_64_X32_ABI
&& i.operands == 2
&& i.reloc[0] == BFD_RELOC_X86_64_GOTTPOFF
&& i.prefix[REX_PREFIX] == 0)
add_prefix (REX_OPCODE);
#endif
 
/* The prefix bytes. */
for (j = ARRAY_SIZE (i.prefix), q = i.prefix; j > 0; j--, q++)
if (*q)
7106,6 → 7166,7
int size = disp_size (n);
int sign = i.types[n].bitfield.disp32s;
int pcrel = (i.flags[n] & Operand_PCrel) != 0;
fixS *fixP;
 
/* We can't have 8 bit displacement here. */
gas_assert (!i.types[n].bitfield.disp8);
7132,10 → 7193,7
}
 
p = frag_more (size);
reloc_type = reloc (size, pcrel, sign,
(i.bnd_prefix != NULL
|| add_bnd_prefix),
i.reloc[n]);
reloc_type = reloc (size, pcrel, sign, i.reloc[n]);
if (GOT_symbol
&& GOT_symbol == i.op[n].disps->X_add_symbol
&& (((reloc_type == BFD_RELOC_32
7177,12 → 7235,38
insn, and that is taken care of in other code. */
reloc_type = BFD_RELOC_X86_64_GOTPC32;
}
fix_new_exp (frag_now, p - frag_now->fr_literal, size,
i.op[n].disps, pcrel, reloc_type);
fixP = fix_new_exp (frag_now, p - frag_now->fr_literal,
size, i.op[n].disps, pcrel,
reloc_type);
/* Check for "call/jmp *mem", "mov mem, %reg",
"test %reg, mem" and "binop mem, %reg" where binop
is one of adc, add, and, cmp, or, sbb, sub, xor
instructions. */
if ((i.rm.mode == 2
|| (i.rm.mode == 0 && i.rm.regmem == 5))
&& ((i.operands == 1
&& i.tm.base_opcode == 0xff
&& (i.rm.reg == 2 || i.rm.reg == 4))
|| (i.operands == 2
&& (i.tm.base_opcode == 0x8b
|| i.tm.base_opcode == 0x85
|| (i.tm.base_opcode & 0xc7) == 0x03))))
{
if (object_64bit)
{
fixP->fx_tcbit = i.rex != 0;
if (i.base_reg
&& (i.base_reg->reg_num == RegRip
|| i.base_reg->reg_num == RegEip))
fixP->fx_tcbit2 = 1;
}
else
fixP->fx_tcbit2 = 1;
}
}
}
}
}
 
static void
output_imm (fragS *insn_start_frag, offsetT insn_start_off)
7226,7 → 7310,7
sign = 0;
 
p = frag_more (size);
reloc_type = reloc (size, 0, sign, 0, i.reloc[n]);
reloc_type = reloc (size, 0, sign, i.reloc[n]);
 
/* This is tough to explain. We end up with this one if we
* have operands that look like
7313,17 → 7397,14
/* x86_cons_fix_new is called via the expression parsing code when a
reloc is needed. We use this hook to get the correct .got reloc. */
static enum bfd_reloc_code_real got_reloc = NO_RELOC;
static int cons_sign = -1;
 
void
x86_cons_fix_new (fragS *frag, unsigned int off, unsigned int len,
expressionS *exp)
expressionS *exp, bfd_reloc_code_real_type r)
{
enum bfd_reloc_code_real r = reloc (len, 0, cons_sign, 0, got_reloc);
r = reloc (len, 0, cons_sign, r);
 
got_reloc = NO_RELOC;
 
#ifdef TE_PE
if (exp->X_op == O_secrel)
{
7348,7 → 7429,7
 
#if !(defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) || defined (OBJ_MACH_O)) \
|| defined (LEX_AT)
# define lex_got(reloc, adjust, types, bnd_prefix) NULL
# define lex_got(reloc, adjust, types) NULL
#else
/* Parse operands of the form
<symbol>@GOTOFF+<nnn>
7362,8 → 7443,7
static char *
lex_got (enum bfd_reloc_code_real *rel,
int *adjust,
i386_operand_type *types,
int bnd_prefix)
i386_operand_type *types)
{
/* Some of the relocations depend on the size of what field is to
be relocated. But in our callers i386_immediate and i386_displacement
7498,8 → 7578,6
*adjust = len;
memcpy (tmpbuf + first, past_reloc, second);
tmpbuf[first + second] = '\0';
if (bnd_prefix && *rel == BFD_RELOC_X86_64_PLT32)
*rel = BFD_RELOC_X86_64_PLT32_BND;
return tmpbuf;
}
 
7532,8 → 7610,7
static char *
lex_got (enum bfd_reloc_code_real *rel ATTRIBUTE_UNUSED,
int *adjust ATTRIBUTE_UNUSED,
i386_operand_type *types,
int bnd_prefix ATTRIBUTE_UNUSED)
i386_operand_type *types)
{
static const struct
{
7618,9 → 7695,11
 
#endif /* TE_PE */
 
void
bfd_reloc_code_real_type
x86_cons (expressionS *exp, int size)
{
bfd_reloc_code_real_type got_reloc = NO_RELOC;
 
intel_syntax = -intel_syntax;
 
exp->X_md = 0;
7632,7 → 7711,7
int adjust = 0;
 
save = input_line_pointer;
gotfree_input_line = lex_got (&got_reloc, &adjust, NULL, 0);
gotfree_input_line = lex_got (&got_reloc, &adjust, NULL);
if (gotfree_input_line)
input_line_pointer = gotfree_input_line;
 
7667,6 → 7746,8
 
if (intel_syntax)
i386_intel_simplify (exp);
 
return got_reloc;
}
 
static void
7727,6 → 7808,10
op_string += 3;
if (*op_string == '8')
bcst_type = BROADCAST_1TO8;
else if (*op_string == '4')
bcst_type = BROADCAST_1TO4;
else if (*op_string == '2')
bcst_type = BROADCAST_1TO2;
else if (*op_string == '1'
&& *(op_string+1) == '6')
{
7860,9 → 7945,7
save_input_line_pointer = input_line_pointer;
input_line_pointer = imm_start;
 
gotfree_input_line = lex_got (&i.reloc[this_operand], NULL, &types,
(i.bnd_prefix != NULL
|| add_bnd_prefix));
gotfree_input_line = lex_got (&i.reloc[this_operand], NULL, &types);
if (gotfree_input_line)
input_line_pointer = gotfree_input_line;
 
7928,7 → 8011,7
return 0;
}
#endif
else if (!intel_syntax && exp->X_op == O_register)
else if (!intel_syntax && exp_seg == reg_section)
{
if (imm_start)
as_bad (_("illegal immediate register operand %s"), imm_start);
8119,9 → 8202,7
*displacement_string_end = '0';
}
#endif
gotfree_input_line = lex_got (&i.reloc[this_operand], NULL, &types,
(i.bnd_prefix != NULL
|| add_bnd_prefix));
gotfree_input_line = lex_got (&i.reloc[this_operand], NULL, &types);
if (gotfree_input_line)
input_line_pointer = gotfree_input_line;
 
8589,6 → 8670,7
}
else if (is_digit_char (*op_string)
|| is_identifier_char (*op_string)
|| *op_string == '"'
|| *op_string == '(')
{
/* This is a memory reference of some sort. */
8803,6 → 8885,40
return TYPE_FROM_RELAX_STATE (frag->fr_subtype) == UNCOND_JUMP ? 4 : 5;
}
 
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
static int
elf_symbol_resolved_in_segment_p (symbolS *fr_symbol, offsetT fr_var)
{
/* STT_GNU_IFUNC symbol must go through PLT. */
if ((symbol_get_bfdsym (fr_symbol)->flags
& BSF_GNU_INDIRECT_FUNCTION) != 0)
return 0;
 
if (!S_IS_EXTERNAL (fr_symbol))
/* Symbol may be weak or local. */
return !S_IS_WEAK (fr_symbol);
 
/* Global symbols with non-default visibility can't be preempted. */
if (ELF_ST_VISIBILITY (S_GET_OTHER (fr_symbol)) != STV_DEFAULT)
return 1;
 
if (fr_var != NO_RELOC)
switch ((enum bfd_reloc_code_real) fr_var)
{
case BFD_RELOC_386_PLT32:
case BFD_RELOC_X86_64_PLT32:
/* Symbol with PLT relocatin may be preempted. */
return 0;
default:
abort ();
}
 
/* Global symbols with default visibility in a shared library may be
preempted by another definition. */
return !shared;
}
#endif
 
/* md_estimate_size_before_relax()
 
Called just before relax() for rs_machine_dependent frags. The x86
8826,10 → 8942,8
if (S_GET_SEGMENT (fragP->fr_symbol) != segment
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
|| (IS_ELF
&& (S_IS_EXTERNAL (fragP->fr_symbol)
|| S_IS_WEAK (fragP->fr_symbol)
|| ((symbol_get_bfdsym (fragP->fr_symbol)->flags
& BSF_GNU_INDIRECT_FUNCTION))))
&& !elf_symbol_resolved_in_segment_p (fragP->fr_symbol,
fragP->fr_var))
#endif
#if defined (OBJ_COFF) && defined (TE_PE)
|| (OUTPUT_FLAVOR == bfd_target_coff_flavour
9081,8 → 9195,7
&& (fixP->fx_r_type == BFD_RELOC_32_PCREL
|| fixP->fx_r_type == BFD_RELOC_64_PCREL
|| fixP->fx_r_type == BFD_RELOC_16_PCREL
|| fixP->fx_r_type == BFD_RELOC_8_PCREL
|| fixP->fx_r_type == BFD_RELOC_X86_64_PC32_BND)
|| fixP->fx_r_type == BFD_RELOC_8_PCREL)
&& !use_rela_relocations)
{
/* This is a hack. There should be a better way to handle this.
9124,8 → 9237,21
#endif
}
#if defined (OBJ_COFF) && defined (TE_PE)
if (fixP->fx_addsy != NULL && S_IS_WEAK (fixP->fx_addsy))
if (fixP->fx_addsy != NULL
&& S_IS_WEAK (fixP->fx_addsy)
/* PR 16858: Do not modify weak function references. */
&& ! fixP->fx_pcrel)
{
#if !defined (TE_PEP)
/* For x86 PE weak function symbols are neither PC-relative
nor do they set S_IS_FUNCTION. So the only reliable way
to detect them is to check the flags of their containing
section. */
if (S_GET_SEGMENT (fixP->fx_addsy) != NULL
&& S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_CODE)
;
else
#endif
value -= S_GET_VALUE (fixP->fx_addsy);
}
#endif
9138,7 → 9264,6
{
case BFD_RELOC_386_PLT32:
case BFD_RELOC_X86_64_PLT32:
case BFD_RELOC_X86_64_PLT32_BND:
/* Make the jump instruction point to the address of the operand. At
runtime we merely add the offset to the actual PLT entry. */
value = -4;
9380,7 → 9505,7
symbolS *symbolP;
 
input_line_pointer = reg_string;
c = get_symbol_end ();
c = get_symbol_name (&reg_string);
symbolP = symbol_find (reg_string);
if (symbolP && S_GET_SEGMENT (symbolP) == reg_section)
{
9390,6 → 9515,8
know (e->X_add_number >= 0
&& (valueT) e->X_add_number < i386_regtab_size);
r = i386_regtab + e->X_add_number;
if ((r->reg_flags & RegVRex))
i.need_vrex = 1;
*end_op = input_line_pointer;
}
*input_line_pointer = c;
9483,6 → 9610,12
#define OPTION_MADD_BND_PREFIX (OPTION_MD_BASE + 15)
#define OPTION_MEVEXLIG (OPTION_MD_BASE + 16)
#define OPTION_MEVEXWIG (OPTION_MD_BASE + 17)
#define OPTION_MBIG_OBJ (OPTION_MD_BASE + 18)
#define OPTION_OMIT_LOCK_PREFIX (OPTION_MD_BASE + 19)
#define OPTION_MEVEXRCIG (OPTION_MD_BASE + 20)
#define OPTION_MSHARED (OPTION_MD_BASE + 21)
#define OPTION_MAMD64 (OPTION_MD_BASE + 22)
#define OPTION_MINTEL64 (OPTION_MD_BASE + 23)
 
struct option md_longopts[] =
{
9493,6 → 9626,7
#endif
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
{"x32", no_argument, NULL, OPTION_X32},
{"mshared", no_argument, NULL, OPTION_MSHARED},
#endif
{"divide", no_argument, NULL, OPTION_DIVIDE},
{"march", required_argument, NULL, OPTION_MARCH},
9509,6 → 9643,13
{"madd-bnd-prefix", no_argument, NULL, OPTION_MADD_BND_PREFIX},
{"mevexlig", required_argument, NULL, OPTION_MEVEXLIG},
{"mevexwig", required_argument, NULL, OPTION_MEVEXWIG},
# if defined (TE_PE) || defined (TE_PEP)
{"mbig-obj", no_argument, NULL, OPTION_MBIG_OBJ},
#endif
{"momit-lock-prefix", required_argument, NULL, OPTION_OMIT_LOCK_PREFIX},
{"mevexrcig", required_argument, NULL, OPTION_MEVEXRCIG},
{"mamd64", no_argument, NULL, OPTION_MAMD64},
{"mintel64", no_argument, NULL, OPTION_MINTEL64},
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
9548,6 → 9689,10
/* -s: On i386 Solaris, this tells the native assembler to use
.stab instead of .stab.excl. We always use .stab anyhow. */
break;
 
case OPTION_MSHARED:
shared = 1;
break;
#endif
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \
|| defined (TE_PE) || defined (TE_PEP) || defined (OBJ_MACH_O))
9657,7 → 9802,10
else
flags = cpu_flags_and_not (cpu_arch_flags,
cpu_arch[j].flags);
if (!cpu_flags_equal (&flags, &cpu_arch_flags))
 
if (!valid_iamcu_cpu_flags (&flags))
as_fatal (_("`%s' isn't valid for Intel MCU"), arch);
else if (!cpu_flags_equal (&flags, &cpu_arch_flags))
{
if (cpu_sub_arch_name)
{
9781,6 → 9929,19
as_fatal (_("invalid -mevexlig= option: `%s'"), arg);
break;
 
case OPTION_MEVEXRCIG:
if (strcmp (arg, "rne") == 0)
evexrcig = rne;
else if (strcmp (arg, "rd") == 0)
evexrcig = rd;
else if (strcmp (arg, "ru") == 0)
evexrcig = ru;
else if (strcmp (arg, "rz") == 0)
evexrcig = rz;
else
as_fatal (_("invalid -mevexrcig= option: `%s'"), arg);
break;
 
case OPTION_MEVEXWIG:
if (strcmp (arg, "0") == 0)
evexwig = evexw0;
9790,6 → 9951,35
as_fatal (_("invalid -mevexwig= option: `%s'"), arg);
break;
 
# if defined (TE_PE) || defined (TE_PEP)
case OPTION_MBIG_OBJ:
use_big_obj = 1;
break;
#endif
 
case OPTION_OMIT_LOCK_PREFIX:
if (strcasecmp (arg, "yes") == 0)
omit_lock_prefix = 1;
else if (strcasecmp (arg, "no") == 0)
omit_lock_prefix = 0;
else
as_fatal (_("invalid -momit-lock-prefix= option: `%s'"), arg);
break;
 
case OPTION_MAMD64:
cpu_arch_flags.bitfield.cpuamd64 = 1;
cpu_arch_flags.bitfield.cpuintel64 = 0;
cpu_arch_isa_flags.bitfield.cpuamd64 = 1;
cpu_arch_isa_flags.bitfield.cpuintel64 = 0;
break;
 
case OPTION_MINTEL64:
cpu_arch_flags.bitfield.cpuamd64 = 0;
cpu_arch_flags.bitfield.cpuintel64 = 1;
cpu_arch_isa_flags.bitfield.cpuamd64 = 0;
cpu_arch_isa_flags.bitfield.cpuintel64 = 1;
break;
 
default:
return 0;
}
9931,6 → 10121,10
-mevexwig=[0|1] encode EVEX instructions with specific EVEX.W value\n\
for EVEX.W bit ignored instructions\n"));
fprintf (stream, _("\
-mevexrcig=[rne|rd|ru|rz]\n\
encode EVEX instructions with specific EVEX.RC value\n\
for SAE-only ignored instructions\n"));
fprintf (stream, _("\
-mmnemonic=[att|intel] use AT&T/Intel mnemonic\n"));
fprintf (stream, _("\
-msyntax=[att|intel] use AT&T/Intel syntax\n"));
9942,6 → 10136,19
-mold-gcc support old (<= 2.8.1) versions of gcc\n"));
fprintf (stream, _("\
-madd-bnd-prefix add BND prefix for all valid branches\n"));
fprintf (stream, _("\
-mshared disable branch optimization for shared code\n"));
# if defined (TE_PE) || defined (TE_PEP)
fprintf (stream, _("\
-mbig-obj generate big object files\n"));
#endif
fprintf (stream, _("\
-momit-lock-prefix=[no|yes]\n\
strip all lock prefixes\n"));
fprintf (stream, _("\
-mamd64 accept only AMD64 ISA\n"));
fprintf (stream, _("\
-mintel64 accept only Intel64 ISA\n"));
}
 
#if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
9963,7 → 10170,28
}
else if (!strcmp (default_arch, "i386"))
update_code_flag (CODE_32BIT, 1);
else if (!strcmp (default_arch, "iamcu"))
{
update_code_flag (CODE_32BIT, 1);
if (cpu_arch_isa == PROCESSOR_UNKNOWN)
{
static const i386_cpu_flags iamcu_flags = CPU_IAMCU_FLAGS;
cpu_arch_name = "iamcu";
cpu_sub_arch_name = NULL;
cpu_arch_flags = iamcu_flags;
cpu_arch_isa = PROCESSOR_IAMCU;
cpu_arch_isa_flags = iamcu_flags;
if (!cpu_arch_tune_set)
{
cpu_arch_tune = cpu_arch_isa;
cpu_arch_tune_flags = cpu_arch_isa_flags;
}
}
else
as_fatal (_("Intel MCU doesn't support `%s' architecture"),
cpu_arch_name);
}
else
as_fatal (_("unknown architecture"));
 
if (cpu_flags_all_zero (&cpu_arch_isa_flags))
9980,7 → 10208,10
#if defined (OBJ_MAYBE_COFF) || defined (OBJ_COFF)
# if defined (TE_PE) || defined (TE_PEP)
case bfd_target_coff_flavour:
return flag_code == CODE_64BIT ? "pe-x86-64" : "pe-i386";
if (flag_code == CODE_64BIT)
return use_big_obj ? "pe-bigobj-x86-64" : "pe-x86-64";
else
return "pe-i386";
# elif defined (TE_GO32)
case bfd_target_coff_flavour:
return "coff-go32";
10017,12 → 10248,18
as_fatal (_("Intel L1OM is 64bit only"));
return ELF_TARGET_L1OM_FORMAT;
}
if (cpu_arch_isa == PROCESSOR_K1OM)
else if (cpu_arch_isa == PROCESSOR_K1OM)
{
if (x86_elf_abi != X86_64_ABI)
as_fatal (_("Intel K1OM is 64bit only"));
return ELF_TARGET_K1OM_FORMAT;
}
else if (cpu_arch_isa == PROCESSOR_IAMCU)
{
if (x86_elf_abi != I386_ABI)
as_fatal (_("Intel MCU is 32bit only"));
return ELF_TARGET_IAMCU_FORMAT;
}
else
return format;
}
10046,48 → 10283,6
 
#endif /* OBJ_MAYBE_ more than one */
 
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF))
void
i386_elf_emit_arch_note (void)
{
if (IS_ELF && cpu_arch_name != NULL)
{
char *p;
asection *seg = now_seg;
subsegT subseg = now_subseg;
Elf_Internal_Note i_note;
Elf_External_Note e_note;
asection *note_secp;
int len;
 
/* Create the .note section. */
note_secp = subseg_new (".note", 0);
bfd_set_section_flags (stdoutput,
note_secp,
SEC_HAS_CONTENTS | SEC_READONLY);
 
/* Process the arch string. */
len = strlen (cpu_arch_name);
 
i_note.namesz = len + 1;
i_note.descsz = 0;
i_note.type = NT_ARCH;
p = frag_more (sizeof (e_note.namesz));
md_number_to_chars (p, (valueT) i_note.namesz, sizeof (e_note.namesz));
p = frag_more (sizeof (e_note.descsz));
md_number_to_chars (p, (valueT) i_note.descsz, sizeof (e_note.descsz));
p = frag_more (sizeof (e_note.type));
md_number_to_chars (p, (valueT) i_note.type, sizeof (e_note.type));
p = frag_more (len + 1);
strcpy (p, cpu_arch_name);
 
frag_align (2, 0, 0);
 
subseg_set (seg, subseg);
}
}
#endif
symbolS *
md_undefined_symbol (char *name)
{
10124,7 → 10319,7
int align;
 
align = bfd_get_section_alignment (stdoutput, segment);
size = ((size + (1 << align) - 1) & ((valueT) -1 << align));
size = ((size + (1 << align) - 1) & (-((valueT) 1 << align)));
}
#endif
 
10162,12 → 10357,21
void
i386_validate_fix (fixS *fixp)
{
if (fixp->fx_subsy && fixp->fx_subsy == GOT_symbol)
if (fixp->fx_subsy)
{
if (fixp->fx_subsy == GOT_symbol)
{
if (fixp->fx_r_type == BFD_RELOC_32_PCREL)
{
if (!object_64bit)
abort ();
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
if (fixp->fx_tcbit2)
fixp->fx_r_type = (fixp->fx_tcbit
? BFD_RELOC_X86_64_REX_GOTPCRELX
: BFD_RELOC_X86_64_GOTPCRELX);
else
#endif
fixp->fx_r_type = BFD_RELOC_X86_64_GOTPCREL;
}
else
10180,6 → 10384,15
fixp->fx_subsy = 0;
}
}
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
else if (!object_64bit)
{
if (fixp->fx_r_type == BFD_RELOC_386_GOT32
&& fixp->fx_tcbit2)
fixp->fx_r_type = BFD_RELOC_386_GOT32X;
}
#endif
}
 
arelent *
tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
10210,11 → 10423,13
#endif
 
case BFD_RELOC_X86_64_PLT32:
case BFD_RELOC_X86_64_PLT32_BND:
case BFD_RELOC_X86_64_GOT32:
case BFD_RELOC_X86_64_GOTPCREL:
case BFD_RELOC_X86_64_GOTPCRELX:
case BFD_RELOC_X86_64_REX_GOTPCRELX:
case BFD_RELOC_386_PLT32:
case BFD_RELOC_386_GOT32:
case BFD_RELOC_386_GOT32X:
case BFD_RELOC_386_GOTOFF:
case BFD_RELOC_386_GOTPC:
case BFD_RELOC_386_TLS_GD:
10271,10 → 10486,7
break;
case 1: code = BFD_RELOC_8_PCREL; break;
case 2: code = BFD_RELOC_16_PCREL; break;
case 4:
code = (fixp->fx_r_type == BFD_RELOC_X86_64_PC32_BND
? fixp-> fx_r_type : BFD_RELOC_32_PCREL);
break;
case 4: code = BFD_RELOC_32_PCREL; break;
#ifdef BFD64
case 8: code = BFD_RELOC_64_PCREL; break;
#endif
10367,9 → 10579,10
switch (code)
{
case BFD_RELOC_X86_64_PLT32:
case BFD_RELOC_X86_64_PLT32_BND:
case BFD_RELOC_X86_64_GOT32:
case BFD_RELOC_X86_64_GOTPCREL:
case BFD_RELOC_X86_64_GOTPCRELX:
case BFD_RELOC_X86_64_REX_GOTPCRELX:
case BFD_RELOC_X86_64_TLSGD:
case BFD_RELOC_X86_64_TLSLD:
case BFD_RELOC_X86_64_GOTTPOFF:
/contrib/toolchain/binutils/gas/config/tc-i386.h
1,7 → 1,5
/* tc-i386.h -- Header file for tc-i386.c
Copyright 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Copyright (C) 1989-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
92,6 → 90,10
#define ELF_TARGET_K1OM_FORMAT "elf64-k1om"
#endif
 
#ifndef ELF_TARGET_IAMCU_FORMAT
#define ELF_TARGET_IAMCU_FORMAT "elf32-iamcu"
#endif
 
#if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
|| defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \
|| defined (TE_PE) || defined (TE_PEP) || defined (OBJ_MACH_O))
106,11 → 108,6
#endif
#endif
 
#if (defined (OBJ_MAYBE_ELF) || defined (OBJ_ELF))
#define md_end i386_elf_emit_arch_note
extern void i386_elf_emit_arch_note (void);
#endif
 
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
 
/* '$' may be used as immediate prefix. */
134,11 → 131,12
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && !defined (LEX_AT)
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) x86_cons (EXP, NBYTES)
#endif
extern void x86_cons (expressionS *, int);
extern bfd_reloc_code_real_type x86_cons (expressionS *, int);
 
#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) x86_cons_fix_new(FRAG, OFF, LEN, EXP)
#define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP, RELOC) \
x86_cons_fix_new(FRAG, OFF, LEN, EXP, RELOC)
extern void x86_cons_fix_new
(fragS *, unsigned int, unsigned int, expressionS *);
(fragS *, unsigned int, unsigned int, expressionS *, bfd_reloc_code_real_type);
 
#define TC_ADDRESS_BYTES x86_address_bytes
extern int x86_address_bytes (void);
176,7 → 174,8
(!(FIX)->fx_pcrel \
|| (FIX)->fx_r_type == BFD_RELOC_386_PLT32 \
|| (FIX)->fx_r_type == BFD_RELOC_386_GOTPC \
|| (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCREL \
|| (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCRELX \
|| (FIX)->fx_r_type == BFD_RELOC_X86_64_REX_GOTPCRELX \
|| TC_FORCE_RELOCATION (FIX))
 
extern int i386_parse_name (char *, expressionS *, char *);
239,6 → 238,7
PROCESSOR_COREI7,
PROCESSOR_L1OM,
PROCESSOR_K1OM,
PROCESSOR_IAMCU,
PROCESSOR_K6,
PROCESSOR_ATHLON,
PROCESSOR_K8,
246,6 → 246,7
PROCESSOR_GENERIC64,
PROCESSOR_AMDFAM10,
PROCESSOR_BD,
PROCESSOR_ZNVER,
PROCESSOR_BT
};
 
/contrib/toolchain/binutils/gas/config/te-pe.h
1,4 → 1,4
/* Copyright 2007 Free Software Foundation, Inc.
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/config.h
1,5 → 1,5
/* config.h. Generated from config.in by configure. */
/* config.in. Generated from configure.in by autoheader. */
/* config.in. Generated from configure.ac by autoheader. */
 
/* Check that config.h is #included before system headers
(this works only for glibc, but that should be enough). */
37,6 → 37,9
/* Default emulation. */
#define DEFAULT_EMULATION ""
 
/* Define if you want compressed debug sections by default. */
/* #undef DEFAULT_FLAG_COMPRESS_DEBUG */
 
/* Supported emulations. */
#define EMULATIONS
 
52,8 → 55,17
 
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
/* #undef HAVE_ALLOCA_H */
#define HAVE_ALLOCA_H 1
 
/* Define to 1 if you have the `basename' function. */
#define HAVE_BASENAME 1
 
#define HAVE_DECL_BASENAME 1
 
/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
don't. */
#define HAVE_DECL_ASPRINTF 1
 
/* Define to 1 if you have the declaration of `free', and to 0 if you don't.
*/
#define HAVE_DECL_FREE 1
180,6 → 192,24
/* Choose a default ABI for MIPS targets. */
/* #undef MIPS_DEFAULT_ABI */
 
/* Define value for nds32_arch_name */
/* #undef NDS32_DEFAULT_ARCH_NAME */
 
/* Define default value for nds32_audio_ext */
/* #undef NDS32_DEFAULT_AUDIO_EXT */
 
/* Define default value for nds32_dx_regs */
/* #undef NDS32_DEFAULT_DX_REGS */
 
/* Define default value for nds32_perf_ext */
/* #undef NDS32_DEFAULT_PERF_EXT */
 
/* Define default value for nds32_perf_ext2 */
/* #undef NDS32_DEFAULT_PERF_EXT2 */
 
/* Define default value for nds32_string_ext */
/* #undef NDS32_DEFAULT_STRING_EXT */
 
/* Define if environ is not declared in system header files. */
/* #undef NEED_DECLARATION_ENVIRON */
 
229,19 → 259,19
#define PACKAGE_BUGREPORT ""
 
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
#define PACKAGE_NAME "gas"
 
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
#define PACKAGE_STRING "gas 2.26"
 
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
#define PACKAGE_TARNAME "gas"
 
/* Define to the home page for this package. */
#define PACKAGE_URL ""
 
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
#define PACKAGE_VERSION "2.26"
 
/* Define if defaulting to ELF on SCO 5. */
/* #undef SCO_ELF */
322,7 → 352,7
/* #undef USING_CGEN */
 
/* Version number of package */
#define VERSION "2.24"
#define VERSION "2.26"
 
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
/contrib/toolchain/binutils/gas/depend.c
1,6 → 1,5
/* depend.c - Handle dependency tracking.
Copyright 1997, 1998, 2000, 2001, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Copyright (C) 1997-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/dw2gencfi.c
1,6 → 1,5
/* dw2gencfi.c - Support for generating Dwarf2 CFI information.
Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Copyright (C) 2003-2015 Free Software Foundation, Inc.
Contributed by Michal Ludvig <mludvig@suse.cz>
 
This file is part of GAS, the GNU Assembler.
76,6 → 75,8
# define tc_cfi_endproc(fde) ((void) (fde))
#endif
 
#define EH_FRAME_LINKONCE (SUPPORT_FRAME_LINKONCE || compact_eh)
 
#ifndef DWARF2_FORMAT
#define DWARF2_FORMAT(SEC) dwarf2_format_32bit
#endif
84,7 → 85,7
#define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8)
#endif
 
#if SUPPORT_FRAME_LINKONCE
#if MULTIPLE_FRAME_SECTIONS
#define CUR_SEG(structp) structp->cur_seg
#define SET_CUR_SEG(structp, seg) structp->cur_seg = seg
#define HANDLED(structp) structp->handled
96,6 → 97,10
#define SET_HANDLED(structp, val) (void) (0 && val)
#endif
 
#ifndef tc_cfi_reloc_for_encoding
#define tc_cfi_reloc_for_encoding(e) BFD_RELOC_NONE
#endif
 
/* Private segment collection list. */
struct dwcfi_seg_list
{
104,10 → 109,115
char * seg_name;
};
 
#define FRAME_NAME ".eh_frame"
#ifdef SUPPORT_COMPACT_EH
static bfd_boolean compact_eh;
#else
#define compact_eh 0
#endif
 
static struct hash_control *dwcfi_hash;
 
/* Emit a single byte into the current segment. */
 
static inline void
out_one (int byte)
{
FRAG_APPEND_1_CHAR (byte);
}
 
/* Emit a two-byte word into the current segment. */
 
static inline void
out_two (int data)
{
md_number_to_chars (frag_more (2), data, 2);
}
 
/* Emit a four byte word into the current segment. */
 
static inline void
out_four (int data)
{
md_number_to_chars (frag_more (4), data, 4);
}
 
/* Emit an unsigned "little-endian base 128" number. */
 
static void
out_uleb128 (addressT value)
{
output_leb128 (frag_more (sizeof_leb128 (value, 0)), value, 0);
}
 
/* Emit an unsigned "little-endian base 128" number. */
 
static void
out_sleb128 (offsetT value)
{
output_leb128 (frag_more (sizeof_leb128 (value, 1)), value, 1);
}
 
static offsetT
encoding_size (unsigned char encoding)
{
if (encoding == DW_EH_PE_omit)
return 0;
switch (encoding & 0x7)
{
case 0:
return bfd_get_arch_size (stdoutput) == 64 ? 8 : 4;
case DW_EH_PE_udata2:
return 2;
case DW_EH_PE_udata4:
return 4;
case DW_EH_PE_udata8:
return 8;
default:
abort ();
}
}
 
/* Emit expression EXP in ENCODING. If EMIT_ENCODING is true, first
emit a byte containing ENCODING. */
 
static void
emit_expr_encoded (expressionS *exp, int encoding, bfd_boolean emit_encoding)
{
offsetT size = encoding_size (encoding);
bfd_reloc_code_real_type code;
 
if (encoding == DW_EH_PE_omit)
return;
 
if (emit_encoding)
out_one (encoding);
 
code = tc_cfi_reloc_for_encoding (encoding);
if (code != BFD_RELOC_NONE)
{
reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, code);
char *p = frag_more (size);
md_number_to_chars (p, 0, size);
fix_new (frag_now, p - frag_now->fr_literal, size, exp->X_add_symbol,
exp->X_add_number, howto->pc_relative, code);
}
else if ((encoding & 0x70) == DW_EH_PE_pcrel)
{
#if CFI_DIFF_EXPR_OK
expressionS tmp = *exp;
tmp.X_op = O_subtract;
tmp.X_op_symbol = symbol_temp_new_now ();
emit_expr (&tmp, size);
#elif defined (tc_cfi_emit_pcrel_expr)
tc_cfi_emit_pcrel_expr (exp, size);
#else
abort ();
#endif
}
else
emit_expr (exp, size);
}
/* Build based on segment the derived .debug_...
segment name containing origin segment's postfix name part. */
 
129,7 → 239,13
dot = strchr (name + 1, '.');
 
if (!dollar && !dot)
{
if (!strcmp (base_name, ".eh_frame_entry")
&& strcmp (name, ".text") != 0)
return concat (base_name, ".", name, NULL);
 
name = "";
}
else if (!dollar)
name = dot;
else if (!dot)
161,6 → 277,9
static segT
is_now_linkonce_segment (void)
{
if (compact_eh)
return now_seg;
 
if ((bfd_get_section_flags (stdoutput, now_seg)
& (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
| SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE
273,12 → 392,13
struct cie_entry
{
struct cie_entry *next;
#if SUPPORT_FRAME_LINKONCE
#if MULTIPLE_FRAME_SECTIONS
segT cur_seg;
#endif
symbolS *start_address;
unsigned int return_column;
unsigned int signal_frame;
unsigned char fde_encoding;
unsigned char per_encoding;
unsigned char lsda_encoding;
expressionS personality;
328,6 → 448,7
fde->return_column = DWARF2_DEFAULT_RETURN_COLUMN;
fde->per_encoding = DW_EH_PE_omit;
fde->lsda_encoding = DW_EH_PE_omit;
fde->eh_header_type = EH_COMPACT_UNKNOWN;
 
return fde;
}
338,6 → 459,11
/* Construct a new INSN structure and add it to the end of the insn list
for the currently active FDE. */
 
static bfd_boolean cfi_sections_set = FALSE;
static int cfi_sections = CFI_EMIT_eh_frame;
int all_cfi_sections = 0;
static struct fde_entry *last_fde;
 
static struct cfi_insn_data *
alloc_cfi_insn_data (void)
{
379,6 → 505,12
frchain_now->frch_cfi_data->cur_fde_data->return_column = regno;
}
 
void
cfi_set_sections (void)
{
frchain_now->frch_cfi_data->cur_fde_data->sections = all_cfi_sections;
}
 
/* Universal functions to store new instructions. */
 
static void
441,6 → 573,19
frchain_now->frch_cfi_data->last_address = label;
}
 
/* Add a CFI insn to label the current position in the CFI segment. */
 
void
cfi_add_label (const char *name)
{
unsigned int len = strlen (name) + 1;
struct cfi_insn_data *insn = alloc_cfi_insn_data ();
 
insn->insn = CFI_label;
obstack_grow (&notes, name, len);
insn->u.sym_name = (char *) obstack_finish (&notes);
}
 
/* Add a DW_CFA_offset record to the CFI data. */
 
void
548,9 → 693,13
static void dot_cfi_sections (int);
static void dot_cfi_startproc (int);
static void dot_cfi_endproc (int);
static void dot_cfi_fde_data (int);
static void dot_cfi_personality (int);
static void dot_cfi_personality_id (int);
static void dot_cfi_lsda (int);
static void dot_cfi_val_encoded_addr (int);
static void dot_cfi_inline_lsda (int);
static void dot_cfi_label (int);
 
const pseudo_typeS cfi_pseudo_table[] =
{
557,6 → 706,7
{ "cfi_sections", dot_cfi_sections, 0 },
{ "cfi_startproc", dot_cfi_startproc, 0 },
{ "cfi_endproc", dot_cfi_endproc, 0 },
{ "cfi_fde_data", dot_cfi_fde_data, 0 },
{ "cfi_def_cfa", dot_cfi, DW_CFA_def_cfa },
{ "cfi_def_cfa_register", dot_cfi, DW_CFA_def_cfa_register },
{ "cfi_def_cfa_offset", dot_cfi, DW_CFA_def_cfa_offset },
574,8 → 724,11
{ "cfi_escape", dot_cfi_escape, 0 },
{ "cfi_signal_frame", dot_cfi, CFI_signal_frame },
{ "cfi_personality", dot_cfi_personality, 0 },
{ "cfi_personality_id", dot_cfi_personality_id, 0 },
{ "cfi_lsda", dot_cfi_lsda, 0 },
{ "cfi_val_encoded_addr", dot_cfi_val_encoded_addr, 0 },
{ "cfi_inline_lsda", dot_cfi_inline_lsda, 0 },
{ "cfi_label", dot_cfi_label, 0 },
{ NULL, NULL, 0 }
};
 
601,13 → 754,12
{
char *name, c;
 
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& name);
 
exp->X_op = O_constant;
exp->X_add_number = tc_regname_to_dw2regnum (name);
 
*input_line_pointer = c;
restore_line_pointer (c);
}
else
# endif
833,7 → 985,7
}
 
if ((encoding & 0xff) != encoding
|| ((encoding & 0x70) != 0
|| ((((encoding & 0x70) != 0
#if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
&& (encoding & 0x70) != DW_EH_PE_pcrel
#endif
841,6 → 993,7
/* leb128 can be handled, but does something actually need it? */
|| (encoding & 7) == DW_EH_PE_uleb128
|| (encoding & 7) > DW_EH_PE_udata8)
&& tc_cfi_reloc_for_encoding (encoding) == BFD_RELOC_NONE))
{
as_bad (_("invalid or unsupported encoding in .cfi_personality"));
ignore_rest_of_line ();
903,7 → 1056,7
}
 
if ((encoding & 0xff) != encoding
|| ((encoding & 0x70) != 0
|| ((((encoding & 0x70) != 0
#if CFI_DIFF_LSDA_OK || defined tc_cfi_emit_pcrel_expr
&& (encoding & 0x70) != DW_EH_PE_pcrel
#endif
911,6 → 1064,7
/* leb128 can be handled, but does something actually need it? */
|| (encoding & 7) == DW_EH_PE_uleb128
|| (encoding & 7) > DW_EH_PE_udata8)
&& tc_cfi_reloc_for_encoding (encoding) == BFD_RELOC_NONE))
{
as_bad (_("invalid or unsupported encoding in .cfi_lsda"));
ignore_rest_of_line ();
1017,12 → 1171,25
demand_empty_rest_of_line ();
}
 
/* By default emit .eh_frame only, not .debug_frame. */
#define CFI_EMIT_eh_frame (1 << 0)
#define CFI_EMIT_debug_frame (1 << 1)
#define CFI_EMIT_target (1 << 2)
static int cfi_sections = CFI_EMIT_eh_frame;
static void
dot_cfi_label (int ignored ATTRIBUTE_UNUSED)
{
char *name = read_symbol_name ();
 
if (name == NULL)
return;
 
/* If the last address was not at the current PC, advance to current. */
if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
|| S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
!= frag_now_fix ())
cfi_add_advance_loc (symbol_temp_new_now ());
 
cfi_add_label (name);
 
demand_empty_rest_of_line ();
}
 
static void
dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
{
1029,13 → 1196,14
int sections = 0;
 
SKIP_WHITESPACE ();
if (is_name_beginner (*input_line_pointer))
if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
while (1)
{
char * saved_ilp;
char *name, c;
 
name = input_line_pointer;
c = get_symbol_end ();
saved_ilp = input_line_pointer;
c = get_symbol_name (& name);
 
if (strncmp (name, ".eh_frame", sizeof ".eh_frame") == 0
&& name[9] != '_')
1042,6 → 1210,13
sections |= CFI_EMIT_eh_frame;
else if (strncmp (name, ".debug_frame", sizeof ".debug_frame") == 0)
sections |= CFI_EMIT_debug_frame;
#if SUPPORT_COMPACT_EH
else if (strncmp (name, ".eh_frame_entry", sizeof ".eh_frame_entry") == 0)
{
compact_eh = TRUE;
sections |= CFI_EMIT_eh_frame_compact;
}
#endif
#ifdef tc_cfi_section_name
else if (strcmp (name, tc_cfi_section_name) == 0)
sections |= CFI_EMIT_target;
1049,27 → 1224,30
else
{
*input_line_pointer = c;
input_line_pointer = name;
input_line_pointer = saved_ilp;
break;
}
 
*input_line_pointer = c;
SKIP_WHITESPACE ();
SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer == ',')
{
name = input_line_pointer++;
SKIP_WHITESPACE ();
if (!is_name_beginner (*input_line_pointer))
if (!is_name_beginner (*input_line_pointer) && *input_line_pointer != '"')
{
input_line_pointer = name;
break;
}
}
else if (is_name_beginner (*input_line_pointer))
else if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
break;
}
 
demand_empty_rest_of_line ();
if (cfi_sections_set && cfi_sections != sections)
as_bad (_("inconsistent uses of .cfi_sections"));
cfi_sections_set = TRUE;
cfi_sections = sections;
}
 
1088,23 → 1266,25
cfi_new_fde (symbol_temp_new_now ());
 
SKIP_WHITESPACE ();
if (is_name_beginner (*input_line_pointer))
if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
{
char * saved_ilp = input_line_pointer;
char *name, c;
 
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& name);
 
if (strcmp (name, "simple") == 0)
{
simple = 1;
*input_line_pointer = c;
restore_line_pointer (c);
}
else
input_line_pointer = name;
input_line_pointer = saved_ilp;
}
demand_empty_rest_of_line ();
 
all_cfi_sections |= cfi_sections;
cfi_set_sections ();
frchain_now->frch_cfi_data->cur_cfa_offset = 0;
if (!simple)
tc_cfi_frame_initial_instructions ();
1116,8 → 1296,6
static void
dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED)
{
struct fde_entry *fde;
 
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_(".cfi_endproc without corresponding .cfi_startproc"));
1125,7 → 1303,7
return;
}
 
fde = frchain_now->frch_cfi_data->cur_fde_data;
last_fde = frchain_now->frch_cfi_data->cur_fde_data;
 
cfi_end_fde (symbol_temp_new_now ());
 
1132,51 → 1310,246
demand_empty_rest_of_line ();
 
if ((cfi_sections & CFI_EMIT_target) != 0)
tc_cfi_endproc (fde);
tc_cfi_endproc (last_fde);
}
 
static segT
get_cfi_seg (segT cseg, const char *base, flagword flags, int align)
{
/* Exclude .debug_frame sections for Compact EH. */
if (SUPPORT_FRAME_LINKONCE || ((flags & SEC_DEBUGGING) == 0 && compact_eh))
{
struct dwcfi_seg_list *l;
/* Emit a single byte into the current segment. */
l = dwcfi_hash_find_or_make (cseg, base, flags);
 
static inline void
out_one (int byte)
cseg = l->seg;
subseg_set (cseg, l->subseg);
}
else
{
FRAG_APPEND_1_CHAR (byte);
cseg = subseg_new (base, 0);
bfd_set_section_flags (stdoutput, cseg, flags);
}
record_alignment (cseg, align);
return cseg;
}
 
/* Emit a two-byte word into the current segment. */
#if SUPPORT_COMPACT_EH
static void
dot_cfi_personality_id (int ignored ATTRIBUTE_UNUSED)
{
struct fde_entry *fde;
 
static inline void
out_two (int data)
if (frchain_now->frch_cfi_data == NULL)
{
md_number_to_chars (frag_more (2), data, 2);
as_bad (_("CFI instruction used without previous .cfi_startproc"));
ignore_rest_of_line ();
return;
}
 
/* Emit a four byte word into the current segment. */
fde = frchain_now->frch_cfi_data->cur_fde_data;
fde->personality_id = cfi_parse_const ();
demand_empty_rest_of_line ();
 
static inline void
out_four (int data)
if (fde->personality_id == 0 || fde->personality_id > 3)
{
md_number_to_chars (frag_more (4), data, 4);
as_bad (_("wrong argument to .cfi_personality_id"));
return;
}
}
 
/* Emit an unsigned "little-endian base 128" number. */
static void
dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED)
{
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_(".cfi_fde_data without corresponding .cfi_startproc"));
ignore_rest_of_line ();
return;
}
 
last_fde = frchain_now->frch_cfi_data->cur_fde_data;
 
if ((cfi_sections & CFI_EMIT_target) != 0
|| (cfi_sections & CFI_EMIT_eh_frame_compact) != 0)
{
struct cfi_escape_data *head, **tail, *e;
int num_ops = 0;
 
tail = &head;
if (!is_it_end_of_statement ())
{
num_ops = 0;
do
{
e = (struct cfi_escape_data *) xmalloc (sizeof (*e));
do_parse_cons_expression (&e->exp, 1);
*tail = e;
tail = &e->next;
num_ops++;
}
while (*input_line_pointer++ == ',');
--input_line_pointer;
}
*tail = NULL;
 
if (last_fde->lsda_encoding != DW_EH_PE_omit)
last_fde->eh_header_type = EH_COMPACT_HAS_LSDA;
else if (num_ops <= 3 && last_fde->per_encoding == DW_EH_PE_omit)
last_fde->eh_header_type = EH_COMPACT_INLINE;
else
last_fde->eh_header_type = EH_COMPACT_OUTLINE;
 
if (last_fde->eh_header_type == EH_COMPACT_INLINE)
num_ops = 3;
 
last_fde->eh_data_size = num_ops;
last_fde->eh_data = (bfd_byte *) xmalloc (num_ops);
num_ops = 0;
while (head)
{
e = head;
head = e->next;
last_fde->eh_data[num_ops++] = e->exp.X_add_number;
free (e);
}
if (last_fde->eh_header_type == EH_COMPACT_INLINE)
while (num_ops < 3)
last_fde->eh_data[num_ops++] = tc_compact_eh_opcode_stop;
}
 
demand_empty_rest_of_line ();
}
 
/* Function to emit the compact unwinding opcodes stored in the
fde's eh_data field. The end of the opcode data will be
padded to the value in align. */
 
static void
out_uleb128 (addressT value)
output_compact_unwind_data (struct fde_entry *fde, int align)
{
output_leb128 (frag_more (sizeof_leb128 (value, 0)), value, 0);
int data_size = fde->eh_data_size + 2;
int align_padding;
int amask;
char *p;
 
fde->eh_loc = symbol_temp_new_now ();
 
p = frag_more (1);
if (fde->personality_id != 0)
*p = fde->personality_id;
else if (fde->per_encoding != DW_EH_PE_omit)
{
*p = 0;
emit_expr_encoded (&fde->personality, fde->per_encoding, FALSE);
data_size += encoding_size (fde->per_encoding);
}
else
*p = 1;
 
/* Emit an unsigned "little-endian base 128" number. */
amask = (1 << align) - 1;
align_padding = ((data_size + amask) & ~amask) - data_size;
 
p = frag_more (fde->eh_data_size + 1 + align_padding);
memcpy (p, fde->eh_data, fde->eh_data_size);
p += fde->eh_data_size;
 
while (align_padding-- > 0)
*(p++) = tc_compact_eh_opcode_pad;
 
*(p++) = tc_compact_eh_opcode_stop;
fde->eh_header_type = EH_COMPACT_OUTLINE_DONE;
}
 
/* Handle the .cfi_inline_lsda directive. */
static void
out_sleb128 (offsetT value)
dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED)
{
output_leb128 (frag_more (sizeof_leb128 (value, 1)), value, 1);
segT ccseg;
int align;
long max_alignment = 28;
 
if (!last_fde)
{
as_bad (_("unexpected .cfi_inline_lsda"));
ignore_rest_of_line ();
return;
}
 
if ((last_fde->sections & CFI_EMIT_eh_frame_compact) == 0)
{
as_bad (_(".cfi_inline_lsda not valid for this frame"));
ignore_rest_of_line ();
return;
}
 
if (last_fde->eh_header_type != EH_COMPACT_UNKNOWN
&& last_fde->eh_header_type != EH_COMPACT_HAS_LSDA)
{
as_bad (_(".cfi_inline_lsda seen for frame without .cfi_lsda"));
ignore_rest_of_line ();
return;
}
 
#ifdef md_flush_pending_output
md_flush_pending_output ();
#endif
 
align = get_absolute_expression ();
if (align > max_alignment)
{
align = max_alignment;
as_bad (_("Alignment too large: %d. assumed."), align);
}
else if (align < 0)
{
as_warn (_("Alignment negative: 0 assumed."));
align = 0;
}
 
demand_empty_rest_of_line ();
ccseg = CUR_SEG (last_fde);
 
/* Open .gnu_extab section. */
get_cfi_seg (ccseg, ".gnu_extab",
(SEC_ALLOC | SEC_LOAD | SEC_DATA
| DWARF2_EH_FRAME_READ_ONLY),
1);
 
frag_align (align, 0, 0);
record_alignment (now_seg, align);
if (last_fde->eh_header_type == EH_COMPACT_HAS_LSDA)
output_compact_unwind_data (last_fde, align);
 
last_fde = NULL;
 
return;
}
#else /* !SUPPORT_COMPACT_EH */
static void
dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED)
{
as_bad (_(".cfi_inline_lsda is not supported for this target"));
ignore_rest_of_line ();
}
 
static void
dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED)
{
as_bad (_(".cfi_fde_data is not supported for this target"));
ignore_rest_of_line ();
}
 
static void
dot_cfi_personality_id (int ignored ATTRIBUTE_UNUSED)
{
as_bad (_(".cfi_personality_id is not supported for this target"));
ignore_rest_of_line ();
}
#endif
static void
output_cfi_insn (struct cfi_insn_data *insn)
{
offsetT offset;
1332,7 → 1705,7
case CFI_val_encoded_addr:
{
unsigned encoding = insn->u.ea.encoding;
offsetT encoding_size;
offsetT enc_size;
 
if (encoding == DW_EH_PE_omit)
break;
1342,16 → 1715,16
switch (encoding & 0x7)
{
case DW_EH_PE_absptr:
encoding_size = DWARF2_ADDR_SIZE (stdoutput);
enc_size = DWARF2_ADDR_SIZE (stdoutput);
break;
case DW_EH_PE_udata2:
encoding_size = 2;
enc_size = 2;
break;
case DW_EH_PE_udata4:
encoding_size = 4;
enc_size = 4;
break;
case DW_EH_PE_udata8:
encoding_size = 8;
enc_size = 8;
break;
default:
abort ();
1361,12 → 1734,12
then use the smaller DW_OP_addr encoding. */
if (insn->u.ea.encoding == DW_EH_PE_absptr)
{
out_uleb128 (1 + encoding_size);
out_uleb128 (1 + enc_size);
out_one (DW_OP_addr);
}
else
{
out_uleb128 (1 + 1 + encoding_size);
out_uleb128 (1 + 1 + enc_size);
out_one (DW_OP_GNU_encoded_addr);
out_one (encoding);
 
1376,7 → 1749,7
insn->u.ea.exp.X_op = O_subtract;
insn->u.ea.exp.X_op_symbol = symbol_temp_new_now ();
#elif defined (tc_cfi_emit_pcrel_expr)
tc_cfi_emit_pcrel_expr (&insn->u.ea.exp, encoding_size);
tc_cfi_emit_pcrel_expr (&insn->u.ea.exp, enc_size);
break;
#else
abort ();
1383,30 → 1756,14
#endif
}
}
emit_expr (&insn->u.ea.exp, encoding_size);
emit_expr (&insn->u.ea.exp, enc_size);
}
break;
 
default:
abort ();
}
}
case CFI_label:
colon (insn->u.sym_name);
break;
 
static offsetT
encoding_size (unsigned char encoding)
{
if (encoding == DW_EH_PE_omit)
return 0;
switch (encoding & 0x7)
{
case 0:
return bfd_get_arch_size (stdoutput) == 64 ? 8 : 4;
case DW_EH_PE_udata2:
return 2;
case DW_EH_PE_udata4:
return 4;
case DW_EH_PE_udata8:
return 8;
default:
abort ();
}
1474,26 → 1831,7
augmentation_size += 1 + encoding_size (cie->per_encoding);
out_uleb128 (augmentation_size); /* Augmentation size. */
 
if (cie->per_encoding != DW_EH_PE_omit)
{
offsetT size = encoding_size (cie->per_encoding);
out_one (cie->per_encoding);
exp = cie->personality;
if ((cie->per_encoding & 0x70) == DW_EH_PE_pcrel)
{
#if CFI_DIFF_EXPR_OK
exp.X_op = O_subtract;
exp.X_op_symbol = symbol_temp_new_now ();
emit_expr (&exp, size);
#elif defined (tc_cfi_emit_pcrel_expr)
tc_cfi_emit_pcrel_expr (&exp, size);
#else
abort ();
#endif
}
else
emit_expr (&exp, size);
}
emit_expr_encoded (&cie->personality, cie->per_encoding, TRUE);
 
if (cie->lsda_encoding != DW_EH_PE_omit)
out_one (cie->lsda_encoding);
1516,6 → 1854,11
#if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
enc |= DW_EH_PE_pcrel;
#endif
#ifdef DWARF2_FDE_RELOC_ENCODING
/* Allow target to override encoding. */
enc = DWARF2_FDE_RELOC_ENCODING (enc);
#endif
cie->fde_encoding = enc;
if (eh_frame)
out_one (enc);
 
1576,8 → 1919,21
TC_DWARF2_EMIT_OFFSET (cie->start_address, offset_size);
}
 
exp.X_op = O_symbol;
if (eh_frame)
{
bfd_reloc_code_real_type code
= tc_cfi_reloc_for_encoding (cie->fde_encoding);
if (code != BFD_RELOC_NONE)
{
reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, code);
char *p = frag_more (4);
md_number_to_chars (p, 0, 4);
fix_new (frag_now, p - frag_now->fr_literal, 4, fde->start_address,
0, howto->pc_relative, code);
}
else
{
exp.X_op = O_subtract;
exp.X_add_number = 0;
#if CFI_DIFF_EXPR_OK
1587,19 → 1943,20
#else
exp.X_op = O_symbol;
exp.X_add_symbol = fde->start_address;
#ifdef tc_cfi_emit_pcrel_expr
 
#if defined(tc_cfi_emit_pcrel_expr)
tc_cfi_emit_pcrel_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */
#else
emit_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */
#endif
#endif
}
addr_size = DWARF2_FDE_RELOC_SIZE;
}
else
{
exp.X_op = O_symbol;
exp.X_add_number = 0;
exp.X_add_symbol = fde->start_address;
exp.X_add_number = 0;
addr_size = DWARF2_ADDR_SIZE (stdoutput);
emit_expr (&exp, addr_size);
}
1614,24 → 1971,7
if (eh_frame)
out_uleb128 (augmentation_size); /* Augmentation size. */
 
if (fde->lsda_encoding != DW_EH_PE_omit)
{
exp = fde->lsda;
if ((fde->lsda_encoding & 0x70) == DW_EH_PE_pcrel)
{
#if CFI_DIFF_LSDA_OK
exp.X_op = O_subtract;
exp.X_op_symbol = symbol_temp_new_now ();
emit_expr (&exp, augmentation_size);
#elif defined (tc_cfi_emit_pcrel_expr)
tc_cfi_emit_pcrel_expr (&exp, augmentation_size);
#else
abort ();
#endif
}
else
emit_expr (&exp, augmentation_size);
}
emit_expr_encoded (&fde->lsda, cie->lsda_encoding, FALSE);
 
for (; first; first = first->next)
if (CUR_SEG (first) == CUR_SEG (fde))
1722,6 → 2062,7
 
case CFI_escape:
case CFI_val_encoded_addr:
case CFI_label:
/* Don't bother matching these for now. */
goto fail;
 
1738,7 → 2079,8
|| j->insn == DW_CFA_advance_loc
|| j->insn == DW_CFA_remember_state
|| j->insn == CFI_escape
|| j->insn == CFI_val_encoded_addr))
|| j->insn == CFI_val_encoded_addr
|| j->insn == CFI_label))
{
*pfirst = j;
return cie;
1762,7 → 2104,8
if (i->insn == DW_CFA_advance_loc
|| i->insn == DW_CFA_remember_state
|| i->insn == CFI_escape
|| i->insn == CFI_val_encoded_addr)
|| i->insn == CFI_val_encoded_addr
|| i->insn == CFI_label)
break;
 
cie->last = i;
1789,6 → 2132,7
case DW_CFA_restore_state:
case DW_CFA_GNU_window_save:
case CFI_escape:
case CFI_label:
break;
 
case DW_CFA_def_cfa:
1821,26 → 2165,50
#define cfi_change_reg_numbers(insn, cseg) do { } while (0)
#endif
 
static segT
get_cfi_seg (segT cseg, const char *base, flagword flags, int align)
#if SUPPORT_COMPACT_EH
static void
cfi_emit_eh_header (symbolS *sym, bfd_vma addend)
{
if (SUPPORT_FRAME_LINKONCE)
expressionS exp;
 
exp.X_add_number = addend;
exp.X_add_symbol = sym;
emit_expr_encoded (&exp, DW_EH_PE_sdata4 | DW_EH_PE_pcrel, FALSE);
}
 
static void
output_eh_header (struct fde_entry *fde)
{
struct dwcfi_seg_list *l;
char *p;
bfd_vma addend;
 
l = dwcfi_hash_find_or_make (cseg, base, flags);
if (fde->eh_header_type == EH_COMPACT_INLINE)
addend = 0;
else
addend = 1;
 
cseg = l->seg;
subseg_set (cseg, l->subseg);
cfi_emit_eh_header (fde->start_address, addend);
 
if (fde->eh_header_type == EH_COMPACT_INLINE)
{
p = frag_more (4);
/* Inline entries always use PR1. */
*(p++) = 1;
memcpy(p, fde->eh_data, 3);
}
else
{
cseg = subseg_new (base, 0);
bfd_set_section_flags (stdoutput, cseg, flags);
if (fde->eh_header_type == EH_COMPACT_LEGACY)
addend = 1;
else if (fde->eh_header_type == EH_COMPACT_OUTLINE
|| fde->eh_header_type == EH_COMPACT_OUTLINE_DONE)
addend = 0;
else
abort ();
cfi_emit_eh_header (fde->eh_loc, addend);
}
record_alignment (cseg, align);
return cseg;
}
#endif
 
void
cfi_finish (void)
1854,13 → 2222,14
if (all_fde_data == 0)
return;
 
if ((cfi_sections & CFI_EMIT_eh_frame) != 0)
if ((all_cfi_sections & CFI_EMIT_eh_frame) != 0
|| (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0)
{
/* Make sure check_eh_frame doesn't do anything with our output. */
save_flag_traditional_format = flag_traditional_format;
flag_traditional_format = 1;
 
if (!SUPPORT_FRAME_LINKONCE)
if (!EH_FRAME_LINKONCE)
{
/* Open .eh_frame section. */
cfi_seg = get_cfi_seg (NULL, ".eh_frame",
1888,7 → 2257,22
 
for (fde = all_fde_data; fde ; fde = fde->next)
{
if (SUPPORT_FRAME_LINKONCE)
if ((fde->sections & CFI_EMIT_eh_frame) == 0
&& (fde->sections & CFI_EMIT_eh_frame_compact) == 0)
continue;
 
#if SUPPORT_COMPACT_EH
/* Emit a LEGACY format header if we have processed all
of the .cfi directives without encountering either inline or
out-of-line compact unwinding opcodes. */
if (fde->eh_header_type == EH_COMPACT_HAS_LSDA
|| fde->eh_header_type == EH_COMPACT_UNKNOWN)
fde->eh_header_type = EH_COMPACT_LEGACY;
 
if (fde->eh_header_type != EH_COMPACT_LEGACY)
continue;
#endif
if (EH_FRAME_LINKONCE)
{
if (HANDLED (fde))
continue;
1922,20 → 2306,108
}
 
cie = select_cie_for_fde (fde, TRUE, &first, 2);
fde->eh_loc = symbol_temp_new_now ();
output_fde (fde, cie, TRUE, first,
fde->next == NULL ? EH_FRAME_ALIGNMENT : 2);
}
}
while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2);
while (EH_FRAME_LINKONCE && seek_next_seg == 2);
 
if (SUPPORT_FRAME_LINKONCE)
if (EH_FRAME_LINKONCE)
for (fde = all_fde_data; fde ; fde = fde->next)
SET_HANDLED (fde, 0);
 
#if SUPPORT_COMPACT_EH
if (compact_eh)
{
/* Create remaining out of line table entries. */
do
{
ccseg = NULL;
seek_next_seg = 0;
 
for (fde = all_fde_data; fde ; fde = fde->next)
{
if ((fde->sections & CFI_EMIT_eh_frame) == 0
&& (fde->sections & CFI_EMIT_eh_frame_compact) == 0)
continue;
 
if (fde->eh_header_type != EH_COMPACT_OUTLINE)
continue;
if (HANDLED (fde))
continue;
if (seek_next_seg && CUR_SEG (fde) != ccseg)
{
seek_next_seg = 2;
continue;
}
if (!seek_next_seg)
{
ccseg = CUR_SEG (fde);
/* Open .gnu_extab section. */
get_cfi_seg (ccseg, ".gnu_extab",
(SEC_ALLOC | SEC_LOAD | SEC_DATA
| DWARF2_EH_FRAME_READ_ONLY),
1);
seek_next_seg = 1;
}
SET_HANDLED (fde, 1);
 
frag_align (1, 0, 0);
record_alignment (now_seg, 1);
output_compact_unwind_data (fde, 1);
}
}
while (EH_FRAME_LINKONCE && seek_next_seg == 2);
 
for (fde = all_fde_data; fde ; fde = fde->next)
SET_HANDLED (fde, 0);
 
/* Create index table fragments. */
do
{
ccseg = NULL;
seek_next_seg = 0;
 
for (fde = all_fde_data; fde ; fde = fde->next)
{
if ((fde->sections & CFI_EMIT_eh_frame) == 0
&& (fde->sections & CFI_EMIT_eh_frame_compact) == 0)
continue;
 
if (HANDLED (fde))
continue;
if (seek_next_seg && CUR_SEG (fde) != ccseg)
{
seek_next_seg = 2;
continue;
}
if (!seek_next_seg)
{
ccseg = CUR_SEG (fde);
/* Open .eh_frame_entry section. */
cfi_seg = get_cfi_seg (ccseg, ".eh_frame_entry",
(SEC_ALLOC | SEC_LOAD | SEC_DATA
| DWARF2_EH_FRAME_READ_ONLY),
2);
seek_next_seg = 1;
}
SET_HANDLED (fde, 1);
 
output_eh_header (fde);
}
}
while (seek_next_seg == 2);
 
for (fde = all_fde_data; fde ; fde = fde->next)
SET_HANDLED (fde, 0);
}
#endif /* SUPPORT_COMPACT_EH */
 
flag_traditional_format = save_flag_traditional_format;
}
 
if ((cfi_sections & CFI_EMIT_debug_frame) != 0)
if ((all_cfi_sections & CFI_EMIT_debug_frame) != 0)
{
int alignment = ffs (DWARF2_ADDR_SIZE (stdoutput)) - 1;
 
1958,6 → 2430,9
 
for (fde = all_fde_data; fde ; fde = fde->next)
{
if ((fde->sections & CFI_EMIT_debug_frame) == 0)
continue;
 
if (SUPPORT_FRAME_LINKONCE)
{
if (HANDLED (fde))
2015,6 → 2490,7
{ "cfi_sections", dot_cfi_dummy, 0 },
{ "cfi_startproc", dot_cfi_dummy, 0 },
{ "cfi_endproc", dot_cfi_dummy, 0 },
{ "cfi_fde_data", dot_cfi_dummy, 0 },
{ "cfi_def_cfa", dot_cfi_dummy, 0 },
{ "cfi_def_cfa_register", dot_cfi_dummy, 0 },
{ "cfi_def_cfa_offset", dot_cfi_dummy, 0 },
2032,8 → 2508,11
{ "cfi_escape", dot_cfi_dummy, 0 },
{ "cfi_signal_frame", dot_cfi_dummy, 0 },
{ "cfi_personality", dot_cfi_dummy, 0 },
{ "cfi_personality_id", dot_cfi_dummy, 0 },
{ "cfi_lsda", dot_cfi_dummy, 0 },
{ "cfi_val_encoded_addr", dot_cfi_dummy, 0 },
{ "cfi_label", dot_cfi_dummy, 0 },
{ "cfi_inline_lsda", dot_cfi_dummy, 0 },
{ NULL, NULL, 0 }
};
 
/contrib/toolchain/binutils/gas/dw2gencfi.h
1,5 → 1,5
/* dw2gencfi.h - Support for generating Dwarf2 CFI information.
Copyright 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
Copyright (C) 2003-2015 Free Software Foundation, Inc.
Contributed by Michal Ludvig <mludvig@suse.cz>
 
This file is part of GAS, the GNU Assembler.
36,7 → 36,9
extern void cfi_new_fde (struct symbol *);
extern void cfi_end_fde (struct symbol *);
extern void cfi_set_return_column (unsigned);
extern void cfi_set_sections (void);
extern void cfi_add_advance_loc (struct symbol *);
extern void cfi_add_label (const char *);
 
extern void cfi_add_CFA_offset (unsigned, offsetT);
extern void cfi_add_CFA_def_cfa (unsigned, offsetT);
57,10 → 59,18
#define SUPPORT_FRAME_LINKONCE 0
#endif
 
#ifdef tc_cfi_reloc_for_encoding
#define SUPPORT_COMPACT_EH 1
#else
#define SUPPORT_COMPACT_EH 0
#endif
 
#define MULTIPLE_FRAME_SECTIONS (SUPPORT_FRAME_LINKONCE || SUPPORT_COMPACT_EH)
 
struct cfi_insn_data
{
struct cfi_insn_data *next;
#if SUPPORT_FRAME_LINKONCE
#if MULTIPLE_FRAME_SECTIONS
segT cur_seg;
#endif
int insn;
94,13 → 104,40
unsigned reg, encoding;
expressionS exp;
} ea;
 
const char *sym_name;
} u;
};
 
/* An enumeration describing the Compact EH header format. The least
significant bit is used to distinguish the entries.
 
Inline Compact: Function offset [0]
Four chars of unwind data.
Out-of-line Compact: Function offset [1]
Compact unwind data offset [0]
Legacy: Function offset [1]
Unwind data offset [1]
 
The header type is initialized to EH_COMPACT_UNKNOWN until the
format is discovered by encountering a .fde_data entry.
Failure to find a .fde_data entry will cause an EH_COMPACT_LEGACY
header to be generated. */
 
enum {
EH_COMPACT_UNKNOWN,
EH_COMPACT_LEGACY,
EH_COMPACT_INLINE,
EH_COMPACT_OUTLINE,
EH_COMPACT_OUTLINE_DONE,
/* Outline if .cfi_inline_lsda used, otherwise legacy FDE. */
EH_COMPACT_HAS_LSDA
};
 
struct fde_entry
{
struct fde_entry *next;
#if SUPPORT_FRAME_LINKONCE
#if MULTIPLE_FRAME_SECTIONS
segT cur_seg;
#endif
symbolS *start_address;
109,13 → 146,21
struct cfi_insn_data **last;
unsigned char per_encoding;
unsigned char lsda_encoding;
int personality_id;
expressionS personality;
expressionS lsda;
unsigned int return_column;
unsigned int signal_frame;
#if SUPPORT_FRAME_LINKONCE
#if MULTIPLE_FRAME_SECTIONS
int handled;
#endif
int eh_header_type;
/* Compact unwinding opcodes, not including the PR byte or LSDA. */
int eh_data_size;
bfd_byte *eh_data;
/* For out of line tables and FDEs. */
symbolS *eh_loc;
int sections;
};
 
/* The list of all FDEs that have been collected. */
128,5 → 173,12
#define CFI_escape 0x103
#define CFI_signal_frame 0x104
#define CFI_val_encoded_addr 0x105
#define CFI_label 0x106
 
/* By default emit .eh_frame only, not .debug_frame. */
#define CFI_EMIT_eh_frame (1 << 0)
#define CFI_EMIT_debug_frame (1 << 1)
#define CFI_EMIT_target (1 << 2)
#define CFI_EMIT_eh_frame_compact (1 << 3)
 
#endif /* DW2GENCFI_H */
/contrib/toolchain/binutils/gas/dwarf2dbg.c
1,5 → 1,5
/* dwarf2dbg.c - DWARF2 debug support
Copyright 1999-2013 Free Software Foundation, Inc.
Copyright (C) 1999-2015 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
 
This file is part of GAS, the GNU Assembler.
158,6 → 158,10
/* The maximum address skip amount that can be encoded with a special op. */
#define MAX_SPECIAL_ADDR_DELTA SPECIAL_ADDR(255)
 
#ifndef TC_PARSE_CONS_RETURN_NONE
#define TC_PARSE_CONS_RETURN_NONE BFD_RELOC_NONE
#endif
 
struct line_entry {
struct line_entry *next;
symbolS *label;
182,9 → 186,6
 
/* Collects data for all line table entries during assembly. */
static struct line_seg *all_segs;
/* Hash used to quickly lookup a segment by name, avoiding the need to search
through the all_segs list. */
static struct hash_control *all_segs_hash;
static struct line_seg **last_seg_ptr;
 
struct file_entry {
244,17 → 245,9
static struct line_subseg *
get_line_subseg (segT seg, subsegT subseg, bfd_boolean create_p)
{
static segT last_seg;
static subsegT last_subseg;
static struct line_subseg *last_line_subseg;
 
struct line_seg *s;
struct line_seg *s = seg_info (seg)->dwarf2_line_seg;
struct line_subseg **pss, *lss;
 
if (seg == last_seg && subseg == last_subseg)
return last_line_subseg;
 
s = (struct line_seg *) hash_find (all_segs_hash, seg->name);
if (s == NULL)
{
if (!create_p)
266,7 → 259,7
s->head = NULL;
*last_seg_ptr = s;
last_seg_ptr = &s->next;
hash_insert (all_segs_hash, seg->name, s);
seg_info (seg)->dwarf2_line_seg = s;
}
gas_assert (seg == s->seg);
 
287,10 → 280,6
*pss = lss;
 
found_subseg:
last_seg = seg;
last_subseg = subseg;
last_line_subseg = lss;
 
return lss;
}
 
681,8 → 670,7
char *p, c;
offsetT value;
 
p = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& p);
 
if (strcmp (p, "basic_block") == 0)
{
701,7 → 689,7
}
else if (strcmp (p, "is_stmt") == 0)
{
*input_line_pointer = c;
(void) restore_line_pointer (c);
value = get_absolute_expression ();
if (value == 0)
current.flags &= ~DWARF2_FLAG_IS_STMT;
715,7 → 703,7
}
else if (strcmp (p, "isa") == 0)
{
*input_line_pointer = c;
(void) restore_line_pointer (c);
value = get_absolute_expression ();
if (value >= 0)
current.isa = value;
727,7 → 715,7
}
else if (strcmp (p, "discriminator") == 0)
{
*input_line_pointer = c;
(void) restore_line_pointer (c);
value = get_absolute_expression ();
if (value >= 0)
current.discriminator = value;
740,11 → 728,11
else
{
as_bad (_("unknown .loc sub-directive `%s'"), p);
*input_line_pointer = c;
(void) restore_line_pointer (c);
return;
}
 
SKIP_WHITESPACE ();
SKIP_WHITESPACE_AFTER_NAME ();
}
 
demand_empty_rest_of_line ();
1144,13 → 1132,13
exp.X_op = O_symbol;
exp.X_add_symbol = to_sym;
exp.X_add_number = 0;
emit_expr_fix (&exp, sizeof_address, frag, p);
emit_expr_fix (&exp, sizeof_address, frag, p, TC_PARSE_CONS_RETURN_NONE);
p += sizeof_address;
}
else
{
*p++ = DW_LNS_fixed_advance_pc;
emit_expr_fix (pexp, 2, frag, p);
emit_expr_fix (pexp, 2, frag, p, TC_PARSE_CONS_RETURN_NONE);
p += 2;
}
 
1469,7 → 1457,8
 
/* Switch to SEC and output a header length field. Return the size of
offsets used in SEC. The caller must set EXPR->X_add_symbol value
to the end of the section. */
to the end of the section. EXPR->X_add_number will be set to the
negative size of the header. */
 
static int
out_header (asection *sec, expressionS *exp)
1478,8 → 1467,21
symbolS *end_sym;
 
subseg_set (sec, 0);
 
if (flag_dwarf_sections)
{
/* If we are going to put the start and end symbols in different
sections, then we need real symbols, not just fake, local ones. */
frag_now_fix ();
start_sym = symbol_make (".Ldebug_line_start");
end_sym = symbol_make (".Ldebug_line_end");
symbol_set_value_now (start_sym);
}
else
{
start_sym = symbol_temp_new_now ();
end_sym = symbol_temp_make ();
}
 
/* Total length of the information. */
exp->X_op = O_subtract;
1515,7 → 1517,7
out_debug_line (segT line_seg)
{
expressionS exp;
symbolS *prologue_end;
symbolS *prologue_start, *prologue_end;
symbolS *line_end;
struct line_seg *s;
int sizeof_offset;
1527,10 → 1529,14
out_two (DWARF2_LINE_VERSION);
 
/* Length of the prologue following this length. */
prologue_start = symbol_temp_make ();
prologue_end = symbol_temp_make ();
exp.X_op = O_subtract;
exp.X_add_symbol = prologue_end;
exp.X_add_number = - (4 + 2 + 4);
exp.X_op_symbol = prologue_start;
exp.X_add_number = 0;
emit_expr (&exp, sizeof_offset);
symbol_set_value_now (prologue_start);
 
/* Parameters of the state machine. */
out_byte (DWARF2_LINE_MIN_INSN_LENGTH);
1632,6 → 1638,7
out_debug_aranges (segT aranges_seg, segT info_seg)
{
unsigned int addr_size = sizeof_address;
offsetT size;
struct line_seg *s;
expressionS exp;
symbolS *aranges_end;
1640,21 → 1647,27
 
sizeof_offset = out_header (aranges_seg, &exp);
aranges_end = exp.X_add_symbol;
size = -exp.X_add_number;
 
/* Version. */
out_two (DWARF2_ARANGES_VERSION);
size += 2;
 
/* Offset to .debug_info. */
TC_DWARF2_EMIT_OFFSET (section_symbol (info_seg), sizeof_offset);
size += sizeof_offset;
 
/* Size of an address (offset portion). */
out_byte (addr_size);
size++;
 
/* Size of a segment descriptor. */
out_byte (0);
size++;
 
/* Align the header. */
frag_align (ffs (2 * addr_size) - 1, 0, 0);
while ((size++ % (2 * addr_size)) > 0)
out_byte (0);
 
for (s = all_segs; s; s = s->next)
{
1839,7 → 1852,6
void
dwarf2_init (void)
{
all_segs_hash = hash_new ();
last_seg_ptr = &all_segs;
}
 
/contrib/toolchain/binutils/gas/dwarf2dbg.h
1,6 → 1,5
/* dwarf2dbg.h - DWARF2 debug support
Copyright 1999, 2000, 2002, 2003, 2005, 2006, 2007, 2009
Free Software Foundation, Inc.
Copyright (C) 1999-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/ecoff.c
1,7 → 1,5
/* ECOFF debugging support.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Copyright (C) 1993-2015 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file was put together by Ian Lance Taylor <ian@cygnus.com>. A
good deal of it comes directly from mips-tfile.c, by Michael
1554,8 → 1552,8
const char *str, /* string */
shash_t **ret_hash /* return hash pointer */)
{
register unsigned long len = strlen (str);
register shash_t *hash_ptr;
unsigned long len = strlen (str);
shash_t *hash_ptr;
 
if (len >= PAGE_USIZE)
as_fatal (_("string too big (%lu bytes)"), len);
1563,7 → 1561,7
hash_ptr = (shash_t *) hash_find (hash_tbl, str);
if (hash_ptr == (shash_t *) NULL)
{
register const char *err;
const char *err;
 
if (vp->objects_last_page + len >= PAGE_USIZE)
{
1606,12 → 1604,12
symint_t indx /* index to local/aux. syms */)
{
localsym_t *psym;
register scope_t *pscope;
register thead_t *ptag_head;
register tag_t *ptag;
register tag_t *ptag_next;
register varray_t *vp;
register int scope_delta = 0;
scope_t *pscope;
thead_t *ptag_head;
tag_t *ptag;
tag_t *ptag_next;
varray_t *vp;
int scope_delta = 0;
shash_t *hash_ptr = (shash_t *) NULL;
 
if (cur_file_ptr == (efdr_t *) NULL)
1804,8 → 1802,8
static symint_t
add_aux_sym_symint (symint_t aux_word /* auxiliary information word */)
{
register varray_t *vp;
register aux_t *aux_ptr;
varray_t *vp;
aux_t *aux_ptr;
 
if (cur_file_ptr == (efdr_t *) NULL)
as_fatal (_("no current file pointer"));
1827,8 → 1825,8
static symint_t
add_aux_sym_rndx (int file_index, symint_t sym_index)
{
register varray_t *vp;
register aux_t *aux_ptr;
varray_t *vp;
aux_t *aux_ptr;
 
if (cur_file_ptr == (efdr_t *) NULL)
as_fatal (_("no current file pointer"));
1854,8 → 1852,8
hash_state_t state, /* whether to hash type or not */
thash_t **hash_tbl /* pointer to hash table to use */)
{
register varray_t *vp;
register aux_t *aux_ptr;
varray_t *vp;
aux_t *aux_ptr;
static AUXU init_aux;
symint_t ret;
int i;
1902,8 → 1900,8
 
if (state != hash_no)
{
register thash_t *hash_ptr;
register symint_t hi;
thash_t *hash_ptr;
symint_t hi;
 
hi = aux.isym & ((1 << HASHBITS) - 1);
hi %= THASH_SIZE;
1959,9 → 1957,9
|| t->basic_type == bt_Union
|| t->basic_type == bt_Enum)
{
register symint_t file_index = t->tag_ptr->ifd;
register localsym_t *sym = t->tag_ptr->sym;
register forward_t *forward_ref = allocate_forward ();
symint_t file_index = t->tag_ptr->ifd;
localsym_t *sym = t->tag_ptr->sym;
forward_t *forward_ref = allocate_forward ();
 
if (sym != (localsym_t *) NULL)
{
2116,8 → 2114,8
static void
add_procedure (char *func /* func name */)
{
register varray_t *vp;
register proc_t *new_proc_ptr;
varray_t *vp;
proc_t *new_proc_ptr;
symbolS *sym;
 
#ifdef ECOFF_DEBUG
2186,8 → 2184,8
static void
add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake)
{
register int first_ch;
register efdr_t *fil_ptr;
int first_ch;
efdr_t *fil_ptr;
 
#ifdef ECOFF_DEBUG
if (debug)
2436,14 → 2434,13
return;
}
 
name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&name);
 
(void) add_ecoff_symbol ((const char *) NULL, st_Block, sc_Text,
symbol_find_or_make (name),
(bfd_vma) 0, (symint_t) 0, (symint_t) 0);
 
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
 
/* The line number follows, but we don't use it. */
(void) get_absolute_expression ();
2474,8 → 2471,7
return;
}
 
name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&name);
 
/* The value is the distance between the .bend directive and the
corresponding symbol. We fill in the offset when we write out
2487,7 → 2483,7
(void) add_ecoff_symbol ((const char *) NULL, st_End, sc_Text, endsym,
(bfd_vma) 0, (symint_t) 0, (symint_t) 0);
 
*input_line_pointer = name_end;
restore_line_pointer (name_end);
 
/* The line number follows, but we don't use it. */
(void) get_absolute_expression ();
2521,8 → 2517,7
 
SKIP_WHITESPACE ();
 
name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&name);
 
if (coff_sym_name != (char *) NULL)
as_warn (_(".def pseudo-op used inside of .def/.endef; ignored"));
2546,7 → 2541,7
coff_sym_addend = 0;
}
 
*input_line_pointer = name_end;
restore_line_pointer (name_end);
 
demand_empty_rest_of_line ();
}
2759,12 → 2754,11
return;
}
 
name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&name);
 
coff_tag = xstrdup (name);
 
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
 
demand_empty_rest_of_line ();
}
3006,13 → 3000,12
return;
}
 
name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&name);
 
if (name == input_line_pointer)
{
as_warn (_(".end directive has no name"));
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
demand_empty_rest_of_line ();
return;
}
3033,7 → 3026,7
 
cur_proc_ptr = (proc_t *) NULL;
 
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
demand_empty_rest_of_line ();
}
3055,13 → 3048,12
return;
}
 
name = input_line_pointer;
name_end = get_symbol_end ();
name_end = get_symbol_name (&name);
 
if (name == input_line_pointer)
{
as_warn (_(".ent directive has no name"));
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
demand_empty_rest_of_line ();
return;
}
3068,7 → 3060,7
 
add_procedure (name);
 
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
 
/* The .ent directive is sometimes followed by a number. I'm not
really sure what the number means. I don't see any way to store
3097,10 → 3089,9
symbolS *symbolp;
valueT size;
 
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (&name);
symbolp = symbol_find_or_make (name);
*input_line_pointer = c;
(void) restore_line_pointer (c);
 
S_SET_EXTERNAL (symbolp);
 
3350,10 → 3341,9
symbolS *symbolP;
expressionS exp;
 
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (&name);
symbolP = symbol_find_or_make (name);
*input_line_pointer = c;
(void) restore_line_pointer (c);
 
SKIP_WHITESPACE ();
 
3491,11 → 3481,9
return;
}
 
name = input_line_pointer;
name_end = get_symbol_end ();
 
name_end = get_symbol_name (&name);
sym = symbol_find_or_make (name);
*input_line_pointer = name_end;
(void) restore_line_pointer (name_end);
 
value = 0;
addend = 0;
3669,7 → 3657,7
long *linecntptr)
{
char *bufptr;
register lineno_list_t *l;
lineno_list_t *l;
lineno_list_t *last;
efdr_t *file;
proc_t *proc;
4594,7 → 4582,7
static void
ecoff_setup_ext (void)
{
register symbolS *sym;
symbolS *sym;
 
for (sym = symbol_rootP; sym != (symbolS *) NULL; sym = symbol_next (sym))
{
4790,7 → 4778,7
static page_type *
allocate_cluster (unsigned long npages)
{
register page_type *value = (page_type *) xmalloc (npages * PAGE_USIZE);
page_type *value = (page_type *) xmalloc (npages * PAGE_USIZE);
 
#ifdef ECOFF_DEBUG
if (debug > 3)
4839,7 → 4827,7
static scope_t *
allocate_scope (void)
{
register scope_t *ptr;
scope_t *ptr;
static scope_t initial_scope;
 
#ifndef MALLOC_CHECK
4849,8 → 4837,8
alloc_counts[(int) alloc_type_scope].free_list.f_scope = ptr->free;
else
{
register int unallocated = alloc_counts[(int) alloc_type_scope].unallocated;
register page_type *cur_page = alloc_counts[(int) alloc_type_scope].cur_page;
int unallocated = alloc_counts[(int) alloc_type_scope].unallocated;
page_type *cur_page = alloc_counts[(int) alloc_type_scope].cur_page;
 
if (unallocated == 0)
{
4894,13 → 4882,13
static vlinks_t *
allocate_vlinks (void)
{
register vlinks_t *ptr;
vlinks_t *ptr;
static vlinks_t initial_vlinks;
 
#ifndef MALLOC_CHECK
 
register int unallocated = alloc_counts[(int) alloc_type_vlinks].unallocated;
register page_type *cur_page = alloc_counts[(int) alloc_type_vlinks].cur_page;
int unallocated = alloc_counts[(int) alloc_type_vlinks].unallocated;
page_type *cur_page = alloc_counts[(int) alloc_type_vlinks].cur_page;
 
if (unallocated == 0)
{
4928,13 → 4916,13
static shash_t *
allocate_shash (void)
{
register shash_t *ptr;
shash_t *ptr;
static shash_t initial_shash;
 
#ifndef MALLOC_CHECK
 
register int unallocated = alloc_counts[(int) alloc_type_shash].unallocated;
register page_type *cur_page = alloc_counts[(int) alloc_type_shash].cur_page;
int unallocated = alloc_counts[(int) alloc_type_shash].unallocated;
page_type *cur_page = alloc_counts[(int) alloc_type_shash].cur_page;
 
if (unallocated == 0)
{
4962,13 → 4950,13
static thash_t *
allocate_thash (void)
{
register thash_t *ptr;
thash_t *ptr;
static thash_t initial_thash;
 
#ifndef MALLOC_CHECK
 
register int unallocated = alloc_counts[(int) alloc_type_thash].unallocated;
register page_type *cur_page = alloc_counts[(int) alloc_type_thash].cur_page;
int unallocated = alloc_counts[(int) alloc_type_thash].unallocated;
page_type *cur_page = alloc_counts[(int) alloc_type_thash].cur_page;
 
if (unallocated == 0)
{
4996,7 → 4984,7
static tag_t *
allocate_tag (void)
{
register tag_t *ptr;
tag_t *ptr;
static tag_t initial_tag;
 
#ifndef MALLOC_CHECK
5006,8 → 4994,8
alloc_counts[(int) alloc_type_tag].free_list.f_tag = ptr->free;
else
{
register int unallocated = alloc_counts[(int) alloc_type_tag].unallocated;
register page_type *cur_page = alloc_counts[(int) alloc_type_tag].cur_page;
int unallocated = alloc_counts[(int) alloc_type_tag].unallocated;
page_type *cur_page = alloc_counts[(int) alloc_type_tag].cur_page;
 
if (unallocated == 0)
{
5051,13 → 5039,13
static forward_t *
allocate_forward (void)
{
register forward_t *ptr;
forward_t *ptr;
static forward_t initial_forward;
 
#ifndef MALLOC_CHECK
 
register int unallocated = alloc_counts[(int) alloc_type_forward].unallocated;
register page_type *cur_page = alloc_counts[(int) alloc_type_forward].cur_page;
int unallocated = alloc_counts[(int) alloc_type_forward].unallocated;
page_type *cur_page = alloc_counts[(int) alloc_type_forward].cur_page;
 
if (unallocated == 0)
{
5085,7 → 5073,7
static thead_t *
allocate_thead (void)
{
register thead_t *ptr;
thead_t *ptr;
static thead_t initial_thead;
 
#ifndef MALLOC_CHECK
5095,8 → 5083,8
alloc_counts[(int) alloc_type_thead].free_list.f_thead = ptr->free;
else
{
register int unallocated = alloc_counts[(int) alloc_type_thead].unallocated;
register page_type *cur_page = alloc_counts[(int) alloc_type_thead].cur_page;
int unallocated = alloc_counts[(int) alloc_type_thead].unallocated;
page_type *cur_page = alloc_counts[(int) alloc_type_thead].cur_page;
 
if (unallocated == 0)
{
5138,13 → 5126,13
static lineno_list_t *
allocate_lineno_list (void)
{
register lineno_list_t *ptr;
lineno_list_t *ptr;
static lineno_list_t initial_lineno_list;
 
#ifndef MALLOC_CHECK
 
register int unallocated = alloc_counts[(int) alloc_type_lineno].unallocated;
register page_type *cur_page = alloc_counts[(int) alloc_type_lineno].cur_page;
int unallocated = alloc_counts[(int) alloc_type_lineno].unallocated;
page_type *cur_page = alloc_counts[(int) alloc_type_lineno].cur_page;
 
if (unallocated == 0)
{
/contrib/toolchain/binutils/gas/ecoff.h
1,6 → 1,5
/* ecoff.h -- header file for ECOFF debugging support
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2004, 2005,
2007, 2009 Free Software Foundation, Inc.
Copyright (C) 1993-2015 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Put together by Ian Lance Taylor <ian@cygnus.com>.
 
/contrib/toolchain/binutils/gas/ehopt.c
1,6 → 1,5
/* ehopt.c--optimize gcc exception frame information.
Copyright 1998, 2000, 2001, 2003, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Copyright (C) 1998-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
 
This file is part of GAS, the GNU Assembler.
/contrib/toolchain/binutils/gas/expr.c
1,7 → 1,5
/* expr.c -operands, expressions-
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011,
2012 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
29,7 → 27,6
 
#include "as.h"
#include "safe-ctype.h"
#include "obstack.h"
 
#ifdef HAVE_LIMITS_H
#include <limits.h>
127,7 → 124,7
int
expr_symbol_where (symbolS *sym, char **pfile, unsigned int *pline)
{
register struct expr_symbol_line *l;
struct expr_symbol_line *l;
 
for (l = expr_symbol_lines; l != NULL; l = l->next)
{
288,6 → 285,12
#define valuesize 32
#endif
 
if (is_end_of_line[(unsigned char) *input_line_pointer])
{
expressionP->X_op = O_absent;
return;
}
 
if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) && radix == 0)
{
int flt = 0;
835,18 → 838,10
break;
 
case 'b':
if (LOCAL_LABELS_FB && ! (flag_m68k_mri || NUMBERS_WITH_SUFFIX))
if (LOCAL_LABELS_FB && !flag_m68k_mri
&& input_line_pointer[1] != '0'
&& input_line_pointer[1] != '1')
{
/* This code used to check for '+' and '-' here, and, in
some conditions, fall through to call
integer_constant. However, that didn't make sense,
as integer_constant only accepts digits. */
/* Some of our code elsewhere does permit digits greater
than the expected base; for consistency, do the same
here. */
if (input_line_pointer[1] < '0'
|| input_line_pointer[1] > '9')
{
/* Parse this as a back reference to label 0. */
input_line_pointer--;
integer_constant (10, expressionP);
853,14 → 848,18
break;
}
/* Otherwise, parse this as a binary number. */
}
/* Fall through. */
case 'B':
if (input_line_pointer[1] == '0'
|| input_line_pointer[1] == '1')
{
input_line_pointer++;
integer_constant (2, expressionP);
break;
}
if (flag_m68k_mri || NUMBERS_WITH_SUFFIX)
input_line_pointer++;
goto default_case;
integer_constant (2, expressionP);
break;
 
case '0':
case '1':
878,48 → 877,35
case 'f':
if (LOCAL_LABELS_FB)
{
int is_label = 1;
 
/* If it says "0f" and it could possibly be a floating point
number, make it one. Otherwise, make it a local label,
and try to deal with parsing the rest later. */
if (!input_line_pointer[1]
|| (is_end_of_line[0xff & input_line_pointer[1]])
|| strchr (FLT_CHARS, 'f') == NULL)
goto is_0f_label;
if (!is_end_of_line[(unsigned char) input_line_pointer[1]]
&& strchr (FLT_CHARS, 'f') != NULL)
{
char *cp = input_line_pointer + 1;
int r = atof_generic (&cp, ".", EXP_CHARS,
 
atof_generic (&cp, ".", EXP_CHARS,
&generic_floating_point_number);
switch (r)
 
/* Was nothing parsed, or does it look like an
expression? */
is_label = (cp == input_line_pointer + 1
|| (cp == input_line_pointer + 2
&& (cp[-1] == '-' || cp[-1] == '+'))
|| *cp == 'f'
|| *cp == 'b');
}
if (is_label)
{
case 0:
case ERROR_EXPONENT_OVERFLOW:
if (*cp == 'f' || *cp == 'b')
/* Looks like a difference expression. */
goto is_0f_label;
else if (cp == input_line_pointer + 1)
/* No characters has been accepted -- looks like
end of operand. */
goto is_0f_label;
else
goto is_0f_float;
default:
as_fatal (_("expr.c(operand): bad atof_generic return val %d"),
r);
}
}
 
/* Okay, now we've sorted it out. We resume at one of these
two labels, depending on what we've decided we're probably
looking at. */
is_0f_label:
input_line_pointer--;
integer_constant (10, expressionP);
break;
 
is_0f_float:
}
}
/* Fall through. */
;
}
 
case 'd':
case 'D':
1024,7 → 1010,8
/* input_line_pointer -> char after operand. */
if (c == '-')
{
expressionP->X_add_number = - expressionP->X_add_number;
expressionP->X_add_number
= - (addressT) expressionP->X_add_number;
/* Notice: '-' may overflow: no warning is given.
This is compatible with other people's
assemblers. Sigh. */
1155,8 → 1142,7
 
++input_line_pointer;
SKIP_WHITESPACE ();
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& name);
 
buf = (char *) xmalloc (strlen (name) + 10);
if (start)
1171,7 → 1157,7
expressionP->X_add_number = 0;
 
*input_line_pointer = c;
SKIP_WHITESPACE ();
SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ')')
as_bad (_("syntax error in .startof. or .sizeof."));
else
1227,13 → 1213,13
#if defined(md_need_index_operator) || defined(TC_M68K)
de_fault:
#endif
if (is_name_beginner (c)) /* Here if did not begin with a digit. */
if (is_name_beginner (c) || c == '"') /* Here if did not begin with a digit. */
{
/* Identifier begins here.
This is kludged for speed, so code is repeated. */
isname:
name = --input_line_pointer;
c = get_symbol_end ();
-- input_line_pointer;
c = get_symbol_name (&name);
 
#ifdef md_operator
{
1242,15 → 1228,15
switch (op)
{
case O_uminus:
*input_line_pointer = c;
restore_line_pointer (c);
c = '-';
goto unary;
case O_bit_not:
*input_line_pointer = c;
restore_line_pointer (c);
c = '~';
goto unary;
case O_logical_not:
*input_line_pointer = c;
restore_line_pointer (c);
c = '!';
goto unary;
case O_illegal:
1259,9 → 1245,10
default:
break;
}
 
if (op != O_absent && op != O_illegal)
{
*input_line_pointer = c;
restore_line_pointer (c);
expr (9, expressionP, mode);
expressionP->X_add_symbol = make_expr_symbol (expressionP);
expressionP->X_op_symbol = NULL;
1279,7 → 1266,7
entering it in the symbol table. */
if (md_parse_name (name, expressionP, mode, &c))
{
*input_line_pointer = c;
restore_line_pointer (c);
break;
}
#endif
1299,10 → 1286,9
|| name[1] == 'T');
 
*input_line_pointer = c;
SKIP_WHITESPACE ();
SKIP_WHITESPACE_AFTER_NAME ();
 
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& name);
 
buf = (char *) xmalloc (strlen (name) + 10);
if (start)
1317,8 → 1303,7
expressionP->X_add_number = 0;
 
*input_line_pointer = c;
SKIP_WHITESPACE ();
 
SKIP_WHITESPACE_AFTER_NAME ();
break;
}
#endif
1346,7 → 1331,8
expressionP->X_add_symbol = symbolP;
expressionP->X_add_number = 0;
}
*input_line_pointer = c;
 
restore_line_pointer (c);
}
else
{
1602,8 → 1588,8
#ifdef md_operator
if (is_name_beginner (c))
{
char *name = input_line_pointer;
char ec = get_symbol_end ();
char *name;
char ec = get_symbol_name (& name);
 
ret = md_operator (name, 2, &ec);
switch (ret)
2331,9 → 2317,11
expr.c is just a branch office read.c anyway, and putting it
here lessens the crowd at read.c.
 
Assume input_line_pointer is at start of symbol name.
Assume input_line_pointer is at start of symbol name, or the
start of a double quote enclosed symbol name.
Advance input_line_pointer past symbol name.
Turn that character into a '\0', returning its former value.
Turn that character into a '\0', returning its former value,
which may be the closing double quote.
This allows a string compare (RMS wants symbol names to be strings)
of the symbol name.
There will always be a char following symbol name, because all good
2340,10 → 2328,11
lines end in end-of-line. */
 
char
get_symbol_end (void)
get_symbol_name (char ** ilp_return)
{
char c;
 
* ilp_return = input_line_pointer;
/* We accept \001 in a name in case this is being called with a
constructed string. */
if (is_name_beginner (c = *input_line_pointer++) || c == '\001')
2354,10 → 2343,38
if (is_name_ender (c))
c = *input_line_pointer++;
}
else if (c == '"')
{
bfd_boolean backslash_seen;
 
* ilp_return = input_line_pointer;
do
{
backslash_seen = c == '\\';
c = * input_line_pointer ++;
}
while (c != 0 && (c != '"' || backslash_seen));
 
if (c == 0)
as_warn (_("missing closing '\"'"));
}
*--input_line_pointer = 0;
return (c);
return c;
}
 
/* Replace the NUL character pointed to by input_line_pointer
with C. If C is \" then advance past it. Return the character
now pointed to by input_line_pointer. */
 
char
restore_line_pointer (char c)
{
* input_line_pointer = c;
if (c == '"')
c = * ++ input_line_pointer;
return c;
}
 
unsigned int
get_single_number (void)
{
/contrib/toolchain/binutils/gas/expr.h
1,6 → 1,5
/* expr.h -> header file for expr.c
Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
171,7 → 170,8
 
typedef char operator_rankT;
 
extern char get_symbol_end (void);
extern char get_symbol_name (char **);
extern char restore_line_pointer (char);
extern void expr_begin (void);
extern void expr_set_precedence (void);
extern void expr_set_rank (operatorT, operator_rankT);
/contrib/toolchain/binutils/gas/flonum-copy.c
1,6 → 1,5
/* flonum_copy.c - copy a flonum
Copyright 1987, 1990, 1991, 1992, 1993, 2000, 2003, 2005, 2007
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/flonum-konst.c
1,6 → 1,5
/* flonum_const.c - Useful Flonum constants
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2002,
2005, 2007 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/flonum-mult.c
1,6 → 1,5
/* flonum_mult.c - multiply two flonums
Copyright 1987, 1990, 1991, 1992, 1995, 2000, 2002, 2003, 2007
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/flonum.h
1,6 → 1,5
/* flonum.h - Floating point package
Copyright 1987, 1990, 1991, 1992, 1994, 1996, 2000, 2003, 2005, 2007
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/frags.c
1,7 → 1,5
/* frags.c - manage frags -
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
27,6 → 25,20
extern fragS zero_address_frag;
extern fragS predefined_address_frag;
static int totalfrags;
 
int
get_frag_count (void)
{
return totalfrags;
}
 
void
clear_frag_count (void)
{
totalfrags = 0;
}
/* Initialization for frag routines. */
 
void
72,6 → 84,7
ptr = (fragS *) obstack_alloc (ob, SIZEOF_STRUCT_FRAG);
obstack_alignment_mask (ob) = oalign;
memset (ptr, 0, SIZEOF_STRUCT_FRAG);
totalfrags++;
return ptr;
}
81,12 → 94,12
do not return. Do not set up any fields of *now_frag. */
 
void
frag_grow (unsigned int nchars)
frag_grow (size_t nchars)
{
if (obstack_room (&frchain_now->frch_obstack) < nchars)
{
long oldc;
long newc;
size_t oldc;
size_t newc;
 
/* Try to allocate a bit more than needed right now. But don't do
this if we would waste too much memory. Especially necessary
98,8 → 111,8
newc += SIZEOF_STRUCT_FRAG;
 
/* Check for possible overflow. */
if (newc < 0)
as_fatal (_("can't extend frag %u chars"), nchars);
if (newc < nchars)
as_fatal (_("can't extend frag %lu chars"), (unsigned long) nchars);
 
/* Force to allocate at least NEWC bytes, but not less than the
default. */
139,7 → 152,7
of frchain_now. */
 
void
frag_new (int old_frags_var_max_size
frag_new (size_t old_frags_var_max_size
/* Number of chars (already allocated on obstack frags) in
variable_length part of frag. */)
{
191,15 → 204,15
frag_now_growth past the new chars. */
 
char *
frag_more (int nchars)
frag_more (size_t nchars)
{
register char *retval;
char *retval;
 
frag_alloc_check (&frchain_now->frch_obstack);
frag_grow (nchars);
retval = obstack_next_free (&frchain_now->frch_obstack);
obstack_blank_fast (&frchain_now->frch_obstack, nchars);
return (retval);
return retval;
}
/* Close the current frag, setting its fields for a relaxable frag. Start a
206,7 → 219,7
new frag. */
 
static void
frag_var_init (relax_stateT type, int max_chars, int var,
frag_var_init (relax_stateT type, size_t max_chars, size_t var,
relax_substateT subtype, symbolS *symbol, offsetT offset,
char *opcode)
{
237,10 → 250,11
to write into. */
 
char *
frag_var (relax_stateT type, int max_chars, int var, relax_substateT subtype,
symbolS *symbol, offsetT offset, char *opcode)
frag_var (relax_stateT type, size_t max_chars, size_t var,
relax_substateT subtype, symbolS *symbol, offsetT offset,
char *opcode)
{
register char *retval;
char *retval;
 
frag_grow (max_chars);
retval = obstack_next_free (&frchain_now->frch_obstack);
254,11 → 268,11
No call to frag_grow is done. */
 
char *
frag_variant (relax_stateT type, int max_chars, int var,
frag_variant (relax_stateT type, size_t max_chars, size_t var,
relax_substateT subtype, symbolS *symbol, offsetT offset,
char *opcode)
{
register char *retval;
char *retval;
 
retval = obstack_next_free (&frchain_now->frch_obstack);
frag_var_init (type, max_chars, var, subtype, symbol, offset, opcode);
269,7 → 283,7
/* Reduce the variable end of a frag to a harmless state. */
 
void
frag_wane (register fragS *fragP)
frag_wane (fragS *fragP)
{
fragP->fr_type = rs_fill;
fragP->fr_offset = 0;
278,7 → 292,7
/* Return the number of bytes by which the current frag can be grown. */
 
int
size_t
frag_room (void)
{
return obstack_room (&frchain_now->frch_obstack);
323,7 → 337,7
 
void
frag_align_pattern (int alignment, const char *fill_pattern,
int n_fill, int max)
size_t n_fill, int max)
{
char *p;
 
/contrib/toolchain/binutils/gas/frags.h
1,7 → 1,5
/* frags.h - Header file for the frag concept.
Copyright 1987, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
129,19 → 127,19
 
void frag_init (void);
fragS *frag_alloc (struct obstack *);
void frag_grow (unsigned int nchars);
char *frag_more (int nchars);
void frag_grow (size_t nchars);
char *frag_more (size_t nchars);
void frag_align (int alignment, int fill_character, int max);
void frag_align_pattern (int alignment, const char *fill_pattern,
int n_fill, int max);
size_t n_fill, int max);
void frag_align_code (int alignment, int max);
void frag_new (int old_frags_var_max_size);
void frag_new (size_t old_frags_var_max_size);
void frag_wane (fragS * fragP);
int frag_room (void);
size_t frag_room (void);
 
char *frag_variant (relax_stateT type,
int max_chars,
int var,
size_t max_chars,
size_t var,
relax_substateT subtype,
symbolS * symbol,
offsetT offset,
148,8 → 146,8
char *opcode);
 
char *frag_var (relax_stateT type,
int max_chars,
int var,
size_t max_chars,
size_t var,
relax_substateT subtype,
symbolS * symbol,
offsetT offset,
157,4 → 155,7
 
bfd_boolean frag_offset_fixed_p (const fragS *, const fragS *, offsetT *);
 
int get_frag_count (void);
void clear_frag_count (void);
 
#endif /* FRAGS_H */
/contrib/toolchain/binutils/gas/hash.c
1,7 → 1,5
/* hash.c -- gas hash table code
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009, 2011, 2013
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/hash.h
1,6 → 1,5
/* hash.h -- header file for gas hash table routines
Copyright 1987, 1992, 1993, 1995, 1999, 2003, 2005, 2007, 2008, 2013
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/input-file.c
1,7 → 1,5
/* input_file.c - Deal with Input Files -
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001,
2002, 2003, 2005, 2006, 2007, 2009, 2012
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
81,7 → 79,7
char *
input_file_push (void)
{
register struct saved_file *saved;
struct saved_file *saved;
 
saved = (struct saved_file *) xmalloc (sizeof *saved);
 
100,7 → 98,7
void
input_file_pop (char *arg)
{
register struct saved_file *saved = (struct saved_file *) arg;
struct saved_file *saved = (struct saved_file *) arg;
 
input_file_end (); /* Close out old file. */
 
/contrib/toolchain/binutils/gas/input-file.h
1,6 → 1,5
/* input_file.h header for input-file.c
Copyright 1987, 1992, 1993, 2000, 2003, 2005, 2006, 2007, 2012
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/input-scrub.c
1,7 → 1,5
/* input_scrub.c - Break up input buffers into whole numbers of lines.
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2000, 2001, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
139,7 → 137,7
static struct input_save *
input_scrub_push (char *saved_position)
{
register struct input_save *saved;
struct input_save *saved;
 
saved = (struct input_save *) xmalloc (sizeof *saved);
 
166,7 → 164,7
sb_index = -1;
 
buffer_start = (char *) xmalloc ((BEFORE_SIZE + buffer_length
+ buffer_length + AFTER_SIZE));
+ buffer_length + AFTER_SIZE + 1));
memcpy (buffer_start, BEFORE_STRING, (int) BEFORE_SIZE);
 
return saved;
211,7 → 209,7
buffer_length = input_file_buffer_size ();
 
buffer_start = (char *) xmalloc ((BEFORE_SIZE + buffer_length
+ buffer_length + AFTER_SIZE));
+ buffer_length + AFTER_SIZE + 1));
memcpy (buffer_start, BEFORE_STRING, (int) BEFORE_SIZE);
 
/* Line number things. */
313,7 → 311,7
char *
input_scrub_next_buffer (char **bufp)
{
register char *limit; /*->just after last char of buffer. */
char *limit; /*->just after last char of buffer. */
 
if (sb_index != (size_t) -1)
{
331,6 → 329,7
}
--macro_nest;
partial_where = NULL;
partial_size = 0;
if (next_saved_file != NULL)
*bufp = input_scrub_pop (next_saved_file);
return partial_where;
343,8 → 342,6
return partial_where;
}
 
*bufp = buffer_start + BEFORE_SIZE;
 
if (partial_size)
{
memmove (buffer_start + BEFORE_SIZE, partial_where,
351,58 → 348,51
(unsigned int) partial_size);
memcpy (buffer_start + BEFORE_SIZE, save_source, AFTER_SIZE);
}
 
while (1)
{
char *p;
 
*bufp = buffer_start + BEFORE_SIZE;
limit = input_file_give_next_buffer (buffer_start
+ BEFORE_SIZE
+ partial_size);
if (limit)
if (!limit)
{
register char *p; /* Find last newline. */
/* Terminate the buffer to avoid confusing TC_EOL_IN_INSN. */
*limit = '\0';
for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p)
;
++p;
if (partial_size == 0)
break;
 
while (p <= buffer_start + BEFORE_SIZE)
as_warn (_("end of file not at end of a line; newline inserted"));
p = buffer_start + BEFORE_SIZE + partial_size;
*p++ = '\n';
limit = p;
}
else
{
int limoff;
 
limoff = limit - buffer_start;
buffer_length += input_file_buffer_size ();
buffer_start = (char *) xrealloc (buffer_start,
(BEFORE_SIZE
+ 2 * buffer_length
+ AFTER_SIZE));
*bufp = buffer_start + BEFORE_SIZE;
limit = input_file_give_next_buffer (buffer_start + limoff);
 
if (limit == NULL)
{
as_warn (_("partial line at end of file ignored"));
partial_where = NULL;
if (next_saved_file)
*bufp = input_scrub_pop (next_saved_file);
return NULL;
}
 
/* Terminate the buffer to avoid confusing TC_EOL_IN_INSN. */
*limit = '\0';
 
/* Find last newline. */
for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p)
;
++p;
}
 
if (p != buffer_start + BEFORE_SIZE)
{
partial_where = p;
partial_size = limit - p;
memcpy (save_source, partial_where, (int) AFTER_SIZE);
memcpy (partial_where, AFTER_STRING, (int) AFTER_SIZE);
return partial_where;
}
else
{
partial_where = 0;
if (partial_size > 0)
{
as_warn (_("partial line at end of file ignored"));
 
partial_size = limit - (buffer_start + BEFORE_SIZE);
buffer_length += input_file_buffer_size ();
buffer_start = (char *) xrealloc (buffer_start,
(BEFORE_SIZE
+ 2 * buffer_length
+ AFTER_SIZE + 1));
}
 
/* Tell the listing we've finished the file. */
409,14 → 399,12
LISTING_EOF ();
 
/* If we should pop to another file at EOF, do it. */
partial_where = NULL;
if (next_saved_file)
{
*bufp = input_scrub_pop (next_saved_file); /* Pop state */
/* partial_where is now correct to return, since we popped it. */
*bufp = input_scrub_pop (next_saved_file);
 
return partial_where;
}
}
return (partial_where);
}
/* The remaining part of this file deals with line numbers, error
messages and so on. Return TRUE if we opened any file. */
/contrib/toolchain/binutils/gas/listing.c
1,7 → 1,5
/* listing.c - maintain assembly listings
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Copyright (C) 1991-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
91,7 → 89,6
 
#include "as.h"
#include "filenames.h"
#include "obstack.h"
#include "safe-ctype.h"
#include "input-file.h"
#include "subsegs.h"
/contrib/toolchain/binutils/gas/listing.h
1,6 → 1,5
/* This file is listing.h
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1997, 1998,
2003, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/literal.c
1,5 → 1,5
/* literal.c - GAS literal pool management.
Copyright 1994, 2000, 2005, 2007 Free Software Foundation, Inc.
Copyright (C) 1994-2015 Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com).
 
This file is part of GAS, the GNU Assembler.
/contrib/toolchain/binutils/gas/macro.c
1,6 → 1,5
/* macro.c - macro support for gas
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013 Free Software Foundation, Inc.
Copyright (C) 1994-2015 Free Software Foundation, Inc.
 
Written by Steve and Judy Chamberlain of Cygnus Support,
sac@cygnus.com
212,7 → 211,29
break;
}
}
 
/* PR gas/16908
Apply and discard .linefile directives that appear within
the macro. For long macros, one might want to report the
line number information associated with the lines within
the macro definition, but we would need more infrastructure
to make that happen correctly (e.g. resetting the line
number when expanding the macro), and since for short
macros we clearly prefer reporting the point of expansion
anyway, there's not an obviously better fix here. */
if (strncasecmp (ptr->ptr + i, "linefile", 8) == 0)
{
char *saved_input_line_pointer = input_line_pointer;
char saved_eol_char = ptr->ptr[ptr->len];
 
ptr->ptr[ptr->len] = '\0';
input_line_pointer = ptr->ptr + i + 8;
s_app_line (0);
ptr->ptr[ptr->len] = saved_eol_char;
input_line_pointer = saved_input_line_pointer;
ptr->len = line_start;
}
}
 
/* Add the original end-of-line char to the end and keep running. */
sb_add_char (ptr, more);
/contrib/toolchain/binutils/gas/macro.h
1,6 → 1,5
/* macro.h - header file for macro support for gas
Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006,
2007, 2012 Free Software Foundation, Inc.
Copyright (C) 1994-2015 Free Software Foundation, Inc.
 
Written by Steve and Judy Chamberlain of Cygnus Support,
sac@cygnus.com
/contrib/toolchain/binutils/gas/messages.c
1,7 → 1,5
/* messages.c - error reporter -
Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
 
GAS is free software; you can redistribute it and/or modify
153,13 → 151,12
if (file)
{
if (line != 0)
fprintf (stderr, "%s:%u: ", file, line);
fprintf (stderr, "%s:%u: %s%s\n", file, line, _("Warning: "), buffer);
else
fprintf (stderr, "%s: ", file);
fprintf (stderr, "%s: %s%s\n", file, _("Warning: "), buffer);
}
fprintf (stderr, _("Warning: "));
fputs (buffer, stderr);
(void) putc ('\n', stderr);
else
fprintf (stderr, "%s%s\n", _("Warning: "), buffer);
#ifndef NO_LISTING
listing_warning (buffer);
#endif
219,13 → 216,12
if (file)
{
if (line != 0)
fprintf (stderr, "%s:%u: ", file, line);
fprintf (stderr, "%s:%u: %s%s\n", file, line, _("Error: "), buffer);
else
fprintf (stderr, "%s: ", file);
fprintf (stderr, "%s: %s%s\n", file, _("Error: "), buffer);
}
fprintf (stderr, _("Error: "));
fputs (buffer, stderr);
(void) putc ('\n', stderr);
else
fprintf (stderr, "%s%s\n", _("Error: "), buffer);
#ifndef NO_LISTING
listing_error (buffer);
#endif
299,10 → 295,10
as_show_where ();
fprintf (stderr, _("Internal error!\n"));
if (fn)
fprintf (stderr, _("Assertion failure in %s at %s line %d.\n"),
fprintf (stderr, _("Assertion failure in %s at %s:%d.\n"),
fn, file, line);
else
fprintf (stderr, _("Assertion failure at %s line %d.\n"), file, line);
fprintf (stderr, _("Assertion failure at %s:%d.\n"), file, line);
fprintf (stderr, _("Please report this bug.\n"));
xexit (EXIT_FAILURE);
}
315,10 → 311,10
{
as_show_where ();
if (fn)
fprintf (stderr, _("Internal error, aborting at %s line %d in %s\n"),
fprintf (stderr, _("Internal error, aborting at %s:%d in %s\n"),
file, line, fn);
else
fprintf (stderr, _("Internal error, aborting at %s line %d\n"),
fprintf (stderr, _("Internal error, aborting at %s:%d\n"),
file, line);
fprintf (stderr, _("Please report this bug.\n"));
xexit (EXIT_FAILURE);
/contrib/toolchain/binutils/gas/obj.h
1,8 → 1,7
/* obj.h - defines the object dependent hooks for all object
format backends.
 
Copyright 1987, 1990, 1991, 1992, 1993, 1995, 1996, 1997, 1999, 2000,
2002, 2003, 2004, 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/output-file.c
1,6 → 1,5
/* output-file.c - Deal with the output file
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001,
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/output-file.h
1,7 → 1,6
/* This file is output-file.h
 
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 2003, 2005, 2007
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/read.c
1,7 → 1,5
/* read.c - read a source file -
Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011, 2012 Free Software Foundation, Inc.
Copyright (C) 1986-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
43,7 → 41,7
#include "wchar.h"
 
#ifndef TC_START_LABEL
#define TC_START_LABEL(x,y,z) (x == ':')
#define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR) (NEXT_CHAR == ':')
#endif
 
/* Set by the object-format or the target. */
265,8 → 263,11
obstack_begin (&notes, chunksize);
obstack_begin (&cond_obstack, chunksize);
 
#ifndef tc_line_separator_chars
#define tc_line_separator_chars line_separator_chars
#endif
/* Use machine dependent syntax. */
for (p = line_separator_chars; *p; p++)
for (p = tc_line_separator_chars; *p; p++)
is_end_of_line[(unsigned char) *p] = 2;
/* Use more. FIXME-SOMEDAY. */
 
556,10 → 557,11
cfi_pop_insert ();
}
#define HANDLE_CONDITIONAL_ASSEMBLY() \
#define HANDLE_CONDITIONAL_ASSEMBLY(num_read) \
if (ignore_input ()) \
{ \
char *eol = find_end_of_line (input_line_pointer, flag_m68k_mri); \
char *eol = find_end_of_line (input_line_pointer - (num_read), \
flag_m68k_mri); \
input_line_pointer = (input_line_pointer <= buffer_limit \
&& eol >= buffer_limit) \
? buffer_limit \
739,7 → 741,8
void
read_a_source_file (char *name)
{
char c;
char nul_char;
char next_char;
char *s; /* String of symbol, '\0' appended. */
int temp;
pseudo_typeS *pop;
826,16 → 829,18
 
if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
{
next_char = * input_line_pointer;
/* Text at the start of a line must be a label, we
run down and stick a colon in. */
if (is_name_beginner (*input_line_pointer))
if (is_name_beginner (next_char) || next_char == '"')
{
char *line_start = input_line_pointer;
char *line_start;
int mri_line_macro;
 
HANDLE_CONDITIONAL_ASSEMBLY ();
HANDLE_CONDITIONAL_ASSEMBLY (0);
 
c = get_symbol_end ();
nul_char = get_symbol_name (& line_start);
next_char = (nul_char == '"' ? input_line_pointer[1] : nul_char);
 
/* In MRI mode, the EQU and MACRO pseudoops must
be handled specially. */
869,8 → 874,7
symbol in the symbol table. */
if (!mri_line_macro
#ifdef TC_START_LABEL_WITHOUT_COLON
&& TC_START_LABEL_WITHOUT_COLON(c,
input_line_pointer)
&& TC_START_LABEL_WITHOUT_COLON (nul_char, next_char)
#endif
)
line_label = colon (line_start);
880,8 → 884,8
(valueT) 0,
&zero_address_frag);
 
*input_line_pointer = c;
if (c == ':')
next_char = restore_line_pointer (nul_char);
if (next_char == ':')
input_line_pointer++;
}
}
896,30 → 900,32
Each test is independent of all other tests at the (top)
level. */
do
c = *input_line_pointer++;
while (c == '\t' || c == ' ' || c == '\f');
nul_char = next_char = *input_line_pointer++;
while (next_char == '\t' || next_char == ' ' || next_char == '\f');
 
/* C is the 1st significant character.
Input_line_pointer points after that character. */
if (is_name_beginner (c))
if (is_name_beginner (next_char) || next_char == '"')
{
char *rest;
 
/* Want user-defined label or pseudo/opcode. */
HANDLE_CONDITIONAL_ASSEMBLY ();
HANDLE_CONDITIONAL_ASSEMBLY (1);
 
s = --input_line_pointer;
c = get_symbol_end (); /* name's delimiter. */
--input_line_pointer;
nul_char = get_symbol_name (& s); /* name's delimiter. */
next_char = (nul_char == '"' ? input_line_pointer[1] : nul_char);
rest = input_line_pointer + (nul_char == '"' ? 2 : 1);
 
/* C is character after symbol.
That character's place in the input line is now '\0'.
/* NEXT_CHAR is character after symbol.
The end of symbol in the input line is now '\0'.
S points to the beginning of the symbol.
[In case of pseudo-op, s->'.'.]
Input_line_pointer->'\0' where c was. */
if (TC_START_LABEL (c, s, input_line_pointer))
Input_line_pointer->'\0' where NUL_CHAR was. */
if (TC_START_LABEL (s, nul_char, next_char))
{
if (flag_m68k_mri)
{
char *rest = input_line_pointer + 1;
 
/* In MRI mode, \tsym: set 0 is permitted. */
if (*rest == ':')
++rest;
938,8 → 944,8
}
 
line_label = colon (s); /* User-defined label. */
/* Put ':' back for error messages' sake. */
*input_line_pointer++ = ':';
restore_line_pointer (nul_char);
++ input_line_pointer;
#ifdef tc_check_label
tc_check_label (line_label);
#endif
946,19 → 952,19
/* Input_line_pointer->after ':'. */
SKIP_WHITESPACE ();
}
else if ((c == '=' && input_line_pointer[1] == '=')
|| ((c == ' ' || c == '\t')
&& input_line_pointer[1] == '='
&& input_line_pointer[2] == '='))
else if ((next_char == '=' && *rest == '=')
|| ((next_char == ' ' || next_char == '\t')
&& rest[0] == '='
&& rest[1] == '='))
{
equals (s, -1);
demand_empty_rest_of_line ();
}
else if ((c == '='
|| ((c == ' ' || c == '\t')
&& input_line_pointer[1] == '='))
else if ((next_char == '='
|| ((next_char == ' ' || next_char == '\t')
&& *rest == '='))
#ifdef TC_EQUAL_IN_INSN
&& !TC_EQUAL_IN_INSN (c, s)
&& !TC_EQUAL_IN_INSN (next_char, s)
#endif
)
{
998,7 → 1004,7
{
/* PSEUDO - OP.
 
WARNING: c has next char, which may be end-of-line.
WARNING: next_char may be end-of-line.
We lookup the pseudo-op table with s+1 because we
already know that the pseudo-op begins with a '.'. */
 
1043,25 → 1049,25
{
char *end = input_line_pointer;
 
*input_line_pointer = c;
(void) restore_line_pointer (nul_char);
s_ignore (0);
c = *--input_line_pointer;
nul_char = next_char = *--input_line_pointer;
*input_line_pointer = '\0';
if (! macro_defined || ! try_macro (c, s))
if (! macro_defined || ! try_macro (next_char, s))
{
*end = '\0';
as_bad (_("unknown pseudo-op: `%s'"), s);
*input_line_pointer++ = c;
*input_line_pointer++ = nul_char;
}
continue;
}
 
/* Put it back for error messages etc. */
*input_line_pointer = c;
next_char = restore_line_pointer (nul_char);
/* The following skip of whitespace is compulsory.
A well shaped space is sometimes all that separates
keyword from operands. */
if (c == ' ' || c == '\t')
if (next_char == ' ' || next_char == '\t')
input_line_pointer++;
 
/* Input_line is restored.
1075,16 → 1081,16
}
else
{
/* WARNING: c has char, which may be end-of-line. */
/* Also: input_line_pointer->`\0` where c was. */
*input_line_pointer = c;
/* WARNING: next_char may be end-of-line. */
/* Also: input_line_pointer->`\0` where nul_char was. */
(void) restore_line_pointer (nul_char);
input_line_pointer = _find_end_of_line (input_line_pointer, flag_m68k_mri, 1, 0);
c = *input_line_pointer;
next_char = nul_char = *input_line_pointer;
*input_line_pointer = '\0';
 
generate_lineno_debug ();
 
if (macro_defined && try_macro (c, s))
if (macro_defined && try_macro (next_char, s))
continue;
 
if (mri_pending_align)
1100,7 → 1106,7
 
assemble_one (s); /* Assemble 1 instruction. */
 
*input_line_pointer++ = c;
*input_line_pointer++ = nul_char;
 
/* We resume loop AFTER the end-of-line from
this instruction. */
1110,18 → 1116,21
}
 
/* Empty statement? */
if (is_end_of_line[(unsigned char) c])
if (is_end_of_line[(unsigned char) next_char])
continue;
 
if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (next_char))
{
/* local label ("4:") */
char *backup = input_line_pointer;
 
HANDLE_CONDITIONAL_ASSEMBLY ();
HANDLE_CONDITIONAL_ASSEMBLY (1);
 
temp = c - '0';
temp = next_char - '0';
 
if (nul_char == '"')
++ input_line_pointer;
 
/* Read the whole number. */
while (ISDIGIT (*input_line_pointer))
{
1154,9 → 1163,9
}
 
input_line_pointer = backup;
} /* local label ("4:") */
}
 
if (c && strchr (line_comment_chars, c))
if (next_char && strchr (line_comment_chars, next_char))
{ /* Its a comment. Better say APP or NO_APP. */
sb sbuf;
char *ends;
1265,10 → 1274,10
continue;
}
 
HANDLE_CONDITIONAL_ASSEMBLY ();
HANDLE_CONDITIONAL_ASSEMBLY (1);
 
#ifdef tc_unrecognized_line
if (tc_unrecognized_line (c))
if (tc_unrecognized_line (next_char))
continue;
#endif
input_line_pointer--;
1469,6 → 1478,11
{
align = get_absolute_expression ();
SKIP_WHITESPACE ();
 
#ifdef TC_ALIGN_ZERO_IS_DEFAULT
if (arg > 0 && align == 0)
align = arg;
#endif
}
 
if (bytes_p)
1577,7 → 1591,7
 
/* Switch in and out of alternate macro mode. */
 
void
static void
s_altmacro (int on)
{
demand_empty_rest_of_line ();
1598,7 → 1612,7
If a symbol name could not be read, the routine issues an error
messages, skips to the end of the line and returns NULL. */
 
static char *
char *
read_symbol_name (void)
{
char * name;
1703,7 → 1717,7
 
temp = get_absolute_expr (&exp);
size = temp;
size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
size &= ((addressT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
if (exp.X_op == O_absent)
{
as_bad (_("missing size expression"));
1793,7 → 1807,7
 
name = input_line_pointer;
if (!ISDIGIT (*name))
c = get_symbol_end ();
c = get_symbol_name (& name);
else
{
do
1816,7 → 1830,7
}
 
sym = symbol_find_or_make (name);
*input_line_pointer = c;
c = restore_line_pointer (c);
if (alc != NULL)
free (alc);
 
2336,8 → 2350,7
char *s;
char c;
 
s = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& s);
if (strcasecmp (s, "discard") == 0)
type = LINKONCE_DISCARD;
else if (strcasecmp (s, "one_only") == 0)
2349,7 → 2362,7
else
as_warn (_("unrecognized .linkonce type `%s'"), s);
 
*input_line_pointer = c;
(void) restore_line_pointer (c);
}
 
#ifdef obj_handle_link_once
2843,7 → 2856,7
 
name = input_line_pointer;
if (!ISDIGIT (*name))
c = get_symbol_end ();
c = get_symbol_name (& name);
else
{
do
2858,11 → 2871,11
 
name = xstrdup (name);
 
*input_line_pointer = c;
c = restore_line_pointer (c);
 
seg = subseg_new (name, 0);
 
if (*input_line_pointer == ',')
if (c == ',')
{
int align;
 
2917,16 → 2930,15
 
SKIP_WHITESPACE ();
 
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& name);
 
name = xstrdup (name);
 
*input_line_pointer = c;
c = restore_line_pointer (c);
 
seg = subseg_new (name, 0);
 
if (*input_line_pointer != ',')
if (c != ',')
*type = 'C';
else
{
2934,8 → 2946,7
 
++input_line_pointer;
SKIP_WHITESPACE ();
sectype = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& sectype);
if (*sectype == '\0')
*type = 'C';
else if (strcasecmp (sectype, "text") == 0)
2946,7 → 2957,7
*type = 'R';
else
as_warn (_("unrecognized section type `%s'"), sectype);
*input_line_pointer = c;
(void) restore_line_pointer (c);
}
 
if (*input_line_pointer == ',')
2955,8 → 2966,7
 
++input_line_pointer;
SKIP_WHITESPACE ();
seccmd = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& seccmd);
if (strcasecmp (seccmd, "absolute") == 0)
{
as_bad (_("absolute sections are not supported"));
2968,7 → 2978,7
{
int align;
 
*input_line_pointer = c;
(void) restore_line_pointer (c);
align = get_absolute_expression ();
record_alignment (seg, align);
}
2975,7 → 2985,7
else
{
as_warn (_("unrecognized section command `%s'"), seccmd);
*input_line_pointer = c;
(void) restore_line_pointer (c);
}
}
 
3021,11 → 3031,10
char c;
 
SKIP_WHITESPACE ();
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& name);
delete_macro (name);
*input_line_pointer = c;
SKIP_WHITESPACE ();
SKIP_WHITESPACE_AFTER_NAME ();
}
while (*input_line_pointer++ == ',');
 
3186,7 → 3195,7
symbol_set_frag (symbolP, dummy_frag);
}
#endif
#ifdef OBJ_COFF
#if defined (OBJ_COFF) && !defined (TE_PE)
/* "set" symbols are local unless otherwise specified. */
SF_SET_LOCAL (symbolP);
#endif
3850,12 → 3859,14
 
#ifndef TC_PARSE_CONS_EXPRESSION
#ifdef BITFIELD_CONS_EXPRESSIONS
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES)
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \
(parse_bitfield_cons (EXP, NBYTES), TC_PARSE_CONS_RETURN_NONE)
static void
parse_bitfield_cons (expressionS *exp, unsigned int nbytes);
#endif
#ifdef REPEAT_CONS_EXPRESSIONS
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES)
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \
(parse_repeat_cons (EXP, NBYTES), TC_PARSE_CONS_RETURN_NONE)
static void
parse_repeat_cons (expressionS *exp, unsigned int nbytes);
#endif
3862,7 → 3873,8
 
/* If we haven't gotten one yet, just call expression. */
#ifndef TC_PARSE_CONS_EXPRESSION
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP)
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \
(expression (EXP), TC_PARSE_CONS_RETURN_NONE)
#endif
#endif
 
3870,7 → 3882,7
do_parse_cons_expression (expressionS *exp,
int nbytes ATTRIBUTE_UNUSED)
{
TC_PARSE_CONS_EXPRESSION (exp, nbytes);
(void) TC_PARSE_CONS_EXPRESSION (exp, nbytes);
}
 
 
3913,6 → 3925,14
c = 0;
do
{
TC_PARSE_CONS_RETURN_TYPE ret = TC_PARSE_CONS_RETURN_NONE;
#ifdef TC_CONS_FIX_CHECK
fixS **cur_fix = &frchain_now->fix_tail;
 
if (*cur_fix != NULL)
cur_fix = &(*cur_fix)->fx_next;
#endif
 
#ifdef TC_M68K
if (flag_m68k_mri)
parse_mri_cons (&exp, (unsigned int) nbytes);
3919,6 → 3939,7
else
#endif
{
#if 0
if (*input_line_pointer == '"')
{
as_bad (_("unexpected `\"' in expression"));
3925,7 → 3946,8
ignore_rest_of_line ();
return;
}
TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
#endif
ret = TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
}
 
if (rva)
3935,7 → 3957,10
else
as_fatal (_("rva without symbol"));
}
emit_expr (&exp, (unsigned int) nbytes);
emit_expr_with_reloc (&exp, (unsigned int) nbytes, ret);
#ifdef TC_CONS_FIX_CHECK
TC_CONS_FIX_CHECK (&exp, nbytes, *cur_fix);
#endif
++c;
}
while (*input_line_pointer++ == ',');
3968,7 → 3993,7
 
/* .reloc offset, reloc_name, symbol+addend. */
 
void
static void
s_reloc (int ignore ATTRIBUTE_UNUSED)
{
char *stop = NULL;
3977,6 → 4002,14
char *r_name;
int c;
struct reloc_list *reloc;
struct _bfd_rel { char *name; bfd_reloc_code_real_type code; };
static struct _bfd_rel bfd_relocs[] = {
{ "NONE", BFD_RELOC_NONE },
{ "8", BFD_RELOC_8 },
{ "16", BFD_RELOC_16 },
{ "32", BFD_RELOC_32 },
{ "64", BFD_RELOC_64 }
};
 
reloc = (struct reloc_list *) xmalloc (sizeof (*reloc));
 
4017,8 → 4050,20
 
++input_line_pointer;
SKIP_WHITESPACE ();
r_name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (& r_name);
if (strncasecmp (r_name, "BFD_RELOC_", 10) == 0)
{
unsigned int i;
 
for (reloc->u.a.howto = NULL, i = 0; i < ARRAY_SIZE (bfd_relocs); i++)
if (strcasecmp (r_name + 10, bfd_relocs[i].name) == 0)
{
reloc->u.a.howto = bfd_reloc_type_lookup (stdoutput,
bfd_relocs[i].code);
break;
}
}
else
reloc->u.a.howto = bfd_reloc_name_lookup (stdoutput, r_name);
*input_line_pointer = c;
if (reloc->u.a.howto == NULL)
4028,7 → 4073,7
}
 
exp.X_op = O_absent;
SKIP_WHITESPACE ();
SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer == ',')
{
++input_line_pointer;
4079,6 → 4124,14
void
emit_expr (expressionS *exp, unsigned int nbytes)
{
emit_expr_with_reloc (exp, nbytes, TC_PARSE_CONS_RETURN_NONE);
}
 
void
emit_expr_with_reloc (expressionS *exp,
unsigned int nbytes,
TC_PARSE_CONS_RETURN_TYPE reloc)
{
operatorT op;
char *p;
valueT extra_digit = 0;
4220,6 → 4273,12
 
p = frag_more ((int) nbytes);
 
if (reloc != TC_PARSE_CONS_RETURN_NONE)
{
emit_expr_fix (exp, nbytes, frag_now, p, reloc);
return;
}
 
#ifndef WORKING_DOT_WORD
/* If we have the difference of two symbols in a word, save it on
the broken_words list. See the code in write.c. */
4378,24 → 4437,42
}
}
else
emit_expr_fix (exp, nbytes, frag_now, p);
emit_expr_fix (exp, nbytes, frag_now, p, TC_PARSE_CONS_RETURN_NONE);
}
 
void
emit_expr_fix (expressionS *exp, unsigned int nbytes, fragS *frag, char *p)
emit_expr_fix (expressionS *exp, unsigned int nbytes, fragS *frag, char *p,
TC_PARSE_CONS_RETURN_TYPE r ATTRIBUTE_UNUSED)
{
memset (p, 0, nbytes);
int offset = 0;
unsigned int size = nbytes;
 
memset (p, 0, size);
 
/* Generate a fixS to record the symbol value. */
 
#ifdef TC_CONS_FIX_NEW
TC_CONS_FIX_NEW (frag, p - frag->fr_literal, nbytes, exp);
TC_CONS_FIX_NEW (frag, p - frag->fr_literal + offset, size, exp, r);
#else
if (r != TC_PARSE_CONS_RETURN_NONE)
{
bfd_reloc_code_real_type r;
reloc_howto_type *reloc_howto;
 
switch (nbytes)
reloc_howto = bfd_reloc_type_lookup (stdoutput, r);
size = bfd_get_reloc_size (reloc_howto);
 
if (size > nbytes)
{
as_bad (_("%s relocations do not fit in %u bytes\n"),
reloc_howto->name, nbytes);
return;
}
else if (target_big_endian)
offset = nbytes - size;
}
else
switch (size)
{
case 1:
r = BFD_RELOC_8;
break;
4412,13 → 4489,11
r = BFD_RELOC_64;
break;
default:
as_bad (_("unsupported BFD relocation size %u"), nbytes);
r = BFD_RELOC_32;
break;
as_bad (_("unsupported BFD relocation size %u"), size);
return;
}
fix_new_exp (frag, p - frag->fr_literal, (int) nbytes, exp,
0, r);
}
fix_new_exp (frag, p - frag->fr_literal + offset, size,
exp, 0, r);
#endif
}
4527,7 → 4602,7
return;
} /* Too complex. */
 
value |= ((~(-1 << width) & exp->X_add_number)
value |= ((~(-(1 << width)) & exp->X_add_number)
<< ((BITS_PER_CHAR * nbytes) - bits_available));
 
if ((bits_available -= width) == 0
4554,15 → 4629,13
 
#ifdef TC_M68K
static void
parse_mri_cons (exp, nbytes)
expressionS *exp;
unsigned int nbytes;
parse_mri_cons (expressionS *exp, unsigned int nbytes)
{
if (*input_line_pointer != '\''
&& (input_line_pointer[1] != '\''
|| (*input_line_pointer != 'A'
&& *input_line_pointer != 'E')))
TC_PARSE_CONS_EXPRESSION (exp, nbytes);
(void) TC_PARSE_CONS_EXPRESSION (exp, nbytes);
else
{
unsigned int scan;
5019,7 → 5092,7
{
/* Sign-extend VAL. */
if (val & (1 << (loaded - 1)))
val |= ~0 << loaded;
val |= ~0U << loaded;
if (orig)
*p = val & 0x7f;
p++;
5342,7 → 5415,7
 
#ifndef NO_STRING_ESCAPES
case '\\':
switch (c = *input_line_pointer++)
switch (c = *input_line_pointer++ & CHAR_MASK)
{
case 'b':
c = '\b';
5393,7 → 5466,7
number = number * 8 + c - '0';
}
 
c = number & 0xff;
c = number & CHAR_MASK;
}
--input_line_pointer;
break;
5415,7 → 5488,7
number = number * 16 + c - 'a' + 10;
c = *input_line_pointer++;
}
c = number & 0xff;
c = number & CHAR_MASK;
--input_line_pointer;
}
break;
5794,7 → 5867,7
{
include_dir_count++;
include_dirs =
(char **) realloc (include_dirs,
(char **) xrealloc (include_dirs,
include_dir_count * sizeof (*include_dirs));
}
 
5887,11 → 5960,10
return;
}
 
name = input_line_pointer;
delim1 = get_symbol_end ();
delim1 = get_symbol_name (& name);
name = xstrdup (name);
*input_line_pointer = delim1;
SKIP_WHITESPACE ();
SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',')
{
if (default_prefix)
5917,10 → 5989,9
{
++input_line_pointer;
SKIP_WHITESPACE ();
label = input_line_pointer;
delim2 = get_symbol_end ();
delim2 = get_symbol_name (& label);
label = xstrdup (label);
*input_line_pointer = delim2;
restore_line_pointer (delim2);
}
 
if (debug_type == DEBUG_STABS)
6095,7 → 6166,7
}
if (inquote)
as_warn (_("missing closing `%c'"), inquote);
if (inescape)
if (inescape && !ignore_input ())
as_warn (_("stray `\\'"));
return s;
}
/contrib/toolchain/binutils/gas/read.h
1,7 → 1,5
/* read.h - of read.c
Copyright 1986, 1990, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2012
Free Software Foundation, Inc.
Copyright (C) 1986-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
35,6 → 33,16
#define SKIP_WHITESPACE() know(*input_line_pointer != ' ' )
#endif
 
#define SKIP_WHITESPACE_AFTER_NAME() \
do \
{ \
if (* input_line_pointer == '"') \
++ input_line_pointer; \
if (* input_line_pointer == ' ') \
++ input_line_pointer; \
} \
while (0)
 
#define LEX_NAME (1) /* may continue a name */
#define LEX_BEGIN_NAME (2) /* may begin a name */
#define LEX_END_NAME (4) /* ends a name */
95,6 → 103,11
extern char original_case_string[];
#endif
 
#ifndef TC_PARSE_CONS_RETURN_TYPE
#define TC_PARSE_CONS_RETURN_TYPE bfd_reloc_code_real_type
#define TC_PARSE_CONS_RETURN_NONE BFD_RELOC_NONE
#endif
 
extern void pop_insert (const pseudo_typeS *);
extern unsigned int get_stab_string_offset
(const char *string, const char *stabstr_secname);
111,7 → 124,10
extern void cons (int nbytes);
extern void demand_empty_rest_of_line (void);
extern void emit_expr (expressionS *exp, unsigned int nbytes);
extern void emit_expr_fix (expressionS *, unsigned int, fragS *, char *);
extern void emit_expr_with_reloc (expressionS *exp, unsigned int nbytes,
TC_PARSE_CONS_RETURN_TYPE);
extern void emit_expr_fix (expressionS *, unsigned int, fragS *, char *,
TC_PARSE_CONS_RETURN_TYPE);
extern void equals (char *sym_name, int reassign);
extern void float_cons (int float_type);
extern void ignore_rest_of_line (void);
121,6 → 137,7
extern void read_a_source_file (char *name);
extern void read_begin (void);
extern void read_print_statistics (FILE *);
extern char *read_symbol_name (void);
extern int sizeof_leb128 (valueT, int sign);
extern void stabs_generate_asm_file (void);
extern void stabs_generate_asm_lineno (void);
/contrib/toolchain/binutils/gas/remap.c
1,5 → 1,5
/* Remap file names for debug info for GNU assembler.
Copyright 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/sb.c
1,6 → 1,5
/* sb.c - string buffer manipulation routines
Copyright 1994, 1995, 2000, 2003, 2005, 2006, 2007, 2009, 2012
Free Software Foundation, Inc.
Copyright (C) 1994-2015 Free Software Foundation, Inc.
 
Written by Steve and Judy Chamberlain of Cygnus Support,
sac@cygnus.com
/contrib/toolchain/binutils/gas/sb.h
1,6 → 1,5
/* sb.h - header file for string buffer manipulation routines
Copyright 1994, 1995, 2000, 2003, 2005, 2006, 2007, 2012
Free Software Foundation, Inc.
Copyright (C) 1994-2015 Free Software Foundation, Inc.
 
Written by Steve and Judy Chamberlain of Cygnus Support,
sac@cygnus.com
/contrib/toolchain/binutils/gas/stabs.c
1,6 → 1,5
/* Generic stabs parsing for gas.
Copyright 1989, 1990, 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2001
2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
Copyright (C) 1989-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
458,11 → 457,10
symbolS *symbolP;
int temp;
 
name = input_line_pointer;
c = get_symbol_end ();
c = get_symbol_name (&name);
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE ();
SKIP_WHITESPACE_AFTER_NAME ();
if (*input_line_pointer != ',')
{
*p = 0;
/contrib/toolchain/binutils/gas/struc-symbol.h
1,6 → 1,5
/* struct_symbol.h - Internal symbol structure
Copyright 1987, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2005,
2007, 2008, 2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/subsegs.c
1,7 → 1,5
/* subsegs.c - subsegments -
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
57,7 → 55,7
* segment context correct.
*/
void
subseg_change (register segT seg, register int subseg)
subseg_change (segT seg, int subseg)
{
segment_info_type *seginfo = seg_info (seg);
now_seg = seg;
/contrib/toolchain/binutils/gas/subsegs.h
1,6 → 1,5
/* subsegs.h -> subsegs.c
Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2003, 2005,
2006, 2007, 2009 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
91,6 → 90,9
this section. sym->bsym and bfd_section->symbol should be the same. */
symbolS *sym;
 
/* Used by dwarf2dbg.c for this section's line table entries. */
void *dwarf2_line_seg;
 
union {
/* Current size of section holding stabs strings. */
unsigned long stab_string_size;
/contrib/toolchain/binutils/gas/symbols.c
1,7 → 1,5
/* symbols.c -symbol table-
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
106,7 → 104,7
static char *
save_symbol_name (const char *name)
{
unsigned int name_length;
size_t name_length;
char *ret;
 
name_length = strlen (name) + 1; /* +1 for \0. */
267,7 → 265,7
const char *sym_name /* Symbol name, as a cannonical string. */
/* We copy this string: OK to alter later. */)
{
register symbolS *symbolP; /* Symbol we are working with. */
symbolS *symbolP; /* Symbol we are working with. */
 
/* Sun local labels go out of scope whenever a non-local symbol is
defined. */
484,7 → 482,7
void
symbol_table_insert (symbolS *symbolP)
{
register const char *error_string;
const char *error_string;
 
know (symbolP);
know (S_GET_NAME (symbolP));
512,7 → 510,7
symbolS *
symbol_find_or_make (const char *name)
{
register symbolS *symbolP;
symbolS *symbolP;
 
symbolP = symbol_find (name);
 
1664,14 → 1662,14
of ^A. */
 
char * /* Return local label name. */
dollar_label_name (register long n, /* we just saw "n$:" : n a number. */
register int augend /* 0 for current instance, 1 for new instance. */)
dollar_label_name (long n, /* we just saw "n$:" : n a number. */
int augend /* 0 for current instance, 1 for new instance. */)
{
long i;
/* Returned to caller, then copied. Used for created names ("4f"). */
static char symbol_name_build[24];
register char *p;
register char *q;
char *p;
char *q;
char symbol_name_temporary[20]; /* Build up a number, BACKWARDS. */
 
know (n >= 0);
1837,8 → 1835,8
long i;
/* Returned to caller, then copied. Used for created names ("4f"). */
static char symbol_name_build[24];
register char *p;
register char *q;
char *p;
char *q;
char symbol_name_temporary[20]; /* Build up a number, BACKWARDS. */
 
know (n >= 0);
/contrib/toolchain/binutils/gas/symbols.h
1,6 → 1,5
/* symbols.h -
Copyright 1987, 1990, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/tc.h
1,8 → 1,6
/* tc.h - target cpu dependent
 
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 2000, 2001, 2003,
2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
/contrib/toolchain/binutils/gas/write.c
1,7 → 1,5
/* write.c - emit .o file
Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011, 2012 Free Software Foundation, Inc.
Copyright (C) 1986-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
838,7 → 836,8
if (symsec == NULL)
abort ();
 
if (bfd_is_abs_section (symsec))
if (bfd_is_abs_section (symsec)
|| symsec == reg_section)
{
/* The fixup_segment routine normally will not use this
symbol in a relocation. */
1185,6 → 1184,11
&& r->u.b.r.address < f->fr_address + f->fr_fix)
return f;
 
for (f = seginfo->frchainP->frch_root; f != NULL; f = f->fr_next)
if (f->fr_address <= r->u.b.r.address
&& r->u.b.r.address <= f->fr_address + f->fr_fix)
return f;
 
as_bad_where (r->file, r->line,
_("reloc not within (fixed part of) section"));
return NULL;
1409,6 → 1413,7
struct z_stream_s *strm;
int x;
flagword flags = bfd_get_section_flags (abfd, sec);
unsigned int header_size, compression_header_size;
 
if (seginfo == NULL
|| sec->size < 32
1423,27 → 1428,32
if (strm == NULL)
return;
 
/* Create a new frag to contain the "ZLIB" header. */
if (flag_compress_debug == COMPRESS_DEBUG_GABI_ZLIB)
{
stdoutput->flags |= BFD_COMPRESS | BFD_COMPRESS_GABI;
compression_header_size
= bfd_get_compression_header_size (stdoutput, NULL);
header_size = compression_header_size;
}
else
{
stdoutput->flags |= BFD_COMPRESS;
compression_header_size = 0;
header_size = 12;
}
 
/* Create a new frag to contain the compression header. */
first_newf = frag_alloc (ob);
if (obstack_room (ob) < 12)
if (obstack_room (ob) < header_size)
first_newf = frag_alloc (ob);
if (obstack_room (ob) < 12)
as_fatal (_("can't extend frag %u chars"), 12);
if (obstack_room (ob) < header_size)
as_fatal (_("can't extend frag %u chars"), header_size);
last_newf = first_newf;
obstack_blank_fast (ob, 12);
obstack_blank_fast (ob, header_size);
last_newf->fr_type = rs_fill;
last_newf->fr_fix = 12;
last_newf->fr_fix = header_size;
header = last_newf->fr_literal;
memcpy (header, "ZLIB", 4);
header[11] = uncompressed_size; uncompressed_size >>= 8;
header[10] = uncompressed_size; uncompressed_size >>= 8;
header[9] = uncompressed_size; uncompressed_size >>= 8;
header[8] = uncompressed_size; uncompressed_size >>= 8;
header[7] = uncompressed_size; uncompressed_size >>= 8;
header[6] = uncompressed_size; uncompressed_size >>= 8;
header[5] = uncompressed_size; uncompressed_size >>= 8;
header[4] = uncompressed_size;
compressed_size = 12;
compressed_size = header_size;
 
/* Stream the frags through the compression engine, adding new frags
as necessary to accomodate the compressed output. */
1522,13 → 1532,21
break;
}
 
/* PR binutils/18087: If compression didn't make the section smaller,
just keep it uncompressed. */
if (compressed_size >= uncompressed_size)
return;
 
/* Replace the uncompressed frag list with the compressed frag list. */
seginfo->frchainP->frch_root = first_newf;
seginfo->frchainP->frch_last = last_newf;
 
/* Update the section size and its name. */
bfd_update_compression_header (abfd, (bfd_byte *) header, sec);
x = bfd_set_section_size (abfd, sec, compressed_size);
gas_assert (x);
if (!compression_header_size)
{
compressed_name = (char *) xmalloc (strlen (section_name) + 2);
compressed_name[0] = '.';
compressed_name[1] = 'z';
1535,6 → 1553,7
strcpy (compressed_name + 2, section_name + 1);
bfd_section_name (stdoutput, sec) = compressed_name;
}
}
 
static void
write_contents (bfd *abfd ATTRIBUTE_UNUSED,
1566,7 → 1585,9
f->fr_literal, (file_ptr) offset,
(bfd_size_type) f->fr_fix);
if (!x)
as_fatal (_("can't write %s: %s"), stdoutput->filename,
as_fatal (_("can't write %ld bytes to section %s of %s because: '%s'"),
(long) f->fr_fix, sec->name,
stdoutput->filename,
bfd_errmsg (bfd_get_error ()));
offset += f->fr_fix;
}
1587,7 → 1608,9
(file_ptr) offset,
(bfd_size_type) fill_size);
if (!x)
as_fatal (_("can't write %s: %s"), stdoutput->filename,
as_fatal (_("can't fill %ld bytes in section %s of %s because '%s'"),
(long) fill_size, sec->name,
stdoutput->filename,
bfd_errmsg (bfd_get_error ()));
offset += fill_size;
}
1617,7 → 1640,8
(stdoutput, sec, buf, (file_ptr) offset,
(bfd_size_type) n_per_buf * fill_size);
if (!x)
as_fatal (_("cannot write to output file '%s': %s"),
as_fatal (_("cannot fill %ld bytes in section %s of %s because: '%s'"),
(long)(n_per_buf * fill_size), sec->name,
stdoutput->filename,
bfd_errmsg (bfd_get_error ()));
offset += n_per_buf * fill_size;
1688,23 → 1712,21
of the section. This allows proper nop-filling at the end of
code-bearing sections. */
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) \
(!(FRCHAIN)->frch_next ? get_recorded_alignment (SEG) : 0)
(!(FRCHAIN)->frch_next && subseg_text_p (SEG) \
? get_recorded_alignment (SEG) \
: 0)
#else
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
#endif
#endif
 
void
subsegs_finish (void)
static void
subsegs_finish_section (asection *s)
{
struct frchain *frchainP;
asection *s;
 
for (s = stdoutput->sections; s; s = s->next)
{
segment_info_type *seginfo = seg_info (s);
if (!seginfo)
continue;
return;
 
for (frchainP = seginfo->frchainP;
frchainP != NULL;
1731,6 → 1753,7
++entalign;
entsize >>= 1;
}
 
if (entalign > alignment)
alignment = entalign;
}
1751,8 → 1774,46
know (frag_now->fr_next == NULL);
}
}
 
static void
subsegs_finish (void)
{
asection *s;
 
for (s = stdoutput->sections; s; s = s->next)
subsegs_finish_section (s);
}
 
#ifdef OBJ_ELF
static void
create_obj_attrs_section (void)
{
segT s;
char *p;
offsetT size;
const char *name;
 
size = bfd_elf_obj_attr_size (stdoutput);
if (size)
{
name = get_elf_backend_data (stdoutput)->obj_attrs_section;
if (!name)
name = ".gnu.attributes";
s = subseg_new (name, 0);
elf_section_type (s)
= get_elf_backend_data (stdoutput)->obj_attrs_section_type;
bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA);
frag_now_fix ();
p = frag_more (size);
bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size);
 
subsegs_finish_section (s);
relax_segment (seg_info (s)->frchainP->frch_root, s, 0);
size_seg (stdoutput, s, NULL);
}
}
#endif
 
/* Write the object file. */
 
void
1763,33 → 1824,12
fragS *fragP; /* Track along all frags. */
#endif
 
subsegs_finish ();
 
#ifdef md_pre_output_hook
md_pre_output_hook;
#endif
 
/* Do we really want to write it? */
{
int n_warns, n_errs;
n_warns = had_warnings ();
n_errs = had_errors ();
/* The -Z flag indicates that an object file should be generated,
regardless of warnings and errors. */
if (flag_always_generate_output)
{
if (n_warns || n_errs)
as_warn (_("%d error%s, %d warning%s, generating bad object file"),
n_errs, n_errs == 1 ? "" : "s",
n_warns, n_warns == 1 ? "" : "s");
}
else
{
if (n_errs)
as_fatal (_("%d error%s, %d warning%s, no object file generated"),
n_errs, n_errs == 1 ? "" : "s",
n_warns, n_warns == 1 ? "" : "s");
}
}
 
#ifdef md_pre_relax_hook
md_pre_relax_hook;
#endif
1866,6 → 1906,11
md_post_relax_hook;
#endif
 
#ifdef OBJ_ELF
if (IS_ELF)
create_obj_attrs_section ();
#endif
 
#ifndef WORKING_DOT_WORD
{
struct broken_word *lie;
1885,7 → 1930,7
#ifdef TC_CONS_FIX_NEW
TC_CONS_FIX_NEW (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
2, &exp);
2, &exp, TC_PARSE_CONS_RETURN_NONE);
#else
fix_new_exp (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
2286,13 → 2331,13
/* Relax_align. Advance location counter to next address that has 'alignment'
lowest order bits all 0s, return size of adjustment made. */
static relax_addressT
relax_align (register relax_addressT address, /* Address now. */
register int alignment /* Alignment (binary). */)
relax_align (relax_addressT address, /* Address now. */
int alignment /* Alignment (binary). */)
{
relax_addressT mask;
relax_addressT new_address;
 
mask = ~((~0) << alignment);
mask = ~((relax_addressT) ~0 << alignment);
new_address = (address + mask) & (~mask);
#ifdef LINKER_RELAXING_SHRINKS_ONLY
if (linkrelax)
/contrib/toolchain/binutils/gas/write.h
1,7 → 1,5
/* write.h
Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
2002, 2003, 2005, 2006, 2007
Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
This file is part of GAS, the GNU Assembler.
 
171,7 → 169,6
extern void append (char **charPP, char *fromP, unsigned long length);
extern void record_alignment (segT seg, int align);
extern int get_recorded_alignment (segT seg);
extern void subsegs_finish (void);
extern void write_object_file (void);
extern long relax_frag (segT, fragS *, long);
extern int relax_segment (struct frag *, segT, int);