* obj.h (struct format_ops): New members begin, app_file,

s_set_other, s_set_desc, s_get_type, s_set_type,
	separate_stab_sections, init_stab_section.

	* config/obj-multi.h: Update GPL notice to v2.
	(obj_begin): New.
	(obj_app_file): New.
	(S_SET_SIZE): Test s_set_size for NULL before calling.
	(S_SET_ALIGN): Similar for s_set_align.
	(S_SET_OTHER): New.
	(S_SET_DESC): New.
	(S_GET_TYPE): New.
	(S_SET_TYPE): New.
	(SEPARATE_STAB_SECTIONS): New.
	(INIT_STAB_SECTION): New.
	(EMIT_SECTION_SYMBOLS): New.
	(AOUT_STABS) [OBJ_MAYBE_AOUT]: Define.

	* config/obj-elf.h: Update GPL notice to v2.
	Mention that this file is included from obj-multi.h.
	(obj_begin): Wrap definition in ifndef.
	(elf_file_symbol): Constify declaration.
	(obj_app_file): Ditto.
	(SEPARATE_STAB_SECTIONS, INIT_STAB_SECTION, OBJ_PROCESS_STAB):
	Wrap in ifndef SEPARATE_STAB_SECTIONS.

	* config/obj-elf.c (elf_s_set_other): New.
	(elf_file_symbol): Constify argument.
	(elf_separate_stab_sections): New.
	(elf_init_stab_section): New.
	(elf_format_ops): Add new members.  Remove comma at end.

	* config/obj-ecoff.c (ecoff_separate_stab_sections): New.
	(ecoff_format_ops): Add new fields.  Remove comma at end.
	Mention inconsistency for emit_section_symbols.

	* config/obj-coff.h (c_dot_file_symbol): Constify declaration.

	* config/obj-coff.c (c_dot_file_symbol): Constify argument.
	(coff_separate_stab_sections): New.
	(coff_format_ops): Add new members.

	* config/obj-aout.c (obj_aout_sec_sym_ok_for_reloc): New.
	(obj_aout_s_set_other): New.
	(obj_aout_s_set_desc): New.
	(obj_aout_s_get_type): New.
	(obj_aout_s_set_type): New.
	(obj_aout_separate_stab_sections): New.
	(aout_format_ops): New members added.  Use obj_aout_process_stab,
	not 0.  Use obj_aout_sec_sym_ok_for_reloc, not 0.
	(obj_aout_frob_symbol): Add ATTRIBUTE_UNUSED to args as
	appropriate.
	(obj_aout_line, obj_aout_weak, obj_aout_type): Ditto.
This commit is contained in:
Hans-Peter Nilsson 2000-05-22 21:19:43 +00:00
parent e33c036475
commit 5110c57e8e
9 changed files with 289 additions and 18 deletions

View File

