aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-04-12 09:04:15 +0200
committerJan Beulich <jbeulich@suse.com>2022-04-12 09:04:15 +0200
commitc39e89c3aaa3a6790f85e80f2da5022bc4bce38b (patch)
tree075b73ce63b3483c6f6a0756479e1d45011040a0 /gas
parent657edeab3857130ddc005a88104711dd9e339ff0 (diff)
downloadgdb-c39e89c3aaa3a6790f85e80f2da5022bc4bce38b.zip
gdb-c39e89c3aaa3a6790f85e80f2da5022bc4bce38b.tar.gz
gdb-c39e89c3aaa3a6790f85e80f2da5022bc4bce38b.tar.bz2
gas: drop .appfile and .appline
These were used originally to represent "# <line> <file>" constructs inserted by (typically) compilers when pre-processing. Quite some time ago they were replaced by .linefile though. Since the original directives were never documented, we ought to be able to remove support for them. As a result in a number of case function parameter aren't used anymore and can hence be dropped.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/obj-coff.c18
-rw-r--r--gas/config/obj-coff.h7
-rw-r--r--gas/config/obj-ecoff.h2
-rw-r--r--gas/config/obj-elf.c48
-rw-r--r--gas/config/obj-elf.h2
-rw-r--r--gas/config/obj-multi.h4
-rw-r--r--gas/config/tc-mips.c4
-rw-r--r--gas/config/tc-ppc.c2
-rw-r--r--gas/config/tc-tic54x.c2
-rw-r--r--gas/config/tc-z8k.c2
-rw-r--r--gas/dwarf2dbg.c4
-rw-r--r--gas/ecoff.c2
-rw-r--r--gas/ecoff.h2
-rw-r--r--gas/input-scrub.c4
-rw-r--r--gas/macro.c2
-rw-r--r--gas/obj.h2
-rw-r--r--gas/read.c137
-rw-r--r--gas/read.h6
18 files changed, 109 insertions, 141 deletions
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index 1924524..98c39e4 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -316,7 +316,7 @@ c_symbol_merge (symbolS *debug, symbolS *normal)
}
void
-c_dot_file_symbol (const char *filename, int appfile ATTRIBUTE_UNUSED)
+c_dot_file_symbol (const char *filename)
{
symbolS *symbolP;
@@ -447,11 +447,11 @@ coff_add_linesym (symbolS *sym)
}
static void
-obj_coff_ln (int appline)
+obj_coff_ln (int ignore ATTRIBUTE_UNUSED)
{
int l;
- if (! appline && def_symbol_in_progress != NULL)
+ if (def_symbol_in_progress != NULL)
{
as_warn (_(".ln pseudo-op inside .def/.endef: ignored."));
demand_empty_rest_of_line ();
@@ -460,9 +460,9 @@ obj_coff_ln (int appline)
l = get_absolute_expression ();
- /* If there is no lineno symbol, treat a .ln
- directive as if it were a .appline directive. */
- if (appline || current_lineno_sym == NULL)
+ /* If there is no lineno symbol, treat a .ln directive
+ as if it were a (no longer existing) .appline one. */
+ if (current_lineno_sym == NULL)
new_logical_line ((char *) NULL, l - 1);
else
add_lineno (frag_now, frag_now_fix (), l);
@@ -473,8 +473,7 @@ obj_coff_ln (int appline)
if (listing)
{
- if (! appline)
- l += coff_line_base - 1;
+ l += coff_line_base - 1;
listing_source_line (l);
}
}
@@ -1705,7 +1704,7 @@ coff_adjust_symtab (void)
{
if (symbol_rootP == NULL
|| S_GET_STORAGE_CLASS (symbol_rootP) != C_FILE)
- c_dot_file_symbol ("fake", 0);
+ c_dot_file_symbol ("fake");
}
void
@@ -1849,7 +1848,6 @@ symbol_dump (void)
const pseudo_typeS coff_pseudo_table[] =
{
{"ABORT", s_abort, 0},
- {"appline", obj_coff_ln, 1},
/* We accept the .bss directive for backward compatibility with
earlier versions of gas. */
{"bss", obj_coff_bss, 0},
diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h
index 1892b8a..34680bd 100644
--- a/gas/config/obj-coff.h
+++ b/gas/config/obj-coff.h
@@ -249,7 +249,7 @@ extern int coff_n_line_nos;
extern symbolS *coff_last_function;
#define obj_emit_lineno(WHERE, LINE, FILE_START) abort ()
-#define obj_app_file(name, app) c_dot_file_symbol (name, app)
+#define obj_app_file(name) c_dot_file_symbol (name)
#define obj_frob_symbol(S,P) coff_frob_symbol (S, & P)
#define obj_frob_section(S) coff_frob_section (S)
#define obj_frob_file_after_relocs() coff_frob_file_after_relocs ()
@@ -315,14 +315,12 @@ extern const pseudo_typeS coff_pseudo_table[];
SA_SET_SCN_NRELOC (section_symbol (sec), n)
#endif
-#define obj_app_file(name, app) c_dot_file_symbol (name, app)
-
extern int S_SET_DATA_TYPE (symbolS *, int);
extern int S_SET_STORAGE_CLASS (symbolS *, int);
extern int S_GET_STORAGE_CLASS (symbolS *);
extern void SA_SET_SYM_ENDNDX (symbolS *, symbolS *);
extern void coff_add_linesym (symbolS *);
-extern void c_dot_file_symbol (const char *, int);
+extern void c_dot_file_symbol (const char *);
extern void coff_frob_symbol (symbolS *, int *);
extern void coff_adjust_symtab (void);
extern void coff_frob_section (segT);
@@ -338,7 +336,6 @@ extern void pecoff_obj_clear_weak_hook (symbolS *);
extern void obj_coff_section (int);
extern segT obj_coff_add_segment (const char *);
extern void obj_coff_section (int);
-extern void c_dot_file_symbol (const char *, int);
extern segT s_get_segment (symbolS *);
#ifndef tc_coff_symbol_emit_hook
extern void tc_coff_symbol_emit_hook (symbolS *);
diff --git a/gas/config/obj-ecoff.h b/gas/config/obj-ecoff.h
index 2cd7e9b..06e002c 100644
--- a/gas/config/obj-ecoff.h
+++ b/gas/config/obj-ecoff.h
@@ -61,7 +61,7 @@ struct ecoff_sy_obj
#define obj_symbol_clone_hook ecoff_symbol_clone_hook
/* Record file switches in the ECOFF symbol table. */
-#define obj_app_file(name, app) ecoff_new_file (name, app)
+#define obj_app_file(name) ecoff_new_file (name)
/* At the moment we don't want to do any stabs processing in read.c. */
#define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index b218ff6..c02d26b 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -258,46 +258,36 @@ elf_sec_sym_ok_for_reloc (asection *sec)
}
void
-elf_file_symbol (const char *s, int appfile)
+elf_file_symbol (const char *s)
{
asymbol *bsym;
+ symbolS *sym = symbol_new (s, absolute_section, &zero_address_frag, 0);
+ size_t name_length = strlen (s);
- if (!appfile
- || symbol_rootP == NULL
- || (bsym = symbol_get_bfdsym (symbol_rootP)) == NULL
- || (bsym->flags & BSF_FILE) == 0)
+ if (name_length > strlen (S_GET_NAME (sym)))
{
- symbolS *sym;
- size_t name_length;
-
- sym = symbol_new (s, absolute_section, &zero_address_frag, 0);
-
- name_length = strlen (s);
- if (name_length > strlen (S_GET_NAME (sym)))
- {
- obstack_grow (&notes, s, name_length + 1);
- S_SET_NAME (sym, (const char *) obstack_finish (&notes));
- }
- else
- strcpy ((char *) S_GET_NAME (sym), s);
+ obstack_grow (&notes, s, name_length + 1);
+ S_SET_NAME (sym, (const char *) obstack_finish (&notes));
+ }
+ else
+ strcpy ((char *) S_GET_NAME (sym), s);
- symbol_get_bfdsym (sym)->flags |= BSF_FILE;
+ symbol_get_bfdsym (sym)->flags |= BSF_FILE;
- if (symbol_rootP != sym
- && ((bsym = symbol_get_bfdsym (symbol_rootP)) == NULL
- || (bsym->flags & BSF_FILE) == 0))
- {
- symbol_remove (sym, &symbol_rootP, &symbol_lastP);
- symbol_insert (sym, symbol_rootP, &symbol_rootP, &symbol_lastP);
- }
+ if (symbol_rootP != sym
+ && ((bsym = symbol_get_bfdsym (symbol_rootP)) == NULL
+ || (bsym->flags & BSF_FILE) == 0))
+ {
+ symbol_remove (sym, &symbol_rootP, &symbol_lastP);
+ symbol_insert (sym, symbol_rootP, &symbol_rootP, &symbol_lastP);
+ }
#ifdef DEBUG
- verify_symbol_chain (symbol_rootP, symbol_lastP);
+ verify_symbol_chain (symbol_rootP, symbol_lastP);
#endif
- }
#ifdef NEED_ECOFF_DEBUG
- ecoff_new_file (s, appfile);
+ ecoff_new_file (s);
#endif
}
diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h
index e2941bf..2b9d28c 100644
--- a/gas/config/obj-elf.h
+++ b/gas/config/obj-elf.h
@@ -180,7 +180,7 @@ extern void elf_frob_file_after_relocs (void);
#ifndef obj_app_file
#define obj_app_file elf_file_symbol
#endif
-extern void elf_file_symbol (const char *, int);
+extern void elf_file_symbol (const char *);
extern void obj_elf_section_change_hook (void);
diff --git a/gas/config/obj-multi.h b/gas/config/obj-multi.h
index a933d599..0d56b4a 100644
--- a/gas/config/obj-multi.h
+++ b/gas/config/obj-multi.h
@@ -36,9 +36,9 @@
? (*this_format->begin) () \
: (void) 0)
-#define obj_app_file(NAME, APPFILE) \
+#define obj_app_file(NAME) \
(this_format->app_file \
- ? (*this_format->app_file) (NAME, APPFILE) \
+ ? (*this_format->app_file) (NAME) \
: (void) 0)
#define obj_frob_symbol(S,P) \
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index f632e94..ae7a443 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -19723,7 +19723,7 @@ s_mips_file (int x ATTRIBUTE_UNUSED)
if (ECOFF_DEBUGGING)
{
get_number ();
- s_app_file (0);
+ s_file (0);
}
else
{
@@ -19738,7 +19738,7 @@ s_mips_file (int x ATTRIBUTE_UNUSED)
if (filename != NULL && ! first_file_directive)
{
(void) new_logical_line (filename, -1);
- s_app_file_string (filename, 0);
+ s_file_string (filename);
}
first_file_directive = 1;
}
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 1aa5fcc..72128af 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -5194,7 +5194,7 @@ ppc_file (int ignore ATTRIBUTE_UNUSED)
}
/* Use coff dot_file creation and adjust auxiliary entries. */
- c_dot_file_symbol (sfname, 0);
+ c_dot_file_symbol (sfname);
S_SET_NUMBER_AUXILIARY (symbol_rootP, auxnb);
coffsym = coffsymbol (symbol_get_bfdsym (symbol_rootP));
coffsym->native[1].u.auxent.x_file.x_ftype = XFT_FN;
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index 6070477..dc8cc1d 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -4966,7 +4966,7 @@ tic54x_adjust_symtab (void)
{
unsigned lineno;
const char * filename = as_where (&lineno);
- c_dot_file_symbol (filename, 0);
+ c_dot_file_symbol (filename);
}
}
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index 0c25576..5fef657 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -116,7 +116,7 @@ const pseudo_typeS md_pseudo_table[] = {
{"segm" , s_segm , 1},
{"unsegm" , s_segm , 0},
{"unseg" , s_segm , 0},
- {"name" , s_app_file , 0},
+ {"name" , s_file , 0},
{"global" , s_globl , 0},
{"wval" , cons , 2},
{"lval" , cons , 4},
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 44d7d9e..185d57c 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -1128,7 +1128,7 @@ dwarf2_emit_label (symbolS *label)
}
/* Handle two forms of .file directive:
- - Pass .file "source.c" to s_app_file
+ - Pass .file "source.c" to s_file
- Handle .file 1 "source.c" by adding an entry to the DWARF-2 file table
If an entry is added to the file table, return a pointer to the filename. */
@@ -1146,7 +1146,7 @@ dwarf2_directive_filename (void)
SKIP_WHITESPACE ();
if (*input_line_pointer == '"')
{
- s_app_file (0);
+ s_file (0);
return NULL;
}
diff --git a/gas/ecoff.c b/gas/ecoff.c
index 250faae..416ba1e 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -2312,7 +2312,7 @@ add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake)
compiler output, only in hand coded assembler. */
void
-ecoff_new_file (const char *name, int appfile ATTRIBUTE_UNUSED)
+ecoff_new_file (const char *name)
{
if (cur_file_ptr != NULL && filename_cmp (cur_file_ptr->name, name) == 0)
return;
diff --git a/gas/ecoff.h b/gas/ecoff.h
index 421f231..01f9703 100644
--- a/gas/ecoff.h
+++ b/gas/ecoff.h
@@ -37,7 +37,7 @@ extern void ecoff_read_begin_hook (void);
/* This function should be called when the assembler switches to a new
file. */
-extern void ecoff_new_file (const char *, int);
+extern void ecoff_new_file (const char *);
/* This function should be called when a new symbol is created, by
obj_symbol_new_hook. */
diff --git a/gas/input-scrub.c b/gas/input-scrub.c
index 19f53e4..47382e3 100644
--- a/gas/input-scrub.c
+++ b/gas/input-scrub.c
@@ -445,9 +445,7 @@ bump_line_counters (void)
/* Tells us what the new logical line number and file are.
If the line_number is -1, we don't change the current logical line
- number. If it is -2, we decrement the logical line number (this is
- to support the .appfile pseudo-op inserted into the stream by
- do_scrub_chars).
+ number.
If fname is NULL, we don't change the current logical file name, unless
bit 3 of flags is set.
Returns nonzero if the filename actually changes. */
diff --git a/gas/macro.c b/gas/macro.c
index 871a2a8..c8ebcab 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -256,7 +256,7 @@ buffer_and_nest (const char *from, const char *to, sb *ptr,
ptr->ptr[ptr->len] = '\0';
temp_ilp (ptr->ptr + i + 8);
- s_app_line (0);
+ s_linefile (0);
restore_ilp ();
ptr->ptr[ptr->len] = saved_eol_char;
ptr->len = line_start;
diff --git a/gas/obj.h b/gas/obj.h
index dd98e66..5d23707 100644
--- a/gas/obj.h
+++ b/gas/obj.h
@@ -42,7 +42,7 @@ struct format_ops {
unsigned dfl_leading_underscore : 1;
unsigned emit_section_symbols : 1;
void (*begin) (void);
- void (*app_file) (const char *, int);
+ void (*app_file) (const char *);
void (*frob_symbol) (symbolS *, int *);
void (*frob_file) (void);
void (*frob_file_before_adjust) (void);
diff --git a/gas/read.c b/gas/read.c
index f9aa332..71bb664 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -412,10 +412,8 @@ static const pseudo_typeS potable[] = {
{"exitm", s_mexit, 0},
/* extend */
{"extern", s_ignore, 0}, /* We treat all undef as ext. */
- {"appfile", s_app_file, 1},
- {"appline", s_app_line, 1},
{"fail", s_fail, 0},
- {"file", s_app_file, 0},
+ {"file", s_file, 0},
{"fill", s_fill, 0},
{"float", float_cons, 'f'},
{"format", s_ignore, 0},
@@ -448,7 +446,7 @@ static const pseudo_typeS potable[] = {
{"irepc", s_irp, 1},
{"lcomm", s_lcomm, 0},
{"lflags", s_ignore, 0}, /* Listing flags. */
- {"linefile", s_app_line, 0},
+ {"linefile", s_linefile, 0},
{"linkonce", s_linkonce, 0},
{"list", listing_list, 1}, /* Turn listing on. */
{"llen", listing_psize, 1},
@@ -2000,15 +1998,11 @@ s_data (int ignore ATTRIBUTE_UNUSED)
demand_empty_rest_of_line ();
}
-/* Handle the .appfile pseudo-op. This is automatically generated by
- do_scrub_chars when a preprocessor # line comment is seen with a
- file name. This default definition may be overridden by the object
- or CPU specific pseudo-ops. This function is also the default
- definition for .file; the APPFILE argument is 1 for .appfile, 0 for
- .file. */
+/* Handle the .file pseudo-op. This default definition may be overridden by
+ the object or CPU specific pseudo-ops. */
void
-s_app_file_string (char *file, int appfile ATTRIBUTE_UNUSED)
+s_file_string (char *file)
{
#ifdef LISTING
if (listing)
@@ -2016,12 +2010,12 @@ s_app_file_string (char *file, int appfile ATTRIBUTE_UNUSED)
#endif
register_dependency (file);
#ifdef obj_app_file
- obj_app_file (file, appfile);
+ obj_app_file (file);
#endif
}
void
-s_app_file (int appfile)
+s_file (int ignore ATTRIBUTE_UNUSED)
{
char *s;
int length;
@@ -2029,8 +2023,7 @@ s_app_file (int appfile)
/* Some assemblers tolerate immediately following '"'. */
if ((s = demand_copy_string (&length)) != 0)
{
- int may_omit
- = (!new_logical_line_flags (s, -1, 1) && appfile);
+ new_logical_line_flags (s, -1, 1);
/* In MRI mode, the preprocessor may have inserted an extraneous
backquote. */
@@ -2040,8 +2033,7 @@ s_app_file (int appfile)
++input_line_pointer;
demand_empty_rest_of_line ();
- if (!may_omit)
- s_app_file_string (s, appfile);
+ s_file_string (s);
}
}
@@ -2058,21 +2050,19 @@ get_linefile_number (int *flag)
return 1;
}
-/* Handle the .appline pseudo-op. This is automatically generated by
+/* Handle the .linefile pseudo-op. This is automatically generated by
do_scrub_chars when a preprocessor # line comment is seen. This
default definition may be overridden by the object or CPU specific
pseudo-ops. */
void
-s_app_line (int appline)
+s_linefile (int ignore ATTRIBUTE_UNUSED)
{
char *file = NULL;
int linenum, flags = 0;
/* The given number is that of the next line. */
- if (appline)
- linenum = get_absolute_expression ();
- else if (!get_linefile_number (&linenum))
+ if (!get_linefile_number (&linenum))
{
ignore_rest_of_line ();
return;
@@ -2094,65 +2084,60 @@ s_app_line (int appline)
{
int length = 0;
- if (!appline)
+ SKIP_WHITESPACE ();
+
+ if (*input_line_pointer == '"')
+ file = demand_copy_string (&length);
+ else if (*input_line_pointer == '.')
{
- SKIP_WHITESPACE ();
+ /* buffer_and_nest() may insert this form. */
+ ++input_line_pointer;
+ flags = 1 << 3;
+ }
- if (*input_line_pointer == '"')
- file = demand_copy_string (&length);
- else if (*input_line_pointer == '.')
- {
- /* buffer_and_nest() may insert this form. */
- ++input_line_pointer;
- flags = 1 << 3;
- }
+ if (file)
+ {
+ int this_flag;
- if (file)
- {
- int this_flag;
+ while (get_linefile_number (&this_flag))
+ switch (this_flag)
+ {
+ /* From GCC's cpp documentation:
+ 1: start of a new file.
+ 2: returning to a file after having included another file.
+ 3: following text comes from a system header file.
+ 4: following text should be treated as extern "C".
+
+ 4 is nonsensical for the assembler; 3, we don't care about,
+ so we ignore it just in case a system header file is
+ included while preprocessing assembly. So 1 and 2 are all
+ we care about, and they are mutually incompatible.
+ new_logical_line_flags() demands this. */
+ case 1:
+ case 2:
+ if (flags && flags != (1 << this_flag))
+ as_warn (_("incompatible flag %i in line directive"),
+ this_flag);
+ else
+ flags |= 1 << this_flag;
+ break;
- while (get_linefile_number (&this_flag))
- switch (this_flag)
- {
- /* From GCC's cpp documentation:
- 1: start of a new file.
- 2: returning to a file after having included
- another file.
- 3: following text comes from a system header file.
- 4: following text should be treated as extern "C".
-
- 4 is nonsensical for the assembler; 3, we don't
- care about, so we ignore it just in case a
- system header file is included while
- preprocessing assembly. So 1 and 2 are all we
- care about, and they are mutually incompatible.
- new_logical_line_flags() demands this. */
- case 1:
- case 2:
- if (flags && flags != (1 << this_flag))
- as_warn (_("incompatible flag %i in line directive"),
- this_flag);
- else
- flags |= 1 << this_flag;
- break;
-
- case 3:
- case 4:
- /* We ignore these. */
- break;
-
- default:
- as_warn (_("unsupported flag %i in line directive"),
- this_flag);
- break;
- }
+ case 3:
+ case 4:
+ /* We ignore these. */
+ break;
- if (!is_end_of_line[(unsigned char)*input_line_pointer])
- file = 0;
- }
- }
+ default:
+ as_warn (_("unsupported flag %i in line directive"),
+ this_flag);
+ break;
+ }
+
+ if (!is_end_of_line[(unsigned char)*input_line_pointer])
+ file = NULL;
+ }
- if (appline || file || flags)
+ if (file || flags)
{
linenum--;
new_logical_line_flags (file, linenum, flags);
@@ -2162,7 +2147,7 @@ s_app_line (int appline)
#endif
}
}
- if (appline || file || flags)
+ if (file || flags)
demand_empty_rest_of_line ();
else
ignore_rest_of_line ();
diff --git a/gas/read.h b/gas/read.h
index 670991b..0d2e0e3 100644
--- a/gas/read.h
+++ b/gas/read.h
@@ -164,9 +164,9 @@ extern void bss_alloc (symbolS *, addressT, unsigned);
extern offsetT parse_align (int);
extern symbolS *s_comm_internal (int, symbolS *(*) (int, symbolS *, addressT));
extern symbolS *s_lcomm_internal (int, symbolS *, addressT);
-extern void s_app_file_string (char *, int);
-extern void s_app_file (int);
-extern void s_app_line (int);
+extern void s_file_string (char *);
+extern void s_file (int);
+extern void s_linefile (int);
extern void s_bundle_align_mode (int);
extern void s_bundle_lock (int);
extern void s_bundle_unlock (int);