@ -1,3 +1,59 @@
Mon May 22 22:43:32 2000 Hans-Peter Nilsson <hp@axis.com>
* obj.h (struct format_ops): New members begin, app_file,
s_set_other, s_set_desc, s_get_type, s_set_type,
separate_stab_sections, init_stab_section.
* config/obj-multi.h: Update GPL notice to v2.
(obj_begin): New.
(obj_app_file): New.
(S_SET_SIZE): Test s_set_size for NULL before calling.
(S_SET_ALIGN): Similar for s_set_align.
(S_SET_OTHER): New.
(S_SET_DESC): New.
(S_GET_TYPE): New.
(S_SET_TYPE): New.
(SEPARATE_STAB_SECTIONS): New.
(INIT_STAB_SECTION): New.
(EMIT_SECTION_SYMBOLS): New.
(AOUT_STABS) [OBJ_MAYBE_AOUT]: Define.
* config/obj-elf.h: Update GPL notice to v2.
Mention that this file is included from obj-multi.h.
(obj_begin): Wrap definition in ifndef.
(elf_file_symbol): Constify declaration.
(obj_app_file): Ditto.
(SEPARATE_STAB_SECTIONS, INIT_STAB_SECTION, OBJ_PROCESS_STAB):
Wrap in ifndef SEPARATE_STAB_SECTIONS.
* config/obj-elf.c (elf_s_set_other): New.
(elf_file_symbol): Constify argument.
(elf_separate_stab_sections): New.
(elf_init_stab_section): New.
(elf_format_ops): Add new members. Remove comma at end.
* config/obj-ecoff.c (ecoff_separate_stab_sections): New.
(ecoff_format_ops): Add new fields. Remove comma at end.
Mention inconsistency for emit_section_symbols.
* config/obj-coff.h (c_dot_file_symbol): Constify declaration.
* config/obj-coff.c (c_dot_file_symbol): Constify argument.
(coff_separate_stab_sections): New.
(coff_format_ops): Add new members.
* config/obj-aout.c (obj_aout_sec_sym_ok_for_reloc): New.
(obj_aout_s_set_other): New.
(obj_aout_s_set_desc): New.
(obj_aout_s_get_type): New.
(obj_aout_s_set_type): New.
(obj_aout_separate_stab_sections): New.
(aout_format_ops): New members added. Use obj_aout_process_stab,
not 0. Use obj_aout_sec_sym_ok_for_reloc, not 0.
(obj_aout_frob_symbol): Add ATTRIBUTE_UNUSED to args as
appropriate.
(obj_aout_line, obj_aout_weak, obj_aout_type): Ditto.
2000-05-22 Alan Modra <alan@linuxcare.com.au>
* config/tc-i386.c (tc_i386_fix_adjustable): Prevent adjustment

View File

@ -105,7 +105,7 @@ const pseudo_typeS aout_pseudo_table[] =
void
obj_aout_frob_symbol (sym, punt)
symbolS *sym;
int *punt;
int *punt ATTRIBUTE_UNUSED;
{
flagword flags;
asection *sec;
@ -355,7 +355,7 @@ obj_emit_symbols (where, symbol_rootP)
static void
obj_aout_line (ignore)
int ignore;
int ignore ATTRIBUTE_UNUSED;
{
/* Assume delimiter is part of expression.
BSD4.2 as fails with delightful bug, so we
@ -368,7 +368,7 @@ obj_aout_line (ignore)
static void
obj_aout_weak (ignore)
int ignore;
int ignore ATTRIBUTE_UNUSED;
{
char *name;
int c;
@ -401,7 +401,7 @@ obj_aout_weak (ignore)
static void
obj_aout_type (ignore)
int ignore;
int ignore ATTRIBUTE_UNUSED;
{
char *name;
int c;
@ -641,7 +641,14 @@ DEFUN_VOID (s_sect)
static void aout_pop_insert PARAMS ((void));
static int obj_aout_s_get_other PARAMS ((symbolS *));
static void obj_aout_s_set_other PARAMS ((symbolS *, int));
static int obj_aout_s_get_desc PARAMS ((symbolS *));
static void obj_aout_s_set_desc PARAMS ((symbolS *, int));
static int obj_aout_s_get_type PARAMS ((symbolS *));
static void obj_aout_s_set_type PARAMS ((symbolS *, int));
static int obj_aout_separate_stab_sections PARAMS ((void));
static int obj_aout_sec_sym_ok_for_reloc PARAMS ((asection *));
static void obj_aout_process_stab PARAMS ((segT, int, const char *, int, int, int));
static void
aout_pop_insert ()
@ -656,6 +663,33 @@ obj_aout_s_get_other (sym)
return aout_symbol (symbol_get_bfdsym (sym))->other;
}
static void
obj_aout_s_set_other (sym, o)
symbolS *sym;
int o;
{
aout_symbol (symbol_get_bfdsym (sym))->other = o;
}
static int
obj_aout_sec_sym_ok_for_reloc (sec)
asection *sec ATTRIBUTE_UNUSED;
{
return obj_sec_sym_ok_for_reloc (sec);
}
static void
obj_aout_process_stab (seg, w, s, t, o, d)
segT seg ATTRIBUTE_UNUSED;
int w;
const char *s;
int t;
int o;
int d;
{
aout_process_stab (w, s, t, o, d);
}
static int
obj_aout_s_get_desc (sym)
symbolS *sym;
@ -663,12 +697,44 @@ obj_aout_s_get_desc (sym)
return aout_symbol (symbol_get_bfdsym (sym))->desc;
}
static void
obj_aout_s_set_desc (sym, d)
symbolS *sym;
int d;
{
aout_symbol (symbol_get_bfdsym (sym))->desc = d;
}
static int
obj_aout_s_get_type (sym)
symbolS *sym;
{
return aout_symbol (symbol_get_bfdsym (sym))->type;
}
static void
obj_aout_s_set_type (sym, t)
symbolS *sym;
int t;
{
aout_symbol (symbol_get_bfdsym (sym))->type = t;
}
static int
obj_aout_separate_stab_sections ()
{
return 0;
}
/* When changed, make sure these table entries match the single-format
definitions in obj-aout.h. */
const struct format_ops aout_format_ops =
{
bfd_target_aout_flavour,
1, /* dfl_leading_underscore */
0, /* emit_section_symbols */
0, /* begin */
0, /* app_file */
obj_aout_frob_symbol,
obj_aout_frob_file,
0, /* frob_file_after_relocs */
@ -677,11 +743,17 @@ const struct format_ops aout_format_ops =
0, /* s_get_align */
0, /* s_set_align */
obj_aout_s_get_other,
obj_aout_s_set_other,
obj_aout_s_get_desc,
obj_aout_s_set_desc,
obj_aout_s_get_type,
obj_aout_s_set_type,
0, /* copy_symbol_attributes */
0, /* generate_asm_lineno */
0, /* process_stab */
0, /* sec_sym_ok_for_reloc */
obj_aout_process_stab,
obj_aout_separate_stab_sections,
0, /* init_stab_section */
obj_aout_sec_sym_ok_for_reloc,
aout_pop_insert,
0, /* ecoff_set_ext */
0, /* read_begin_hook */

View File

@ -346,7 +346,7 @@ c_symbol_merge (debug, normal)
void
c_dot_file_symbol (filename)
char *filename;
const char *filename;
{
symbolS *symbolP;
@ -4582,6 +4582,7 @@ const pseudo_typeS coff_pseudo_table[] =
/* Support for a COFF emulation. */
static void coff_pop_insert PARAMS ((void));
static int coff_separate_stab_sections PARAMS ((void));
static void
coff_pop_insert ()
@ -4589,11 +4590,19 @@ coff_pop_insert ()
pop_insert (coff_pseudo_table);
}
static int
coff_separate_stab_sections ()
{
return 1;
}
const struct format_ops coff_format_ops =
{
bfd_target_coff_flavour,
0, /* dfl_leading_underscore */
1, /* emit_section_symbols */
0, /* begin */
c_dot_file_symbol,
coff_frob_symbol,
0, /* frob_file */
coff_frob_file_after_relocs,
@ -4602,10 +4611,16 @@ const struct format_ops coff_format_ops =
0, /* s_get_align */
0, /* s_set_align */
0, /* s_get_other */
0, /* s_set_other */
0, /* s_get_desc */
0, /* s_set_desc */
0, /* s_get_type */
0, /* s_set_type */
0, /* copy_symbol_attributes */
0, /* generate_asm_lineno */
0, /* process_stab */
coff_separate_stab_sections,
obj_coff_init_stab_section,
0, /* sec_sym_ok_for_reloc */
coff_pop_insert,
0, /* ecoff_set_ext */

View File

@ -369,7 +369,7 @@ extern int coff_n_line_nos;
extern void coff_add_linesym PARAMS ((symbolS *));
void c_dot_file_symbol PARAMS ((char *filename));
void c_dot_file_symbol PARAMS ((const char *filename));
#define obj_app_file c_dot_file_symbol
extern void coff_frob_symbol PARAMS ((symbolS *, int *));

View File

@ -34,6 +34,7 @@
static int ecoff_sec_sym_ok_for_reloc PARAMS ((asection *));
static void obj_ecoff_frob_symbol PARAMS ((symbolS *, int *));
static void ecoff_pop_insert PARAMS ((void));
static int ecoff_separate_stab_sections PARAMS ((void));
/* These are the pseudo-ops we support in this file. Only those
relating to debugging information are supported here.
@ -290,11 +291,22 @@ ecoff_pop_insert ()
pop_insert (obj_pseudo_table);
}
static int
ecoff_separate_stab_sections ()
{
return 0;
}
const struct format_ops ecoff_format_ops =
{
bfd_target_ecoff_flavour,
0, /* dfl_leading_underscore */
/* FIXME: A comment why emit_section_symbols is different here (1) from
the single-format definition (0) would be in order. */
1, /* emit_section_symbols */
0, /* begin */
ecoff_new_file,
obj_ecoff_frob_symbol,
ecoff_frob_file,
0, /* frob_file_after_relocs */
@ -303,13 +315,19 @@ const struct format_ops ecoff_format_ops =
0, /* s_get_align */
0, /* s_set_align */
0, /* s_get_other */
0, /* s_set_other */
0, /* s_get_desc */
0, /* s_set_desc */
0, /* s_get_type */
0, /* s_set_type */
0, /* copy_symbol_attributes */
ecoff_generate_asm_lineno,
ecoff_stab,
ecoff_separate_stab_sections,
0, /* init_stab_section */
ecoff_sec_sym_ok_for_reloc,
ecoff_pop_insert,
ecoff_set_ext,
ecoff_read_begin_hook,
ecoff_symbol_new_hook,
ecoff_symbol_new_hook
};

View File

@ -54,9 +54,12 @@ static bfd_vma elf_s_get_size PARAMS ((symbolS *));
static void elf_s_set_size PARAMS ((symbolS *, bfd_vma));
static bfd_vma elf_s_get_align PARAMS ((symbolS *));
static void elf_s_set_align PARAMS ((symbolS *, bfd_vma));
static void elf_s_set_other PARAMS ((symbolS *, int));
static void elf_copy_symbol_attributes PARAMS ((symbolS *, symbolS *));
static int elf_sec_sym_ok_for_reloc PARAMS ((asection *));
static void adjust_stab_sections PARAMS ((bfd *, asection *, PTR));
static int elf_separate_stab_sections PARAMS ((void));
static void elf_init_stab_section PARAMS ((segT));
#ifdef NEED_ECOFF_DEBUG
static boolean elf_get_extr PARAMS ((asymbol *, EXTR *));
@ -233,6 +236,14 @@ elf_s_get_other (sym)
return elf_symbol (symbol_get_bfdsym (sym))->internal_elf_sym.st_other;
}
static void
elf_s_set_other (sym, other)
symbolS *sym;
int other;
{
S_SET_OTHER (sym, other);
}
static void
elf_copy_symbol_attributes (dest, src)
symbolS *dest, *src;
@ -249,7 +260,7 @@ elf_sec_sym_ok_for_reloc (sec)
void
elf_file_symbol (s)
char *s;
const char *s;
{
symbolS *sym;
@ -1910,18 +1921,44 @@ sco_id ()
#endif /* SCO_ELF */
static int
elf_separate_stab_sections ()
{
#ifdef NEED_ECOFF_DEBUG
return (!ECOFF_DEBUGGING);
#else
return 1;
#endif
}
static void
elf_init_stab_section (seg)
segT seg;
{
#ifdef NEED_ECOFF_DEBUG
if (!ECOFF_DEBUGGING)
#endif
obj_elf_init_stab_section (seg);
}
const struct format_ops elf_format_ops =
{
bfd_target_elf_flavour,
0, /* dfl_leading_underscore */
1, /* emit_section_symbols */
elf_begin,
elf_file_symbol,
elf_frob_symbol,
elf_frob_file,
elf_frob_file_after_relocs,
elf_s_get_size, elf_s_set_size,
elf_s_get_align, elf_s_set_align,
elf_s_get_other,
elf_s_set_other,
0, /* s_get_desc */
0, /* s_set_desc */
0, /* s_get_type */
0, /* s_set_type */
elf_copy_symbol_attributes,
#ifdef NEED_ECOFF_DEBUG
ecoff_generate_asm_lineno,
@ -1930,6 +1967,8 @@ const struct format_ops elf_format_ops =
0, /* generate_asm_lineno */
0, /* process_stab */
#endif
elf_separate_stab_sections,
elf_init_stab_section,
elf_sec_sym_ok_for_reloc,
elf_pop_insert,
#ifdef NEED_ECOFF_DEBUG
@ -1938,5 +1977,5 @@ const struct format_ops elf_format_ops =
0, /* ecoff_set_ext */
#endif
elf_obj_read_begin_hook,
elf_obj_symbol_new_hook,
elf_obj_symbol_new_hook
};

View File

@ -6,7 +6,7 @@
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
@ -28,6 +28,9 @@
#define OBJ_ELF 1
/* Note that all macros in this file should be wrapped in #ifndef, for
sake of obj-multi.h which includes this file. */
#ifndef OUTPUT_FLAVOR
#define OUTPUT_FLAVOR bfd_target_elf_flavour
#endif
@ -88,7 +91,9 @@ struct elf_obj_sy
#define TRUE !FALSE
#endif
#ifndef obj_begin
#define obj_begin() elf_begin ()
#endif
extern void elf_begin PARAMS ((void));
/* should be conditional on address size! */
@ -133,8 +138,10 @@ extern void elf_frob_file PARAMS ((void));
#endif
extern void elf_frob_file_after_relocs PARAMS ((void));
#ifndef obj_app_file
#define obj_app_file elf_file_symbol
extern void elf_file_symbol PARAMS ((char *));
#endif
extern void elf_file_symbol PARAMS ((const char *));
extern void obj_elf_section_change_hook PARAMS ((void));
@ -189,6 +196,12 @@ do \
while (0)
#endif
#ifndef SEPARATE_STAB_SECTIONS
/* Avoid ifndef each separate macro setting by wrapping the whole of the
stab group on the assumption that whoever sets SEPARATE_STAB_SECTIONS
caters to ECOFF_DEBUGGING and the right setting of INIT_STAB_SECTIONS
and OBJ_PROCESS_STAB too, without needing the tweaks below. */
/* Stabs go in a separate section. */
#define SEPARATE_STAB_SECTIONS 1
@ -214,6 +227,8 @@ extern void obj_elf_init_stab_section PARAMS ((segT));
ecoff_stab ((seg), (what), (string), (type), (other), (desc))
#endif /* ECOFF_DEBUGGING */
#endif /* SEPARATE_STAB_SECTIONS not defined. */
extern void elf_frob_symbol PARAMS ((symbolS *, int *));
#ifndef obj_frob_symbol
#define obj_frob_symbol(symp, punt) elf_frob_symbol (symp, &punt)

View File

@ -6,7 +6,7 @@
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
@ -32,6 +32,16 @@
#define OUTPUT_FLAVOR \
(this_format->flavor)
#define obj_begin() \
(this_format->begin \
? (*this_format->begin) () \
: (void) 0)
#define obj_app_file(NAME) \
(this_format->app_file \
? (*this_format->app_file) (NAME) \
: (void) 0)
#define obj_frob_symbol(S,P) \
(*this_format->frob_symbol) (S, &(P))
@ -69,21 +79,43 @@
#define S_GET_SIZE \
(*this_format->s_get_size)
#define S_SET_SIZE \
(*this_format->s_set_size)
#define S_SET_SIZE(S, N) \
(this_format->s_set_size \
? (*this_format->s_set_size) (S, N) \
: (void) 0)
#define S_GET_ALIGN \
(*this_format->s_get_align)
#define S_SET_ALIGN \
(*this_format->s_set_align)
#define S_SET_ALIGN(S, N) \
(this_format->s_set_align \
? (*this_format->s_set_align) (S, N) \
: (void) 0)
#define S_GET_OTHER \
(*this_format->s_get_other)
#define S_SET_OTHER(S, O) \
(this_format->s_set_other \
? (*this_format->s_set_other) (S, O) \
: (void) 0)
#define S_GET_DESC \
(*this_format->s_get_desc)
#define S_SET_DESC(S, D) \
(this_format->s_set_desc \
? (*this_format->s_set_desc) (S, D) \
: (void) 0)
#define S_GET_TYPE \
(*this_format->s_get_desc)
#define S_SET_TYPE(S, T) \
(this_format->s_set_type \
? (*this_format->s_set_type) (S, T) \
: (void) 0)
#define OBJ_COPY_SYMBOL_ATTRIBUTES(d,s) \
(this_format->copy_symbol_attributes \
? (*this_format->copy_symbol_attributes) (d, s) \
@ -94,11 +126,27 @@
? (*this_format->process_stab) (SEG,W,S,T,O,D) \
: (void) 0)
#define SEPARATE_STAB_SECTIONS \
((*this_format->separate_stab_sections) ())
#define INIT_STAB_SECTION(S) \
(this_format->init_stab_section \
? (*this_format->init_stab_section) (S) \
: (void) 0)
#define EMIT_SECTION_SYMBOLS (this_format->emit_section_symbols)
#ifdef OBJ_MAYBE_ELF
/* We need OBJ_SYMFIELD_TYPE so that symbol_get_obj is defined in symbol.c
We also need various STAB defines for stab.c */
#include "obj-elf.h"
#endif
#ifdef OBJ_MAYBE_AOUT
/* We want aout_process_stab in stabs.c for the aout table. Defining this
macro will have no other effect. */
#define AOUT_STABS
#endif
#endif /* !OBJ_HEADER */
#endif /* _OBJ_MULTI_H */

View File

@ -50,6 +50,8 @@ struct format_ops {
int flavor;
unsigned dfl_leading_underscore : 1;
unsigned emit_section_symbols : 1;
void (*begin) PARAMS ((void));
void (*app_file) PARAMS ((const char *));
void (*frob_symbol) PARAMS ((symbolS *, int *));
void (*frob_file) PARAMS ((void));
void (*frob_file_after_relocs) PARAMS ((void));
@ -58,10 +60,16 @@ struct format_ops {
bfd_vma (*s_get_align) PARAMS ((symbolS *));
void (*s_set_align) PARAMS ((symbolS *, bfd_vma));
int (*s_get_other) PARAMS ((symbolS *));
void (*s_set_other) PARAMS ((symbolS *, int));
int (*s_get_desc) PARAMS ((symbolS *));
void (*s_set_desc) PARAMS ((symbolS *, int));
int (*s_get_type) PARAMS ((symbolS *));
void (*s_set_type) PARAMS ((symbolS *, int));
void (*copy_symbol_attributes) PARAMS ((symbolS *, symbolS *));
void (*generate_asm_lineno) PARAMS ((void));
void (*process_stab) PARAMS ((segT, int, const char *, int, int, int));
int (*separate_stab_sections) PARAMS ((void));
void (*init_stab_section) PARAMS ((segT));
int (*sec_sym_ok_for_reloc) PARAMS ((asection *));
void (*pop_insert) PARAMS ((void));
/* For configurations using ECOFF_DEBUGGING, this callback is used. */