1999-05-03 09:29:11 +02:00
|
|
|
/* ELF object file format
|
2002-05-09 15:12:57 +02:00
|
|
|
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
2003-01-11 07:24:12 +01:00
|
|
|
2001, 2002, 2003 Free Software Foundation, Inc.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
This file is part of GAS, the GNU Assembler.
|
|
|
|
|
|
|
|
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 2,
|
|
|
|
or (at your option) any later version.
|
|
|
|
|
|
|
|
GAS is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
|
|
|
the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GAS; see the file COPYING. If not, write to the Free
|
|
|
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
2000-09-14 13:48:26 +02:00
|
|
|
02111-1307, USA. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
#define OBJ_HEADER "obj-elf.h"
|
|
|
|
#include "as.h"
|
2001-09-19 07:33:36 +02:00
|
|
|
#include "safe-ctype.h"
|
1999-05-03 09:29:11 +02:00
|
|
|
#include "subsegs.h"
|
|
|
|
#include "obstack.h"
|
2002-06-07 16:57:50 +02:00
|
|
|
#include "struc-symbol.h"
|
2003-05-21 14:07:56 +02:00
|
|
|
#include "dwarf2dbg.h"
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
#ifndef ECOFF_DEBUGGING
|
|
|
|
#define ECOFF_DEBUGGING 0
|
|
|
|
#else
|
|
|
|
#define NEED_ECOFF_DEBUG
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
#include "ecoff.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TC_ALPHA
|
|
|
|
#include "elf/alpha.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TC_MIPS
|
|
|
|
#include "elf/mips.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TC_PPC
|
|
|
|
#include "elf/ppc.h"
|
|
|
|
#endif
|
|
|
|
|
2000-02-23 14:52:23 +01:00
|
|
|
#ifdef TC_I370
|
|
|
|
#include "elf/i370.h"
|
|
|
|
#endif
|
|
|
|
|
2003-12-13 13:57:40 +01:00
|
|
|
static void obj_elf_line (int);
|
|
|
|
static void obj_elf_size (int);
|
|
|
|
static void obj_elf_type (int);
|
|
|
|
static void obj_elf_ident (int);
|
|
|
|
static void obj_elf_weak (int);
|
|
|
|
static void obj_elf_local (int);
|
|
|
|
static void obj_elf_visibility (int);
|
|
|
|
static void obj_elf_symver (int);
|
|
|
|
static void obj_elf_subsection (int);
|
|
|
|
static void obj_elf_popsection (int);
|
|
|
|
static void obj_elf_tls_common (int);
|
2003-12-13 09:59:24 +01:00
|
|
|
static void obj_elf_lcomm (int);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
static const pseudo_typeS elf_pseudo_table[] =
|
|
|
|
{
|
|
|
|
{"comm", obj_elf_common, 0},
|
1999-06-07 04:28:54 +02:00
|
|
|
{"common", obj_elf_common, 1},
|
1999-05-03 09:29:11 +02:00
|
|
|
{"ident", obj_elf_ident, 0},
|
2003-12-13 09:59:24 +01:00
|
|
|
{"lcomm", obj_elf_lcomm, 0},
|
1999-05-03 09:29:11 +02:00
|
|
|
{"local", obj_elf_local, 0},
|
|
|
|
{"previous", obj_elf_previous, 0},
|
|
|
|
{"section", obj_elf_section, 0},
|
|
|
|
{"section.s", obj_elf_section, 0},
|
|
|
|
{"sect", obj_elf_section, 0},
|
|
|
|
{"sect.s", obj_elf_section, 0},
|
1999-06-06 01:15:34 +02:00
|
|
|
{"pushsection", obj_elf_section, 1},
|
|
|
|
{"popsection", obj_elf_popsection, 0},
|
1999-05-03 09:29:11 +02:00
|
|
|
{"size", obj_elf_size, 0},
|
|
|
|
{"type", obj_elf_type, 0},
|
|
|
|
{"version", obj_elf_version, 0},
|
|
|
|
{"weak", obj_elf_weak, 0},
|
|
|
|
|
2000-09-14 13:48:26 +02:00
|
|
|
/* These define symbol visibility. */
|
2000-01-03 19:34:24 +01:00
|
|
|
{"internal", obj_elf_visibility, STV_INTERNAL},
|
|
|
|
{"hidden", obj_elf_visibility, STV_HIDDEN},
|
|
|
|
{"protected", obj_elf_visibility, STV_PROTECTED},
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* These are used for stabs-in-elf configurations. */
|
|
|
|
{"line", obj_elf_line, 0},
|
|
|
|
|
|
|
|
/* This is a GNU extension to handle symbol versions. */
|
|
|
|
{"symver", obj_elf_symver, 0},
|
|
|
|
|
|
|
|
/* A GNU extension to change subsection only. */
|
|
|
|
{"subsection", obj_elf_subsection, 0},
|
|
|
|
|
|
|
|
/* These are GNU extensions to aid in garbage collecting C++ vtables. */
|
2003-12-13 13:57:40 +01:00
|
|
|
{"vtable_inherit", (void (*) (int)) &obj_elf_vtable_inherit, 0},
|
|
|
|
{"vtable_entry", (void (*) (int)) &obj_elf_vtable_entry, 0},
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-09-14 13:48:26 +02:00
|
|
|
/* These are used for dwarf. */
|
1999-05-03 09:29:11 +02:00
|
|
|
{"2byte", cons, 2},
|
|
|
|
{"4byte", cons, 4},
|
|
|
|
{"8byte", cons, 8},
|
2003-05-21 14:07:56 +02:00
|
|
|
/* These are used for dwarf2. */
|
2003-12-13 13:57:40 +01:00
|
|
|
{ "file", (void (*) (int)) dwarf2_directive_file, 0 },
|
2003-05-21 14:07:56 +02:00
|
|
|
{ "loc", dwarf2_directive_loc, 0 },
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
/* We need to trap the section changing calls to handle .previous. */
|
|
|
|
{"data", obj_elf_data, 0},
|
|
|
|
{"text", obj_elf_text, 0},
|
|
|
|
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
{"tls_common", obj_elf_tls_common, 0},
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* End sentinel. */
|
1999-07-11 22:20:04 +02:00
|
|
|
{NULL, NULL, 0},
|
1999-05-03 09:29:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static const pseudo_typeS ecoff_debug_pseudo_table[] =
|
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
/* COFF style debugging information for ECOFF. .ln is not used; .loc
|
|
|
|
is used instead. */
|
|
|
|
{ "def", ecoff_directive_def, 0 },
|
|
|
|
{ "dim", ecoff_directive_dim, 0 },
|
|
|
|
{ "endef", ecoff_directive_endef, 0 },
|
|
|
|
{ "file", ecoff_directive_file, 0 },
|
|
|
|
{ "scl", ecoff_directive_scl, 0 },
|
|
|
|
{ "tag", ecoff_directive_tag, 0 },
|
|
|
|
{ "val", ecoff_directive_val, 0 },
|
|
|
|
|
|
|
|
/* COFF debugging requires pseudo-ops .size and .type, but ELF
|
|
|
|
already has meanings for those. We use .esize and .etype
|
|
|
|
instead. These are only generated by gcc anyhow. */
|
|
|
|
{ "esize", ecoff_directive_size, 0 },
|
|
|
|
{ "etype", ecoff_directive_type, 0 },
|
|
|
|
|
|
|
|
/* ECOFF specific debugging information. */
|
|
|
|
{ "begin", ecoff_directive_begin, 0 },
|
|
|
|
{ "bend", ecoff_directive_bend, 0 },
|
|
|
|
{ "end", ecoff_directive_end, 0 },
|
|
|
|
{ "ent", ecoff_directive_ent, 0 },
|
|
|
|
{ "fmask", ecoff_directive_fmask, 0 },
|
|
|
|
{ "frame", ecoff_directive_frame, 0 },
|
|
|
|
{ "loc", ecoff_directive_loc, 0 },
|
|
|
|
{ "mask", ecoff_directive_mask, 0 },
|
|
|
|
|
|
|
|
/* Other ECOFF directives. */
|
|
|
|
{ "extern", ecoff_directive_extern, 0 },
|
|
|
|
|
|
|
|
/* These are used on Irix. I don't know how to implement them. */
|
|
|
|
{ "alias", s_ignore, 0 },
|
|
|
|
{ "bgnb", s_ignore, 0 },
|
|
|
|
{ "endb", s_ignore, 0 },
|
|
|
|
{ "lab", s_ignore, 0 },
|
|
|
|
{ "noalias", s_ignore, 0 },
|
|
|
|
{ "verstamp", s_ignore, 0 },
|
|
|
|
{ "vreg", s_ignore, 0 },
|
|
|
|
#endif
|
|
|
|
|
1999-07-11 22:20:04 +02:00
|
|
|
{NULL, NULL, 0} /* end sentinel */
|
1999-05-03 09:29:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#undef NO_RELOC
|
|
|
|
#include "aout/aout64.h"
|
|
|
|
|
|
|
|
/* This is called when the assembler starts. */
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_begin (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2003-12-13 13:57:40 +01:00
|
|
|
asection *s;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* Add symbols for the known sections to the symbol table. */
|
2003-12-13 13:57:40 +01:00
|
|
|
s = bfd_get_section_by_name (stdoutput, TEXT_SECTION_NAME);
|
|
|
|
symbol_table_insert (section_symbol (s));
|
|
|
|
s = bfd_get_section_by_name (stdoutput, DATA_SECTION_NAME);
|
|
|
|
symbol_table_insert (section_symbol (s));
|
|
|
|
s = bfd_get_section_by_name (stdoutput, BSS_SECTION_NAME);
|
|
|
|
symbol_table_insert (section_symbol (s));
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_pop_insert (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
pop_insert (elf_pseudo_table);
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
pop_insert (ecoff_debug_pseudo_table);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bfd_vma
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_s_get_size (symbolS *sym)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
return S_GET_SIZE (sym);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_s_set_size (symbolS *sym, bfd_vma sz)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
S_SET_SIZE (sym, sz);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bfd_vma
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_s_get_align (symbolS *sym)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
return S_GET_ALIGN (sym);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_s_set_align (symbolS *sym, bfd_vma align)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
S_SET_ALIGN (sym, align);
|
|
|
|
}
|
|
|
|
|
2000-01-26 23:48:31 +01:00
|
|
|
int
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_s_get_other (symbolS *sym)
|
2000-01-26 23:48:31 +01:00
|
|
|
{
|
|
|
|
return elf_symbol (symbol_get_bfdsym (sym))->internal_elf_sym.st_other;
|
|
|
|
}
|
|
|
|
|
* 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 23:19:43 +02:00
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_s_set_other (symbolS *sym, int other)
|
* 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 23:19:43 +02:00
|
|
|
{
|
|
|
|
S_SET_OTHER (sym, other);
|
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
static int
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_sec_sym_ok_for_reloc (asection *sec)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
return obj_sec_sym_ok_for_reloc (sec);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_file_symbol (const char *s)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
symbolS *sym;
|
|
|
|
|
2003-12-13 13:57:40 +01:00
|
|
|
sym = symbol_new (s, absolute_section, 0, NULL);
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
symbol_set_frag (sym, &zero_address_frag);
|
|
|
|
symbol_get_bfdsym (sym)->flags |= BSF_FILE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
if (symbol_rootP != sym)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
ecoff_new_file (s);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2003-12-13 09:23:05 +01:00
|
|
|
/* Called from read.c:s_comm after we've parsed .comm symbol, size.
|
|
|
|
Parse a possible alignment value. */
|
|
|
|
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
static symbolS *
|
2003-12-13 09:23:05 +01:00
|
|
|
elf_common_parse (int ignore ATTRIBUTE_UNUSED, symbolS *symbolP, addressT size)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2003-12-13 09:23:05 +01:00
|
|
|
addressT align = 0;
|
|
|
|
int is_local = symbol_get_obj (symbolP)->local;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2003-12-13 09:23:05 +01:00
|
|
|
if (*input_line_pointer == ',')
|
1999-06-07 04:28:54 +02:00
|
|
|
{
|
2003-12-13 09:23:05 +01:00
|
|
|
char *save = input_line_pointer;
|
1999-06-07 04:28:54 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
input_line_pointer++;
|
|
|
|
SKIP_WHITESPACE ();
|
2003-12-13 09:23:05 +01:00
|
|
|
|
|
|
|
if (*input_line_pointer == '"')
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2003-12-13 09:23:05 +01:00
|
|
|
/* For sparc. Accept .common symbol, length, "bss" */
|
|
|
|
input_line_pointer++;
|
|
|
|
/* Some use the dot, some don't. */
|
|
|
|
if (*input_line_pointer == '.')
|
|
|
|
input_line_pointer++;
|
|
|
|
/* Some say data, some say bss. */
|
|
|
|
if (strncmp (input_line_pointer, "bss\"", 4) == 0)
|
|
|
|
input_line_pointer += 4;
|
|
|
|
else if (strncmp (input_line_pointer, "data\"", 5) == 0)
|
|
|
|
input_line_pointer += 5;
|
|
|
|
else
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2003-12-13 09:23:05 +01:00
|
|
|
char *p = input_line_pointer;
|
|
|
|
char c;
|
|
|
|
|
|
|
|
while (*--p != '"')
|
|
|
|
;
|
|
|
|
while (!is_end_of_line[(unsigned char) *input_line_pointer])
|
|
|
|
if (*input_line_pointer++ == '"')
|
|
|
|
break;
|
|
|
|
c = *input_line_pointer;
|
|
|
|
*input_line_pointer = '\0';
|
|
|
|
as_bad (_("bad .common segment %s"), p);
|
|
|
|
*input_line_pointer = c;
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2003-12-13 09:23:05 +01:00
|
|
|
/* ??? Don't ask me why these are always global. */
|
|
|
|
is_local = 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-13 09:23:05 +01:00
|
|
|
input_line_pointer = save;
|
|
|
|
align = parse_align (is_local);
|
|
|
|
if (align == (addressT) -1)
|
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
}
|
2003-12-13 09:23:05 +01:00
|
|
|
|
|
|
|
if (is_local)
|
|
|
|
{
|
|
|
|
bss_alloc (symbolP, size, align);
|
|
|
|
S_CLEAR_EXTERNAL (symbolP);
|
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
else
|
|
|
|
{
|
2003-12-13 09:23:05 +01:00
|
|
|
S_SET_VALUE (symbolP, size);
|
|
|
|
S_SET_ALIGN (symbolP, align);
|
|
|
|
S_SET_EXTERNAL (symbolP);
|
|
|
|
S_SET_SEGMENT (symbolP, bfd_com_section_ptr);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
return symbolP;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_common (int is_common)
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
{
|
2003-12-13 09:23:05 +01:00
|
|
|
if (flag_mri && is_common)
|
|
|
|
s_mri_common (0);
|
|
|
|
else
|
|
|
|
s_comm_internal (0, elf_common_parse);
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_tls_common (int ignore ATTRIBUTE_UNUSED)
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
{
|
2003-12-13 09:23:05 +01:00
|
|
|
symbolS *symbolP = s_comm_internal (0, elf_common_parse);
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
|
|
|
|
if (symbolP)
|
|
|
|
symbol_get_bfdsym (symbolP)->flags |= BSF_THREAD_LOCAL;
|
|
|
|
}
|
|
|
|
|
2003-12-13 09:59:24 +01:00
|
|
|
static void
|
|
|
|
obj_elf_lcomm (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
symbolS *symbolP = s_comm_internal (0, s_lcomm_internal);
|
|
|
|
|
|
|
|
if (symbolP)
|
|
|
|
symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
|
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_local (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
int c;
|
|
|
|
symbolS *symbolP;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
name = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
symbolP = symbol_find_or_make (name);
|
|
|
|
*input_line_pointer = c;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
S_CLEAR_EXTERNAL (symbolP);
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
symbol_get_obj (symbolP)->local = 1;
|
1999-05-03 09:29:11 +02:00
|
|
|
if (c == ',')
|
|
|
|
{
|
|
|
|
input_line_pointer++;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == '\n')
|
|
|
|
c = '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (c == ',');
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_weak (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
int c;
|
|
|
|
symbolS *symbolP;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
name = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
symbolP = symbol_find_or_make (name);
|
|
|
|
*input_line_pointer = c;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
S_SET_WEAK (symbolP);
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
symbol_get_obj (symbolP)->local = 1;
|
1999-05-03 09:29:11 +02:00
|
|
|
if (c == ',')
|
|
|
|
{
|
|
|
|
input_line_pointer++;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == '\n')
|
|
|
|
c = '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (c == ',');
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
2000-01-03 19:34:24 +01:00
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_visibility (int visibility)
|
2000-01-03 19:34:24 +01:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
int c;
|
|
|
|
symbolS *symbolP;
|
|
|
|
asymbol *bfdsym;
|
|
|
|
elf_symbol_type *elfsym;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
name = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
symbolP = symbol_find_or_make (name);
|
|
|
|
*input_line_pointer = c;
|
2000-01-27 00:58:13 +01:00
|
|
|
|
2000-01-03 19:34:24 +01:00
|
|
|
SKIP_WHITESPACE ();
|
2000-01-27 00:58:13 +01:00
|
|
|
|
2000-01-03 19:34:24 +01:00
|
|
|
bfdsym = symbol_get_bfdsym (symbolP);
|
|
|
|
elfsym = elf_symbol_from (bfd_asymbol_bfd (bfdsym), bfdsym);
|
2000-01-27 00:58:13 +01:00
|
|
|
|
2000-01-03 19:34:24 +01:00
|
|
|
assert (elfsym);
|
2000-01-27 00:58:13 +01:00
|
|
|
|
2002-11-20 03:39:21 +01:00
|
|
|
elfsym->internal_elf_sym.st_other &= ~3;
|
|
|
|
elfsym->internal_elf_sym.st_other |= visibility;
|
2000-01-27 00:58:13 +01:00
|
|
|
|
2000-01-03 19:34:24 +01:00
|
|
|
if (c == ',')
|
|
|
|
{
|
|
|
|
input_line_pointer ++;
|
2000-01-27 00:58:13 +01:00
|
|
|
|
2000-01-03 19:34:24 +01:00
|
|
|
SKIP_WHITESPACE ();
|
2000-01-27 00:58:13 +01:00
|
|
|
|
2000-01-03 19:34:24 +01:00
|
|
|
if (*input_line_pointer == '\n')
|
|
|
|
c = '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (c == ',');
|
2000-01-27 00:58:13 +01:00
|
|
|
|
2000-01-03 19:34:24 +01:00
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
static segT previous_section;
|
|
|
|
static int previous_subsection;
|
|
|
|
|
1999-06-06 01:15:34 +02:00
|
|
|
struct section_stack
|
|
|
|
{
|
|
|
|
struct section_stack *next;
|
|
|
|
segT seg, prev_seg;
|
|
|
|
int subseg, prev_subseg;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct section_stack *section_stack;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* Handle the .section pseudo-op. This code supports two different
|
|
|
|
syntaxes.
|
|
|
|
|
|
|
|
The first is found on Solaris, and looks like
|
|
|
|
.section ".sec1",#alloc,#execinstr,#write
|
|
|
|
Here the names after '#' are the SHF_* flags to turn on for the
|
|
|
|
section. I'm not sure how it determines the SHT_* type (BFD
|
|
|
|
doesn't really give us control over the type, anyhow).
|
|
|
|
|
|
|
|
The second format is found on UnixWare, and probably most SVR4
|
|
|
|
machines, and looks like
|
|
|
|
.section .sec1,"a",@progbits
|
|
|
|
The quoted string may contain any combination of a, w, x, and
|
|
|
|
represents the SHF_* flags to turn on for the section. The string
|
|
|
|
beginning with '@' can be progbits or nobits. There should be
|
|
|
|
other possibilities, but I don't know what they are. In any case,
|
|
|
|
BFD doesn't really let us set the section type. */
|
|
|
|
|
2002-08-17 17:09:29 +02:00
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_change_section (const char *name,
|
|
|
|
int type,
|
|
|
|
int attr,
|
|
|
|
int entsize,
|
|
|
|
const char *group_name,
|
|
|
|
int linkonce,
|
|
|
|
int push)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2000-04-20 03:43:32 +02:00
|
|
|
asection *old_sec;
|
1999-05-03 09:29:11 +02:00
|
|
|
segT sec;
|
2000-04-20 03:43:32 +02:00
|
|
|
flagword flags;
|
2003-09-23 02:41:14 +02:00
|
|
|
const struct bfd_elf_special_section *ssect;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
1999-06-06 01:15:34 +02:00
|
|
|
/* Switch to the section, creating it if necessary. */
|
|
|
|
if (push)
|
|
|
|
{
|
|
|
|
struct section_stack *elt;
|
|
|
|
elt = xmalloc (sizeof (struct section_stack));
|
|
|
|
elt->next = section_stack;
|
|
|
|
elt->seg = now_seg;
|
|
|
|
elt->prev_seg = previous_section;
|
|
|
|
elt->subseg = now_subseg;
|
|
|
|
elt->prev_subseg = previous_subsection;
|
|
|
|
section_stack = elt;
|
|
|
|
}
|
|
|
|
previous_section = now_seg;
|
|
|
|
previous_subsection = now_subseg;
|
|
|
|
|
2000-04-20 03:43:32 +02:00
|
|
|
old_sec = bfd_get_section_by_name (stdoutput, name);
|
1999-06-06 01:15:34 +02:00
|
|
|
sec = subseg_new (name, 0);
|
2003-09-23 02:41:14 +02:00
|
|
|
ssect = _bfd_elf_get_sec_type_attr (stdoutput, name);
|
1999-06-06 01:15:34 +02:00
|
|
|
|
2003-09-23 02:41:14 +02:00
|
|
|
if (ssect != NULL)
|
2003-07-25 16:35:56 +02:00
|
|
|
{
|
2003-10-24 17:41:23 +02:00
|
|
|
bfd_boolean override = FALSE;
|
|
|
|
|
2003-07-25 16:35:56 +02:00
|
|
|
if (type == SHT_NULL)
|
2003-09-23 02:41:14 +02:00
|
|
|
type = ssect->type;
|
|
|
|
else if (type != ssect->type)
|
2003-07-25 16:35:56 +02:00
|
|
|
{
|
|
|
|
if (old_sec == NULL
|
|
|
|
/* FIXME: gcc, as of 2002-10-22, will emit
|
2002-10-22 12:56:45 +02:00
|
|
|
|
2003-07-25 16:35:56 +02:00
|
|
|
.section .init_array,"aw",@progbits
|
2002-10-22 12:56:45 +02:00
|
|
|
|
2003-07-25 16:35:56 +02:00
|
|
|
for __attribute__ ((section (".init_array"))).
|
|
|
|
"@progbits" is incorrect. */
|
2003-09-23 02:41:14 +02:00
|
|
|
&& ssect->type != SHT_INIT_ARRAY
|
|
|
|
&& ssect->type != SHT_FINI_ARRAY
|
|
|
|
&& ssect->type != SHT_PREINIT_ARRAY)
|
2003-07-25 16:35:56 +02:00
|
|
|
{
|
|
|
|
/* We allow to specify any type for a .note section. */
|
2003-09-23 02:41:14 +02:00
|
|
|
if (ssect->type != SHT_NOTE)
|
2003-07-25 16:35:56 +02:00
|
|
|
as_warn (_("setting incorrect section type for %s"),
|
|
|
|
name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
as_warn (_("ignoring incorrect section type for %s"),
|
2000-04-20 03:43:32 +02:00
|
|
|
name);
|
2003-09-23 02:41:14 +02:00
|
|
|
type = ssect->type;
|
2003-07-25 16:35:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-24 17:41:23 +02:00
|
|
|
if (old_sec == NULL && (attr & ~ssect->attr) != 0)
|
2003-07-25 16:35:56 +02:00
|
|
|
{
|
|
|
|
/* As a GNU extension, we permit a .note section to be
|
2003-09-23 02:41:14 +02:00
|
|
|
allocatable. If the linker sees an allocatable .note
|
2003-07-25 16:35:56 +02:00
|
|
|
section, it will create a PT_NOTE segment in the output
|
2003-07-30 16:11:03 +02:00
|
|
|
file. We also allow "x" for .note.GNU-stack. */
|
2003-09-23 02:41:14 +02:00
|
|
|
if (ssect->type == SHT_NOTE
|
|
|
|
&& (attr == SHF_ALLOC || attr == SHF_EXECINSTR))
|
|
|
|
;
|
|
|
|
/* Allow different SHF_MERGE and SHF_STRINGS if we have
|
|
|
|
something like .rodata.str. */
|
|
|
|
else if (ssect->suffix_length == -2
|
|
|
|
&& name[ssect->prefix_length] == '.'
|
2003-10-24 17:41:23 +02:00
|
|
|
&& (attr
|
|
|
|
& ~ssect->attr
|
|
|
|
& ~SHF_MERGE
|
|
|
|
& ~SHF_STRINGS) == 0)
|
2003-09-23 02:41:14 +02:00
|
|
|
;
|
2003-10-24 17:41:23 +02:00
|
|
|
/* .interp, .strtab and .symtab can have SHF_ALLOC. */
|
|
|
|
else if (attr == SHF_ALLOC
|
|
|
|
&& (strcmp (name, ".interp") == 0
|
|
|
|
|| strcmp (name, ".strtab") == 0
|
|
|
|
|| strcmp (name, ".symtab") == 0))
|
|
|
|
override = TRUE;
|
2003-09-23 02:41:14 +02:00
|
|
|
else
|
2003-10-24 17:41:23 +02:00
|
|
|
{
|
|
|
|
as_warn (_("setting incorrect section attributes for %s"),
|
|
|
|
name);
|
|
|
|
override = TRUE;
|
|
|
|
}
|
2003-07-25 16:35:56 +02:00
|
|
|
}
|
2003-10-24 17:41:23 +02:00
|
|
|
if (!override && old_sec == NULL)
|
2003-09-23 02:41:14 +02:00
|
|
|
attr |= ssect->attr;
|
2003-07-25 16:35:56 +02:00
|
|
|
}
|
2000-04-20 03:43:32 +02:00
|
|
|
|
2003-07-26 03:06:27 +02:00
|
|
|
if (type != SHT_NULL)
|
|
|
|
elf_section_type (sec) = type;
|
|
|
|
if (attr != 0)
|
|
|
|
elf_section_flags (sec) = attr;
|
2003-07-25 18:08:28 +02:00
|
|
|
|
2000-04-20 03:43:32 +02:00
|
|
|
/* Convert ELF type and flags to BFD flags. */
|
|
|
|
flags = (SEC_RELOC
|
|
|
|
| ((attr & SHF_WRITE) ? 0 : SEC_READONLY)
|
|
|
|
| ((attr & SHF_ALLOC) ? SEC_ALLOC : 0)
|
|
|
|
| (((attr & SHF_ALLOC) && type != SHT_NOBITS) ? SEC_LOAD : 0)
|
2001-04-13 02:34:36 +02:00
|
|
|
| ((attr & SHF_EXECINSTR) ? SEC_CODE : 0)
|
|
|
|
| ((attr & SHF_MERGE) ? SEC_MERGE : 0)
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
| ((attr & SHF_STRINGS) ? SEC_STRINGS : 0)
|
|
|
|
| ((attr & SHF_TLS) ? SEC_THREAD_LOCAL : 0));
|
1999-06-06 01:15:34 +02:00
|
|
|
#ifdef md_elf_section_flags
|
2000-04-20 03:43:32 +02:00
|
|
|
flags = md_elf_section_flags (flags, attr, type);
|
1999-06-06 01:15:34 +02:00
|
|
|
#endif
|
|
|
|
|
2000-04-20 03:43:32 +02:00
|
|
|
if (old_sec == NULL)
|
|
|
|
{
|
|
|
|
symbolS *secsym;
|
|
|
|
|
1999-06-06 01:15:34 +02:00
|
|
|
/* Prevent SEC_HAS_CONTENTS from being inadvertently set. */
|
|
|
|
if (type == SHT_NOBITS)
|
2003-12-13 09:59:24 +01:00
|
|
|
seg_info (sec)->bss = 1;
|
1999-06-06 01:15:34 +02:00
|
|
|
|
bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
to struct sec. Remove linkonce_p field.
(elf_linkonce_p): Delete.
(elf_discarded_section): Update for sec_info_type change.
* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
(ELF_INFO_TYPE_NONE): Define.
(ELF_INFO_TYPE_STABS): Define.
(ELF_INFO_TYPE_MERGE): Define.
(ELF_INFO_TYPE_EH_FRAME): Define.
(ELF_INFO_TYPE_JUST_SYMS): Define.
(STD_SECTION): Update struct sec initializer.
* ecoff.c (bfd_debug_section): Likewise.
* elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
* elflink.h: Likewise.
* elf-eh-frame.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
referring to used_by_bfd.
* elf64-sparc.c (sec_do_relax): Likewise.
* elf64-mmix.c (mmix_elf_section_data): Likewise.
* elfxx-mips.c (mips_elf_section_data): Likewise.
* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
(ieee_get_section_contents): Likewise.
(ieee_new_section_hook): Formatting.
(ieee_canonicalize_reloc): Remove commented out code.
* mmo.c (mmo_section_data): Define. Use throughout file.
* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
gas
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 13:34:08 +01:00
|
|
|
if (linkonce)
|
|
|
|
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
1999-06-06 01:15:34 +02:00
|
|
|
bfd_set_section_flags (stdoutput, sec, flags);
|
2001-04-13 02:34:36 +02:00
|
|
|
if (flags & SEC_MERGE)
|
|
|
|
sec->entsize = entsize;
|
2001-10-09 15:13:09 +02:00
|
|
|
elf_group_name (sec) = group_name;
|
1999-06-06 01:15:34 +02:00
|
|
|
|
|
|
|
/* Add a symbol for this section to the symbol table. */
|
|
|
|
secsym = symbol_find (name);
|
|
|
|
if (secsym != NULL)
|
|
|
|
symbol_set_bfdsym (secsym, sec->symbol);
|
|
|
|
else
|
2003-12-13 09:59:24 +01:00
|
|
|
symbol_table_insert (section_symbol (sec));
|
1999-06-06 01:15:34 +02:00
|
|
|
}
|
2000-04-20 03:43:32 +02:00
|
|
|
else if (attr != 0)
|
|
|
|
{
|
|
|
|
/* If section attributes are specified the second time we see a
|
|
|
|
particular section, then check that they are the same as we
|
|
|
|
saw the first time. */
|
2002-06-04 03:06:16 +02:00
|
|
|
if (((old_sec->flags ^ flags)
|
|
|
|
& (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
|
|
|
|
| SEC_EXCLUDE | SEC_SORT_ENTRIES | SEC_MERGE | SEC_STRINGS
|
bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
to struct sec. Remove linkonce_p field.
(elf_linkonce_p): Delete.
(elf_discarded_section): Update for sec_info_type change.
* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
(ELF_INFO_TYPE_NONE): Define.
(ELF_INFO_TYPE_STABS): Define.
(ELF_INFO_TYPE_MERGE): Define.
(ELF_INFO_TYPE_EH_FRAME): Define.
(ELF_INFO_TYPE_JUST_SYMS): Define.
(STD_SECTION): Update struct sec initializer.
* ecoff.c (bfd_debug_section): Likewise.
* elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
* elflink.h: Likewise.
* elf-eh-frame.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
referring to used_by_bfd.
* elf64-sparc.c (sec_do_relax): Likewise.
* elf64-mmix.c (mmix_elf_section_data): Likewise.
* elfxx-mips.c (mips_elf_section_data): Likewise.
* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
(ieee_get_section_contents): Likewise.
(ieee_new_section_hook): Formatting.
(ieee_canonicalize_reloc): Remove commented out code.
* mmo.c (mmo_section_data): Define. Use throughout file.
* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
gas
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 13:34:08 +01:00
|
|
|
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
|
|
|
|
| SEC_THREAD_LOCAL)))
|
2001-10-07 08:16:54 +02:00
|
|
|
as_warn (_("ignoring changed section attributes for %s"), name);
|
2002-06-04 03:06:16 +02:00
|
|
|
if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize)
|
2001-10-07 08:16:54 +02:00
|
|
|
as_warn (_("ignoring changed section entity size for %s"), name);
|
2002-06-04 03:06:16 +02:00
|
|
|
if ((attr & SHF_GROUP) != 0
|
|
|
|
&& strcmp (elf_group_name (old_sec), group_name) != 0)
|
2001-10-09 08:07:33 +02:00
|
|
|
as_warn (_("ignoring new section group for %s"), name);
|
2000-04-20 03:43:32 +02:00
|
|
|
}
|
1999-06-06 01:15:34 +02:00
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
2000-04-20 03:43:32 +02:00
|
|
|
md_elf_section_change_hook ();
|
1999-06-06 01:15:34 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2001-08-09 16:42:07 +02:00
|
|
|
static int
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_parse_section_letters (char *str, size_t len)
|
1999-06-06 01:15:34 +02:00
|
|
|
{
|
|
|
|
int attr = 0;
|
|
|
|
|
|
|
|
while (len > 0)
|
|
|
|
{
|
|
|
|
switch (*str)
|
|
|
|
{
|
|
|
|
case 'a':
|
|
|
|
attr |= SHF_ALLOC;
|
|
|
|
break;
|
|
|
|
case 'w':
|
|
|
|
attr |= SHF_WRITE;
|
|
|
|
break;
|
|
|
|
case 'x':
|
|
|
|
attr |= SHF_EXECINSTR;
|
|
|
|
break;
|
2001-09-11 18:46:38 +02:00
|
|
|
case 'M':
|
2001-04-13 02:34:36 +02:00
|
|
|
attr |= SHF_MERGE;
|
|
|
|
break;
|
2001-09-11 18:46:38 +02:00
|
|
|
case 'S':
|
2001-04-13 02:34:36 +02:00
|
|
|
attr |= SHF_STRINGS;
|
|
|
|
break;
|
2001-10-09 08:07:33 +02:00
|
|
|
case 'G':
|
|
|
|
attr |= SHF_GROUP;
|
|
|
|
break;
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
case 'T':
|
|
|
|
attr |= SHF_TLS;
|
|
|
|
break;
|
2001-10-01 08:30:19 +02:00
|
|
|
/* Compatibility. */
|
|
|
|
case 'm':
|
|
|
|
if (*(str - 1) == 'a')
|
|
|
|
{
|
|
|
|
attr |= SHF_MERGE;
|
|
|
|
if (len > 1 && str[1] == 's')
|
|
|
|
{
|
|
|
|
attr |= SHF_STRINGS;
|
|
|
|
str++, len--;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
1999-06-06 01:15:34 +02:00
|
|
|
default:
|
|
|
|
{
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 15:12:53 +02:00
|
|
|
char *bad_msg = _("unrecognized .section attribute: want a,w,x,M,S,G,T");
|
1999-06-06 01:15:34 +02:00
|
|
|
#ifdef md_elf_section_letter
|
|
|
|
int md_attr = md_elf_section_letter (*str, &bad_msg);
|
|
|
|
if (md_attr >= 0)
|
|
|
|
attr |= md_attr;
|
|
|
|
else
|
|
|
|
#endif
|
2003-05-03 18:04:12 +02:00
|
|
|
as_fatal ("%s", bad_msg);
|
1999-06-06 01:15:34 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
str++, len--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return attr;
|
|
|
|
}
|
|
|
|
|
2001-08-09 16:42:07 +02:00
|
|
|
static int
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_section_word (char *str, size_t len)
|
1999-06-06 01:15:34 +02:00
|
|
|
{
|
|
|
|
if (len == 5 && strncmp (str, "write", 5) == 0)
|
|
|
|
return SHF_WRITE;
|
|
|
|
if (len == 5 && strncmp (str, "alloc", 5) == 0)
|
|
|
|
return SHF_ALLOC;
|
|
|
|
if (len == 9 && strncmp (str, "execinstr", 9) == 0)
|
|
|
|
return SHF_EXECINSTR;
|
bfd/
* elf32-sparc.c (_bfd_sparc_elf_howto_table): Add TLS relocs.
(elf32_sparc_rev32_howto): New variable.
(sparc_reloc_map): Add TLS relocs.
(elf32_sparc_reloc_type_lookup, elf32_sparc_info_to_howto):
Handle REV32.
(sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_mkobject):
New functions.
(struct elf32_sparc_dyn_relocs, struct elf32_sparc_link_hash_entry,
struct elf32_sparc_link_hash_table):
New structures.
(elf32_sparc_tdata, elf32_sparc_local_got_tls_type,
elf32_sparc_hash_table): Define.
(link_hash_newfunc, elf32_sparc_link_hash_table_create,
create_got_section, elf32_sparc_create_dynamic_sections,
elf32_sparc_copy_indirect_symbol, elf32_sparc_tls_transition): New
functions.
(elf32_sparc_check_relocs): Handle TLS relocs. Add dynamic reloc
reference counting.
(elf32_sparc_gc_sweep_hook): Likewise.
(elf32_sparc_adjust_dynamic_symbol): Likewise.
(elf32_sparc_size_dynamic_sections): Likewise.
(elf32_sparc_relocate_section): Likewise.
(allocate_dynrelocs, readonly_dynrelocs, dtpoff_base, tpoff):
New functions.
(elf32_sparc_object_p): Allocate backend private object data.
(bfd_elf32_bfd_link_hash_table_create,
elf_backend_copy_indirect_symbol, bfd_elf32_mkobject,
elf_backend_can_refcount): Define.
(elf_backend_create_dynamic_sections): Define to
elf32_sparc_create_dynamic_sections.
* reloc.c: Add SPARC TLS relocs.
* bfd-in2.h, libbfd.h: Rebuilt.
* elf64-sparc.c (sparc64_elf_howto_table): Add TLS relocs.
(sparc_reloc_map): Likewise.
gas/
* config/tc-sparc.c (sparc_ip): Handle TLS % operators.
(tc_gen_reloc): Handle TLS relocs.
(sparc_cons, cons_fix_new_sparc): Handle %r_tls_dtpoff.
* config/tc-sparc.h (tc_fix_adjustable): Don't adjust TLS
relocs.
* config/obj-elf.c (obj_elf_section_word): Handle tls.
(obj_elf_type): Handle tls_object.
include/
* elf/sparc.h: Add TLS relocs. Move R_SPARC_REV32 to 252.
ld/testsuite/
* ld-sparc/sparc.exp: New.
* ld-sparc/tlsg32.s: New test.
* ld-sparc/tlsg32.sd: Likewise.
* ld-sparc/tlsg64.s: Likewise.
* ld-sparc/tlsg64.sd: Likewise.
* ld-sparc/tlslib.s: Likewise.
* ld-sparc/tlsnopic.s: Likewise.
* ld-sparc/tlspic.s: Likewise.
* ld-sparc/tlssunbin32.dd: Likewise.
* ld-sparc/tlssunbin32.rd: Likewise.
* ld-sparc/tlssunbin32.s: Likewise.
* ld-sparc/tlssunbin32.sd: Likewise.
* ld-sparc/tlssunbin32.td: Likewise.
* ld-sparc/tlssunbin64.dd: Likewise.
* ld-sparc/tlssunbin64.rd: Likewise.
* ld-sparc/tlssunbin64.s: Likewise.
* ld-sparc/tlssunbin64.sd: Likewise.
* ld-sparc/tlssunbin64.td: Likewise.
* ld-sparc/tlssunbinpic32.s: Likewise.
* ld-sparc/tlssunbinpic64.s: Likewise.
* ld-sparc/tlssunnopic32.dd: Likewise.
* ld-sparc/tlssunnopic32.rd: Likewise.
* ld-sparc/tlssunnopic32.s: Likewise.
* ld-sparc/tlssunnopic32.sd: Likewise.
* ld-sparc/tlssunnopic64.dd: Likewise.
* ld-sparc/tlssunnopic64.rd: Likewise.
* ld-sparc/tlssunnopic64.s: Likewise.
* ld-sparc/tlssunnopic64.sd: Likewise.
* ld-sparc/tlssunpic32.dd: Likewise.
* ld-sparc/tlssunpic32.rd: Likewise.
* ld-sparc/tlssunpic32.s: Likewise.
* ld-sparc/tlssunpic32.sd: Likewise.
* ld-sparc/tlssunpic32.td: Likewise.
* ld-sparc/tlssunpic64.dd: Likewise.
* ld-sparc/tlssunpic64.rd: Likewise.
* ld-sparc/tlssunpic64.s: Likewise.
* ld-sparc/tlssunpic64.sd: Likewise.
* ld-sparc/tlssunpic64.td: Likewise.
2003-01-25 00:44:45 +01:00
|
|
|
if (len == 3 && strncmp (str, "tls", 3) == 0)
|
|
|
|
return SHF_TLS;
|
1999-06-06 01:15:34 +02:00
|
|
|
|
|
|
|
#ifdef md_elf_section_word
|
|
|
|
{
|
|
|
|
int md_attr = md_elf_section_word (str, len);
|
|
|
|
if (md_attr >= 0)
|
|
|
|
return md_attr;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-10-07 08:16:54 +02:00
|
|
|
as_warn (_("unrecognized section attribute"));
|
1999-06-06 01:15:34 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-08-09 16:42:07 +02:00
|
|
|
static int
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_section_type (char *str, size_t len)
|
1999-06-06 01:15:34 +02:00
|
|
|
{
|
|
|
|
if (len == 8 && strncmp (str, "progbits", 8) == 0)
|
|
|
|
return SHT_PROGBITS;
|
|
|
|
if (len == 6 && strncmp (str, "nobits", 6) == 0)
|
|
|
|
return SHT_NOBITS;
|
2003-07-29 04:03:33 +02:00
|
|
|
if (len == 4 && strncmp (str, "note", 4) == 0)
|
|
|
|
return SHT_NOTE;
|
1999-06-06 01:15:34 +02:00
|
|
|
|
|
|
|
#ifdef md_elf_section_type
|
|
|
|
{
|
|
|
|
int md_type = md_elf_section_type (str, len);
|
|
|
|
if (md_type >= 0)
|
|
|
|
return md_type;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-10-07 08:16:54 +02:00
|
|
|
as_warn (_("unrecognized section type"));
|
1999-06-06 01:15:34 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-10-07 08:16:54 +02:00
|
|
|
/* Get name of section. */
|
|
|
|
static char *
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_section_name (void)
|
2001-10-07 08:16:54 +02:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == '"')
|
|
|
|
{
|
|
|
|
int dummy;
|
|
|
|
|
|
|
|
name = demand_copy_C_string (&dummy);
|
|
|
|
if (name == NULL)
|
|
|
|
{
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char *end = input_line_pointer;
|
|
|
|
|
|
|
|
while (0 == strchr ("\n\t,; ", *end))
|
|
|
|
end++;
|
|
|
|
if (end == input_line_pointer)
|
|
|
|
{
|
|
|
|
as_warn (_("missing name"));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
name = xmalloc (end - input_line_pointer + 1);
|
|
|
|
memcpy (name, input_line_pointer, end - input_line_pointer);
|
|
|
|
name[end - input_line_pointer] = '\0';
|
2003-05-02 04:46:36 +02:00
|
|
|
#ifdef tc_canonicalize_section_name
|
|
|
|
name = tc_canonicalize_section_name (name);
|
|
|
|
#endif
|
2001-10-07 08:16:54 +02:00
|
|
|
input_line_pointer = end;
|
|
|
|
}
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
1999-06-06 01:15:34 +02:00
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_section (int push)
|
1999-06-06 01:15:34 +02:00
|
|
|
{
|
2001-10-09 15:13:09 +02:00
|
|
|
char *name, *group_name, *beg;
|
1999-06-06 01:15:34 +02:00
|
|
|
int type, attr, dummy;
|
2001-04-13 02:34:36 +02:00
|
|
|
int entsize;
|
2002-06-04 03:06:16 +02:00
|
|
|
int linkonce;
|
1999-06-06 01:15:34 +02:00
|
|
|
|
2000-02-23 14:52:23 +01:00
|
|
|
#ifndef TC_I370
|
1999-05-03 09:29:11 +02:00
|
|
|
if (flag_mri)
|
|
|
|
{
|
|
|
|
char mri_type;
|
|
|
|
|
1999-06-06 01:15:34 +02:00
|
|
|
#ifdef md_flush_pending_output
|
2000-06-19 03:22:44 +02:00
|
|
|
md_flush_pending_output ();
|
1999-06-06 01:15:34 +02:00
|
|
|
#endif
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
previous_section = now_seg;
|
|
|
|
previous_subsection = now_subseg;
|
|
|
|
|
|
|
|
s_mri_sect (&mri_type);
|
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2000-02-23 14:52:23 +01:00
|
|
|
#endif /* ! defined (TC_I370) */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2001-10-07 08:16:54 +02:00
|
|
|
name = obj_elf_section_name ();
|
|
|
|
if (name == NULL)
|
|
|
|
return;
|
1999-05-03 09:29:11 +02:00
|
|
|
type = SHT_NULL;
|
|
|
|
attr = 0;
|
2001-10-09 15:13:09 +02:00
|
|
|
group_name = NULL;
|
2001-04-13 02:34:36 +02:00
|
|
|
entsize = 0;
|
2002-06-04 03:06:16 +02:00
|
|
|
linkonce = 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
{
|
|
|
|
/* Skip the comma. */
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
|
|
|
|
if (*input_line_pointer == '"')
|
|
|
|
{
|
1999-06-06 01:15:34 +02:00
|
|
|
beg = demand_copy_C_string (&dummy);
|
|
|
|
if (beg == NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
1999-06-06 01:15:34 +02:00
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
1999-06-06 01:15:34 +02:00
|
|
|
attr |= obj_elf_parse_section_letters (beg, strlen (beg));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
{
|
1999-06-06 01:15:34 +02:00
|
|
|
char c;
|
2001-10-09 08:07:33 +02:00
|
|
|
char *save = input_line_pointer;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
1999-06-06 01:15:34 +02:00
|
|
|
c = *input_line_pointer;
|
|
|
|
if (c == '"')
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
1999-06-06 01:15:34 +02:00
|
|
|
beg = demand_copy_C_string (&dummy);
|
|
|
|
if (beg == NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
1999-06-06 01:15:34 +02:00
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
1999-06-06 01:15:34 +02:00
|
|
|
type = obj_elf_section_type (beg, strlen (beg));
|
|
|
|
}
|
|
|
|
else if (c == '@' || c == '%')
|
|
|
|
{
|
|
|
|
beg = ++input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
*input_line_pointer = c;
|
|
|
|
type = obj_elf_section_type (beg, input_line_pointer - beg);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2001-10-09 08:07:33 +02:00
|
|
|
else
|
|
|
|
input_line_pointer = save;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2001-04-13 02:34:36 +02:00
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
2001-10-07 08:16:54 +02:00
|
|
|
if ((attr & SHF_MERGE) != 0 && *input_line_pointer == ',')
|
2001-04-13 02:34:36 +02:00
|
|
|
{
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
entsize = get_absolute_expression ();
|
2001-10-07 08:16:54 +02:00
|
|
|
SKIP_WHITESPACE ();
|
2001-04-13 02:34:36 +02:00
|
|
|
if (entsize < 0)
|
|
|
|
{
|
2001-10-07 08:16:54 +02:00
|
|
|
as_warn (_("invalid merge entity size"));
|
2001-04-13 02:34:36 +02:00
|
|
|
attr &= ~SHF_MERGE;
|
|
|
|
entsize = 0;
|
|
|
|
}
|
|
|
|
}
|
2001-10-07 08:16:54 +02:00
|
|
|
else if ((attr & SHF_MERGE) != 0)
|
|
|
|
{
|
|
|
|
as_warn (_("entity size for SHF_MERGE not specified"));
|
|
|
|
attr &= ~SHF_MERGE;
|
|
|
|
}
|
2001-10-09 08:07:33 +02:00
|
|
|
|
|
|
|
if ((attr & SHF_GROUP) != 0 && *input_line_pointer == ',')
|
|
|
|
{
|
|
|
|
++input_line_pointer;
|
2001-10-09 15:13:09 +02:00
|
|
|
group_name = obj_elf_section_name ();
|
|
|
|
if (group_name == NULL)
|
2001-10-09 08:07:33 +02:00
|
|
|
attr &= ~SHF_GROUP;
|
2002-06-04 03:06:16 +02:00
|
|
|
else if (strncmp (input_line_pointer, ",comdat", 7) == 0)
|
|
|
|
{
|
|
|
|
input_line_pointer += 7;
|
|
|
|
linkonce = 1;
|
|
|
|
}
|
|
|
|
else if (strncmp (name, ".gnu.linkonce", 13) == 0)
|
|
|
|
linkonce = 1;
|
2001-10-09 08:07:33 +02:00
|
|
|
}
|
|
|
|
else if ((attr & SHF_GROUP) != 0)
|
|
|
|
{
|
|
|
|
as_warn (_("group name for SHF_GROUP not specified"));
|
|
|
|
attr &= ~SHF_GROUP;
|
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
1999-06-06 01:15:34 +02:00
|
|
|
char c;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer != '#')
|
|
|
|
{
|
2001-10-07 08:16:54 +02:00
|
|
|
as_warn (_("character following name is not '#'"));
|
1999-05-03 09:29:11 +02:00
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
1999-06-06 01:15:34 +02:00
|
|
|
beg = ++input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
*input_line_pointer = c;
|
|
|
|
|
|
|
|
attr |= obj_elf_section_word (beg, input_line_pointer - beg);
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
}
|
|
|
|
while (*input_line_pointer++ == ',');
|
|
|
|
--input_line_pointer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
1999-06-06 01:15:34 +02:00
|
|
|
|
2002-06-04 03:06:16 +02:00
|
|
|
obj_elf_change_section (name, type, attr, entsize, group_name, linkonce, push);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Change to the .data section. */
|
|
|
|
|
1999-06-23 11:27:09 +02:00
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_data (int i)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
previous_section = now_seg;
|
|
|
|
previous_subsection = now_subseg;
|
|
|
|
s_data (i);
|
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Change to the .text section. */
|
|
|
|
|
1999-06-23 11:27:09 +02:00
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_text (int i)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
previous_section = now_seg;
|
|
|
|
previous_subsection = now_subseg;
|
|
|
|
s_text (i);
|
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_subsection (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
register int temp;
|
|
|
|
|
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
previous_section = now_seg;
|
|
|
|
previous_subsection = now_subseg;
|
|
|
|
|
|
|
|
temp = get_absolute_expression ();
|
|
|
|
subseg_set (now_seg, (subsegT) temp);
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This can be called from the processor backends if they change
|
|
|
|
sections. */
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_section_change_hook (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
previous_section = now_seg;
|
|
|
|
previous_subsection = now_subseg;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_previous (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
1999-06-06 01:15:34 +02:00
|
|
|
segT new_section;
|
|
|
|
int new_subsection;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
if (previous_section == 0)
|
|
|
|
{
|
2001-10-07 08:16:54 +02:00
|
|
|
as_warn (_(".previous without corresponding .section; ignored"));
|
1999-05-03 09:29:11 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
1999-06-06 01:15:34 +02:00
|
|
|
new_section = previous_section;
|
|
|
|
new_subsection = previous_subsection;
|
|
|
|
previous_section = now_seg;
|
|
|
|
previous_subsection = now_subseg;
|
|
|
|
subseg_set (new_section, new_subsection);
|
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_popsection (int xxx ATTRIBUTE_UNUSED)
|
1999-06-06 01:15:34 +02:00
|
|
|
{
|
|
|
|
struct section_stack *top = section_stack;
|
|
|
|
|
|
|
|
if (top == NULL)
|
|
|
|
{
|
2001-10-07 08:16:54 +02:00
|
|
|
as_warn (_(".popsection without corresponding .pushsection; ignored"));
|
1999-06-06 01:15:34 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
section_stack = top->next;
|
|
|
|
previous_section = top->prev_seg;
|
|
|
|
previous_subsection = top->prev_subseg;
|
|
|
|
subseg_set (top->seg, top->subseg);
|
|
|
|
free (top);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_line (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
/* Assume delimiter is part of expression. BSD4.2 as fails with
|
2000-09-14 13:48:26 +02:00
|
|
|
delightful bug, so we are not being incompatible here. */
|
2003-12-13 13:57:40 +01:00
|
|
|
new_logical_line (NULL, get_absolute_expression ());
|
1999-05-03 09:29:11 +02:00
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This handles the .symver pseudo-op, which is used to specify a
|
|
|
|
symbol version. The syntax is ``.symver NAME,SYMVERNAME''.
|
|
|
|
SYMVERNAME may contain ELF_VER_CHR ('@') characters. This
|
|
|
|
pseudo-op causes the assembler to emit a symbol named SYMVERNAME
|
|
|
|
with the same value as the symbol NAME. */
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_symver (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
char c;
|
2001-07-30 08:15:49 +02:00
|
|
|
char old_lexat;
|
1999-05-03 09:29:11 +02:00
|
|
|
symbolS *sym;
|
|
|
|
|
|
|
|
name = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
|
|
|
|
sym = symbol_find_or_make (name);
|
|
|
|
|
|
|
|
*input_line_pointer = c;
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer != ',')
|
|
|
|
{
|
|
|
|
as_bad (_("expected comma after name in .symver"));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
++input_line_pointer;
|
2003-04-29 13:52:37 +02:00
|
|
|
SKIP_WHITESPACE ();
|
1999-05-03 09:29:11 +02:00
|
|
|
name = input_line_pointer;
|
2001-07-30 08:15:49 +02:00
|
|
|
|
|
|
|
/* Temporarily include '@' in symbol names. */
|
|
|
|
old_lexat = lex_type[(unsigned char) '@'];
|
|
|
|
lex_type[(unsigned char) '@'] |= LEX_NAME;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
lex_type[(unsigned char) '@'] = old_lexat;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-08 01:24:23 +01:00
|
|
|
if (symbol_get_obj (sym)->versioned_name == NULL)
|
|
|
|
{
|
|
|
|
symbol_get_obj (sym)->versioned_name = xstrdup (name);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-08 01:24:23 +01:00
|
|
|
*input_line_pointer = c;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-16 20:29:12 +01:00
|
|
|
if (strchr (symbol_get_obj (sym)->versioned_name,
|
|
|
|
ELF_VER_CHR) == NULL)
|
2000-11-08 01:24:23 +01:00
|
|
|
{
|
|
|
|
as_bad (_("missing version name in `%s' for symbol `%s'"),
|
|
|
|
symbol_get_obj (sym)->versioned_name,
|
|
|
|
S_GET_NAME (sym));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2000-11-08 01:24:23 +01:00
|
|
|
if (strcmp (symbol_get_obj (sym)->versioned_name, name))
|
|
|
|
{
|
|
|
|
as_bad (_("multiple versions [`%s'|`%s'] for symbol `%s'"),
|
|
|
|
name, symbol_get_obj (sym)->versioned_name,
|
|
|
|
S_GET_NAME (sym));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
*input_line_pointer = c;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This handles the .vtable_inherit pseudo-op, which is used to indicate
|
|
|
|
to the linker the hierarchy in which a particular table resides. The
|
|
|
|
syntax is ".vtable_inherit CHILDNAME, PARENTNAME". */
|
|
|
|
|
2000-09-05 05:23:05 +02:00
|
|
|
struct fix *
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *cname, *pname;
|
|
|
|
symbolS *csym, *psym;
|
|
|
|
char c, bad = 0;
|
|
|
|
|
|
|
|
if (*input_line_pointer == '#')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
|
|
|
cname = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
csym = symbol_find (cname);
|
|
|
|
|
|
|
|
/* GCFIXME: should check that we don't have two .vtable_inherits for
|
|
|
|
the same child symbol. Also, we can currently only do this if the
|
|
|
|
child symbol is already exists and is placed in a fragment. */
|
|
|
|
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
if (csym == NULL || symbol_get_frag (csym) == NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
as_bad ("expected `%s' to have already been set for .vtable_inherit",
|
|
|
|
cname);
|
|
|
|
bad = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
*input_line_pointer = c;
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer != ',')
|
|
|
|
{
|
|
|
|
as_bad ("expected comma after name in .vtable_inherit");
|
|
|
|
ignore_rest_of_line ();
|
2000-09-05 05:23:05 +02:00
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
|
|
|
|
if (*input_line_pointer == '#')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
|
|
|
if (input_line_pointer[0] == '0'
|
|
|
|
&& (input_line_pointer[1] == '\0'
|
2001-09-19 07:33:36 +02:00
|
|
|
|| ISSPACE (input_line_pointer[1])))
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
psym = section_symbol (absolute_section);
|
|
|
|
++input_line_pointer;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pname = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
psym = symbol_find_or_make (pname);
|
|
|
|
*input_line_pointer = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
|
|
|
if (bad)
|
2000-09-05 05:23:05 +02:00
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
assert (symbol_get_value_expression (csym)->X_op == O_constant);
|
2000-09-05 05:23:05 +02:00
|
|
|
return fix_new (symbol_get_frag (csym),
|
|
|
|
symbol_get_value_expression (csym)->X_add_number,
|
|
|
|
0, psym, 0, 0, BFD_RELOC_VTABLE_INHERIT);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
2000-01-27 00:58:13 +01:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* This handles the .vtable_entry pseudo-op, which is used to indicate
|
|
|
|
to the linker that a vtable slot was used. The syntax is
|
|
|
|
".vtable_entry tablename, offset". */
|
|
|
|
|
2000-09-05 05:23:05 +02:00
|
|
|
struct fix *
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_vtable_entry (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
symbolS *sym;
|
|
|
|
offsetT offset;
|
|
|
|
char c;
|
|
|
|
|
|
|
|
if (*input_line_pointer == '#')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
|
|
|
name = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
sym = symbol_find_or_make (name);
|
|
|
|
*input_line_pointer = c;
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer != ',')
|
|
|
|
{
|
|
|
|
as_bad ("expected comma after name in .vtable_entry");
|
|
|
|
ignore_rest_of_line ();
|
2000-09-05 05:23:05 +02:00
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
++input_line_pointer;
|
|
|
|
if (*input_line_pointer == '#')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
|
|
|
offset = get_absolute_expression ();
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
2000-09-05 05:23:05 +02:00
|
|
|
|
|
|
|
return fix_new (frag_now, frag_now_fix (), 0, sym, offset, 0,
|
|
|
|
BFD_RELOC_VTABLE_ENTRY);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_obj_read_begin_hook (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
ecoff_read_begin_hook ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_obj_symbol_new_hook (symbolS *symbolP)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
struct elf_obj_sy *sy_obj;
|
|
|
|
|
|
|
|
sy_obj = symbol_get_obj (symbolP);
|
|
|
|
sy_obj->size = NULL;
|
|
|
|
sy_obj->versioned_name = NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
ecoff_symbol_new_hook (symbolP);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2001-08-08 15:11:58 +02:00
|
|
|
/* When setting one symbol equal to another, by default we probably
|
|
|
|
want them to have the same "size", whatever it means in the current
|
|
|
|
context. */
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_copy_symbol_attributes (symbolS *dest, symbolS *src)
|
2001-08-08 15:11:58 +02:00
|
|
|
{
|
2001-10-09 08:07:33 +02:00
|
|
|
struct elf_obj_sy *srcelf = symbol_get_obj (src);
|
|
|
|
struct elf_obj_sy *destelf = symbol_get_obj (dest);
|
|
|
|
if (srcelf->size)
|
|
|
|
{
|
|
|
|
if (destelf->size == NULL)
|
2003-12-13 13:57:40 +01:00
|
|
|
destelf->size = xmalloc (sizeof (expressionS));
|
2001-10-09 08:07:33 +02:00
|
|
|
*destelf->size = *srcelf->size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (destelf->size != NULL)
|
|
|
|
free (destelf->size);
|
|
|
|
destelf->size = NULL;
|
|
|
|
}
|
|
|
|
S_SET_SIZE (dest, S_GET_SIZE (src));
|
2002-03-01 19:36:08 +01:00
|
|
|
/* Don't copy visibility. */
|
|
|
|
S_SET_OTHER (dest, (ELF_ST_VISIBILITY (S_GET_OTHER (dest))
|
|
|
|
| (S_GET_OTHER (src) & ~ELF_ST_VISIBILITY (-1))));
|
2001-08-08 15:11:58 +02:00
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_version (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
unsigned int c;
|
|
|
|
char *p;
|
|
|
|
asection *seg = now_seg;
|
|
|
|
subsegT subseg = now_subseg;
|
|
|
|
Elf_Internal_Note i_note;
|
|
|
|
Elf_External_Note e_note;
|
2003-12-13 13:57:40 +01:00
|
|
|
asection *note_secp = NULL;
|
2001-11-13 04:24:25 +01:00
|
|
|
int len;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == '\"')
|
|
|
|
{
|
2000-09-14 13:48:26 +02:00
|
|
|
++input_line_pointer; /* -> 1st char of string. */
|
1999-05-03 09:29:11 +02:00
|
|
|
name = input_line_pointer;
|
|
|
|
|
|
|
|
while (is_a_char (c = next_char_of_string ()))
|
|
|
|
;
|
|
|
|
c = *input_line_pointer;
|
|
|
|
*input_line_pointer = '\0';
|
|
|
|
*(input_line_pointer - 1) = '\0';
|
|
|
|
*input_line_pointer = c;
|
|
|
|
|
|
|
|
/* create the .note section */
|
|
|
|
|
|
|
|
note_secp = subseg_new (".note", 0);
|
|
|
|
bfd_set_section_flags (stdoutput,
|
|
|
|
note_secp,
|
|
|
|
SEC_HAS_CONTENTS | SEC_READONLY);
|
|
|
|
|
|
|
|
/* process the version string */
|
|
|
|
|
|
|
|
len = strlen (name);
|
|
|
|
|
|
|
|
i_note.namesz = ((len + 1) + 3) & ~3; /* round this to word boundary */
|
|
|
|
i_note.descsz = 0; /* no description */
|
|
|
|
i_note.type = NT_VERSION;
|
|
|
|
p = frag_more (sizeof (e_note.namesz));
|
2003-12-13 13:57:40 +01:00
|
|
|
md_number_to_chars (p, i_note.namesz, sizeof (e_note.namesz));
|
1999-05-03 09:29:11 +02:00
|
|
|
p = frag_more (sizeof (e_note.descsz));
|
2003-12-13 13:57:40 +01:00
|
|
|
md_number_to_chars (p, i_note.descsz, sizeof (e_note.descsz));
|
1999-05-03 09:29:11 +02:00
|
|
|
p = frag_more (sizeof (e_note.type));
|
2003-12-13 13:57:40 +01:00
|
|
|
md_number_to_chars (p, i_note.type, sizeof (e_note.type));
|
2001-11-13 04:24:25 +01:00
|
|
|
p = frag_more (len + 1);
|
|
|
|
strcpy (p, name);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
frag_align (2, 0, 0);
|
|
|
|
|
|
|
|
subseg_set (seg, subseg);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-10-07 08:16:54 +02:00
|
|
|
as_bad (_("expected quoted string"));
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_size (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *name = input_line_pointer;
|
|
|
|
char c = get_symbol_end ();
|
|
|
|
char *p;
|
|
|
|
expressionS exp;
|
|
|
|
symbolS *sym;
|
|
|
|
|
|
|
|
p = input_line_pointer;
|
|
|
|
*p = c;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer != ',')
|
|
|
|
{
|
|
|
|
*p = 0;
|
|
|
|
as_bad (_("expected comma after name `%s' in .size directive"), name);
|
|
|
|
*p = c;
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
input_line_pointer++;
|
|
|
|
expression (&exp);
|
|
|
|
if (exp.X_op == O_absent)
|
|
|
|
{
|
|
|
|
as_bad (_("missing expression in .size directive"));
|
|
|
|
exp.X_op = O_constant;
|
|
|
|
exp.X_add_number = 0;
|
|
|
|
}
|
|
|
|
*p = 0;
|
|
|
|
sym = symbol_find_or_make (name);
|
|
|
|
*p = c;
|
|
|
|
if (exp.X_op == O_constant)
|
2001-08-23 22:43:01 +02:00
|
|
|
{
|
|
|
|
S_SET_SIZE (sym, exp.X_add_number);
|
|
|
|
if (symbol_get_obj (sym)->size)
|
|
|
|
{
|
|
|
|
xfree (symbol_get_obj (sym)->size);
|
|
|
|
symbol_get_obj (sym)->size = NULL;
|
|
|
|
}
|
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
else
|
|
|
|
{
|
2003-12-13 13:57:40 +01:00
|
|
|
symbol_get_obj (sym)->size = xmalloc (sizeof (expressionS));
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
*symbol_get_obj (sym)->size = exp;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the ELF .type pseudo-op. This sets the type of a symbol.
|
2000-07-29 05:20:54 +02:00
|
|
|
There are five syntaxes:
|
2000-01-27 00:58:13 +01:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
The first (used on Solaris) is
|
|
|
|
.type SYM,#function
|
|
|
|
The second (used on UnixWare) is
|
|
|
|
.type SYM,@function
|
|
|
|
The third (reportedly to be used on Irix 6.0) is
|
|
|
|
.type SYM STT_FUNC
|
|
|
|
The fourth (used on NetBSD/Arm and Linux/ARM) is
|
|
|
|
.type SYM,%function
|
2000-07-29 05:20:54 +02:00
|
|
|
The fifth (used on SVR4/860) is
|
|
|
|
.type SYM,"function"
|
1999-05-03 09:29:11 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_type (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
char c;
|
|
|
|
int type;
|
|
|
|
const char *typename;
|
|
|
|
symbolS *sym;
|
2000-09-05 05:23:05 +02:00
|
|
|
elf_symbol_type *elfsym;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
name = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
sym = symbol_find_or_make (name);
|
2000-09-05 05:23:05 +02:00
|
|
|
elfsym = (elf_symbol_type *) symbol_get_bfdsym (sym);
|
1999-05-03 09:29:11 +02:00
|
|
|
*input_line_pointer = c;
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if ( *input_line_pointer == '#'
|
|
|
|
|| *input_line_pointer == '@'
|
2000-07-29 05:20:54 +02:00
|
|
|
|| *input_line_pointer == '"'
|
1999-05-03 09:29:11 +02:00
|
|
|
|| *input_line_pointer == '%')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
|
|
|
typename = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
|
|
|
|
type = 0;
|
|
|
|
if (strcmp (typename, "function") == 0
|
|
|
|
|| strcmp (typename, "STT_FUNC") == 0)
|
|
|
|
type = BSF_FUNCTION;
|
|
|
|
else if (strcmp (typename, "object") == 0
|
|
|
|
|| strcmp (typename, "STT_OBJECT") == 0)
|
|
|
|
type = BSF_OBJECT;
|
bfd/
* elf32-sparc.c (_bfd_sparc_elf_howto_table): Add TLS relocs.
(elf32_sparc_rev32_howto): New variable.
(sparc_reloc_map): Add TLS relocs.
(elf32_sparc_reloc_type_lookup, elf32_sparc_info_to_howto):
Handle REV32.
(sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_mkobject):
New functions.
(struct elf32_sparc_dyn_relocs, struct elf32_sparc_link_hash_entry,
struct elf32_sparc_link_hash_table):
New structures.
(elf32_sparc_tdata, elf32_sparc_local_got_tls_type,
elf32_sparc_hash_table): Define.
(link_hash_newfunc, elf32_sparc_link_hash_table_create,
create_got_section, elf32_sparc_create_dynamic_sections,
elf32_sparc_copy_indirect_symbol, elf32_sparc_tls_transition): New
functions.
(elf32_sparc_check_relocs): Handle TLS relocs. Add dynamic reloc
reference counting.
(elf32_sparc_gc_sweep_hook): Likewise.
(elf32_sparc_adjust_dynamic_symbol): Likewise.
(elf32_sparc_size_dynamic_sections): Likewise.
(elf32_sparc_relocate_section): Likewise.
(allocate_dynrelocs, readonly_dynrelocs, dtpoff_base, tpoff):
New functions.
(elf32_sparc_object_p): Allocate backend private object data.
(bfd_elf32_bfd_link_hash_table_create,
elf_backend_copy_indirect_symbol, bfd_elf32_mkobject,
elf_backend_can_refcount): Define.
(elf_backend_create_dynamic_sections): Define to
elf32_sparc_create_dynamic_sections.
* reloc.c: Add SPARC TLS relocs.
* bfd-in2.h, libbfd.h: Rebuilt.
* elf64-sparc.c (sparc64_elf_howto_table): Add TLS relocs.
(sparc_reloc_map): Likewise.
gas/
* config/tc-sparc.c (sparc_ip): Handle TLS % operators.
(tc_gen_reloc): Handle TLS relocs.
(sparc_cons, cons_fix_new_sparc): Handle %r_tls_dtpoff.
* config/tc-sparc.h (tc_fix_adjustable): Don't adjust TLS
relocs.
* config/obj-elf.c (obj_elf_section_word): Handle tls.
(obj_elf_type): Handle tls_object.
include/
* elf/sparc.h: Add TLS relocs. Move R_SPARC_REV32 to 252.
ld/testsuite/
* ld-sparc/sparc.exp: New.
* ld-sparc/tlsg32.s: New test.
* ld-sparc/tlsg32.sd: Likewise.
* ld-sparc/tlsg64.s: Likewise.
* ld-sparc/tlsg64.sd: Likewise.
* ld-sparc/tlslib.s: Likewise.
* ld-sparc/tlsnopic.s: Likewise.
* ld-sparc/tlspic.s: Likewise.
* ld-sparc/tlssunbin32.dd: Likewise.
* ld-sparc/tlssunbin32.rd: Likewise.
* ld-sparc/tlssunbin32.s: Likewise.
* ld-sparc/tlssunbin32.sd: Likewise.
* ld-sparc/tlssunbin32.td: Likewise.
* ld-sparc/tlssunbin64.dd: Likewise.
* ld-sparc/tlssunbin64.rd: Likewise.
* ld-sparc/tlssunbin64.s: Likewise.
* ld-sparc/tlssunbin64.sd: Likewise.
* ld-sparc/tlssunbin64.td: Likewise.
* ld-sparc/tlssunbinpic32.s: Likewise.
* ld-sparc/tlssunbinpic64.s: Likewise.
* ld-sparc/tlssunnopic32.dd: Likewise.
* ld-sparc/tlssunnopic32.rd: Likewise.
* ld-sparc/tlssunnopic32.s: Likewise.
* ld-sparc/tlssunnopic32.sd: Likewise.
* ld-sparc/tlssunnopic64.dd: Likewise.
* ld-sparc/tlssunnopic64.rd: Likewise.
* ld-sparc/tlssunnopic64.s: Likewise.
* ld-sparc/tlssunnopic64.sd: Likewise.
* ld-sparc/tlssunpic32.dd: Likewise.
* ld-sparc/tlssunpic32.rd: Likewise.
* ld-sparc/tlssunpic32.s: Likewise.
* ld-sparc/tlssunpic32.sd: Likewise.
* ld-sparc/tlssunpic32.td: Likewise.
* ld-sparc/tlssunpic64.dd: Likewise.
* ld-sparc/tlssunpic64.rd: Likewise.
* ld-sparc/tlssunpic64.s: Likewise.
* ld-sparc/tlssunpic64.sd: Likewise.
* ld-sparc/tlssunpic64.td: Likewise.
2003-01-25 00:44:45 +01:00
|
|
|
else if (strcmp (typename, "tls_object") == 0
|
|
|
|
|| strcmp (typename, "STT_TLS") == 0)
|
|
|
|
type = BSF_OBJECT | BSF_THREAD_LOCAL;
|
2003-05-02 05:01:44 +02:00
|
|
|
else if (strcmp (typename, "notype") == 0
|
|
|
|
|| strcmp (typename, "STT_NOTYPE") == 0)
|
|
|
|
;
|
2000-09-05 05:23:05 +02:00
|
|
|
#ifdef md_elf_symbol_type
|
|
|
|
else if ((type = md_elf_symbol_type (typename, sym, elfsym)) != -1)
|
|
|
|
;
|
|
|
|
#endif
|
1999-05-03 09:29:11 +02:00
|
|
|
else
|
2001-10-07 08:16:54 +02:00
|
|
|
as_bad (_("unrecognized symbol type \"%s\""), typename);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
*input_line_pointer = c;
|
|
|
|
|
2000-07-29 05:20:54 +02:00
|
|
|
if (*input_line_pointer == '"')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
2000-09-05 05:23:05 +02:00
|
|
|
elfsym->symbol.flags |= type;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_ident (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
static segT comment_section;
|
|
|
|
segT old_section = now_seg;
|
|
|
|
int old_subsection = now_subseg;
|
|
|
|
|
1999-11-03 23:13:33 +01:00
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
if (!comment_section)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
comment_section = subseg_new (".comment", 0);
|
|
|
|
bfd_set_section_flags (stdoutput, comment_section,
|
|
|
|
SEC_READONLY | SEC_HAS_CONTENTS);
|
|
|
|
p = frag_more (1);
|
|
|
|
*p = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
subseg_set (comment_section, 0);
|
|
|
|
stringer (1);
|
|
|
|
subseg_set (old_section, old_subsection);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef INIT_STAB_SECTION
|
|
|
|
|
|
|
|
/* The first entry in a .stabs section is special. */
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
obj_elf_init_stab_section (segT seg)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *file;
|
|
|
|
char *p;
|
|
|
|
char *stabstr_name;
|
|
|
|
unsigned int stroff;
|
|
|
|
|
|
|
|
/* Force the section to align to a longword boundary. Without this,
|
|
|
|
UnixWare ar crashes. */
|
|
|
|
bfd_set_section_alignment (stdoutput, seg, 2);
|
|
|
|
|
2000-09-14 13:48:26 +02:00
|
|
|
/* Make space for this first symbol. */
|
1999-05-03 09:29:11 +02:00
|
|
|
p = frag_more (12);
|
2000-09-14 13:48:26 +02:00
|
|
|
/* Zero it out. */
|
1999-05-03 09:29:11 +02:00
|
|
|
memset (p, 0, 12);
|
2003-12-13 13:57:40 +01:00
|
|
|
as_where (&file, NULL);
|
|
|
|
stabstr_name = xmalloc (strlen (segment_name (seg)) + 4);
|
1999-05-03 09:29:11 +02:00
|
|
|
strcpy (stabstr_name, segment_name (seg));
|
|
|
|
strcat (stabstr_name, "str");
|
|
|
|
stroff = get_stab_string_offset (file, stabstr_name);
|
|
|
|
know (stroff == 1);
|
|
|
|
md_number_to_chars (p, stroff, 4);
|
|
|
|
seg_info (seg)->stabu.p = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Fill in the counts in the first entry in a .stabs section. */
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
asection *strsec;
|
|
|
|
char *p;
|
|
|
|
int strsz, nsyms;
|
|
|
|
|
|
|
|
if (strncmp (".stab", sec->name, 5))
|
|
|
|
return;
|
|
|
|
if (!strcmp ("str", sec->name + strlen (sec->name) - 3))
|
|
|
|
return;
|
|
|
|
|
2003-12-13 13:57:40 +01:00
|
|
|
name = alloca (strlen (sec->name) + 4);
|
1999-05-03 09:29:11 +02:00
|
|
|
strcpy (name, sec->name);
|
|
|
|
strcat (name, "str");
|
|
|
|
strsec = bfd_get_section_by_name (abfd, name);
|
|
|
|
if (strsec)
|
|
|
|
strsz = bfd_section_size (abfd, strsec);
|
|
|
|
else
|
|
|
|
strsz = 0;
|
|
|
|
nsyms = bfd_section_size (abfd, sec) / 12 - 1;
|
|
|
|
|
|
|
|
p = seg_info (sec)->stabu.p;
|
|
|
|
assert (p != 0);
|
|
|
|
|
2003-12-13 13:57:40 +01:00
|
|
|
bfd_h_put_16 (abfd, nsyms, p + 6);
|
|
|
|
bfd_h_put_32 (abfd, strsz, p + 8);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
|
|
|
|
/* This function is called by the ECOFF code. It is supposed to
|
|
|
|
record the external symbol information so that the backend can
|
|
|
|
write it out correctly. The ELF backend doesn't actually handle
|
|
|
|
this at the moment, so we do it ourselves. We save the information
|
|
|
|
in the symbol. */
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_ecoff_set_ext (symbolS *sym, struct ecoff_extr *ext)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2003-12-13 13:57:40 +01:00
|
|
|
symbol_get_bfdsym (sym)->udata.p = ext;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This function is called by bfd_ecoff_debug_externals. It is
|
|
|
|
supposed to *EXT to the external symbol information, and return
|
|
|
|
whether the symbol should be used at all. */
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
static bfd_boolean
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_get_extr (asymbol *sym, EXTR *ext)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (sym->udata.p == NULL)
|
2002-11-30 09:39:46 +01:00
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
*ext = *(EXTR *) sym->udata.p;
|
2002-11-30 09:39:46 +01:00
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This function is called by bfd_ecoff_debug_externals. It has
|
|
|
|
nothing to do for ELF. */
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_set_index (asymbol *sym ATTRIBUTE_UNUSED,
|
|
|
|
bfd_size_type indx ATTRIBUTE_UNUSED)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* NEED_ECOFF_DEBUG */
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_frob_symbol (symbolS *symp, int *puntp)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
struct elf_obj_sy *sy_obj;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
ecoff_frob_symbol (symp);
|
|
|
|
#endif
|
|
|
|
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
sy_obj = symbol_get_obj (symp);
|
|
|
|
|
|
|
|
if (sy_obj->size != NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
switch (sy_obj->size->X_op)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
case O_subtract:
|
|
|
|
S_SET_SIZE (symp,
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
(S_GET_VALUE (sy_obj->size->X_add_symbol)
|
|
|
|
+ sy_obj->size->X_add_number
|
|
|
|
- S_GET_VALUE (sy_obj->size->X_op_symbol)));
|
1999-05-03 09:29:11 +02:00
|
|
|
break;
|
|
|
|
case O_constant:
|
|
|
|
S_SET_SIZE (symp,
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
(S_GET_VALUE (sy_obj->size->X_add_symbol)
|
|
|
|
+ sy_obj->size->X_add_number));
|
1999-05-03 09:29:11 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
as_bad (_(".size expression too complicated to fix up"));
|
|
|
|
break;
|
|
|
|
}
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
free (sy_obj->size);
|
|
|
|
sy_obj->size = NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
if (sy_obj->versioned_name != NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2000-11-13 22:23:34 +01:00
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = strchr (sy_obj->versioned_name, ELF_VER_CHR);
|
|
|
|
know (p != NULL);
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* This symbol was given a new name with the .symver directive.
|
|
|
|
|
2003-12-13 09:59:24 +01:00
|
|
|
If this is an external reference, just rename the symbol to
|
|
|
|
include the version string. This will make the relocs be
|
|
|
|
against the correct versioned symbol.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
If this is a definition, add an alias. FIXME: Using an alias
|
|
|
|
will permit the debugging information to refer to the right
|
|
|
|
symbol. However, it's not clear whether it is the best
|
|
|
|
approach. */
|
|
|
|
|
|
|
|
if (! S_IS_DEFINED (symp))
|
|
|
|
{
|
|
|
|
/* Verify that the name isn't using the @@ syntax--this is
|
2003-12-13 09:59:24 +01:00
|
|
|
reserved for definitions of the default version to link
|
|
|
|
against. */
|
1999-05-03 09:29:11 +02:00
|
|
|
if (p[1] == ELF_VER_CHR)
|
|
|
|
{
|
|
|
|
as_bad (_("invalid attempt to declare external version name as default in symbol `%s'"),
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
sy_obj->versioned_name);
|
2002-11-30 09:39:46 +01:00
|
|
|
*puntp = TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
S_SET_NAME (symp, sy_obj->versioned_name);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-13 13:57:40 +01:00
|
|
|
if (p[1] == ELF_VER_CHR && p[2] == ELF_VER_CHR)
|
2000-11-13 22:23:34 +01:00
|
|
|
{
|
|
|
|
size_t l;
|
|
|
|
|
|
|
|
/* The @@@ syntax is a special case. It renames the
|
|
|
|
symbol name to versioned_name with one `@' removed. */
|
|
|
|
l = strlen (&p[3]) + 1;
|
2003-12-13 13:57:40 +01:00
|
|
|
memmove (&p[2], &p[3], l);
|
2000-11-13 22:23:34 +01:00
|
|
|
S_SET_NAME (symp, sy_obj->versioned_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
symbolS *symp2;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-13 22:23:34 +01:00
|
|
|
/* FIXME: Creating a new symbol here is risky. We're
|
|
|
|
in the final loop over the symbol table. We can
|
|
|
|
get away with it only because the symbol goes to
|
|
|
|
the end of the list, where the loop will still see
|
|
|
|
it. It would probably be better to do this in
|
|
|
|
obj_frob_file_before_adjust. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-13 22:23:34 +01:00
|
|
|
symp2 = symbol_find_or_make (sy_obj->versioned_name);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-13 22:23:34 +01:00
|
|
|
/* Now we act as though we saw symp2 = sym. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-13 22:23:34 +01:00
|
|
|
S_SET_SEGMENT (symp2, S_GET_SEGMENT (symp));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-13 22:23:34 +01:00
|
|
|
/* Subtracting out the frag address here is a hack
|
|
|
|
because we are in the middle of the final loop. */
|
|
|
|
S_SET_VALUE (symp2,
|
|
|
|
(S_GET_VALUE (symp)
|
|
|
|
- symbol_get_frag (symp)->fr_address));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-13 22:23:34 +01:00
|
|
|
symbol_set_frag (symp2, symbol_get_frag (symp));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-13 22:23:34 +01:00
|
|
|
/* This will copy over the size information. */
|
|
|
|
copy_symbol_attributes (symp2, symp);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2002-03-01 19:36:08 +01:00
|
|
|
S_SET_OTHER (symp2, S_GET_OTHER (symp));
|
|
|
|
|
2000-11-13 22:23:34 +01:00
|
|
|
if (S_IS_WEAK (symp))
|
|
|
|
S_SET_WEAK (symp2);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2000-11-13 22:23:34 +01:00
|
|
|
if (S_IS_EXTERNAL (symp))
|
|
|
|
S_SET_EXTERNAL (symp2);
|
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Double check weak symbols. */
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
if (S_IS_WEAK (symp))
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
if (S_IS_COMMON (symp))
|
2001-10-07 08:16:54 +02:00
|
|
|
as_bad (_("symbol `%s' can not be both weak and common"),
|
1999-05-03 09:29:11 +02:00
|
|
|
S_GET_NAME (symp));
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef TC_MIPS
|
|
|
|
/* The Irix 5 and 6 assemblers set the type of any common symbol and
|
|
|
|
any undefined non-function symbol to STT_OBJECT. We try to be
|
|
|
|
compatible, since newer Irix 5 and 6 linkers care. However, we
|
|
|
|
only set undefined symbols to be STT_OBJECT if we are on Irix,
|
|
|
|
because that is the only time gcc will generate the necessary
|
|
|
|
.global directives to mark functions. */
|
|
|
|
|
|
|
|
if (S_IS_COMMON (symp))
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
if (strstr (TARGET_OS, "irix") != NULL
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
&& ! S_IS_DEFINED (symp)
|
|
|
|
&& (symbol_get_bfdsym (symp)->flags & BSF_FUNCTION) == 0)
|
|
|
|
symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
|
1999-05-03 09:29:11 +02:00
|
|
|
#endif
|
|
|
|
|
2000-02-28 05:17:36 +01:00
|
|
|
#if 0 /* TC_PPC */
|
|
|
|
/* If TC_PPC is defined, we used to force the type of a symbol to be
|
|
|
|
BSF_OBJECT if it was otherwise unset. This was required by some
|
|
|
|
version of VxWorks. Thomas de Lellis <tdel@windriver.com> says
|
|
|
|
that this is no longer needed, so it is now commented out. */
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
if ((symbol_get_bfdsym (symp)->flags
|
|
|
|
& (BSF_FUNCTION | BSF_FILE | BSF_SECTION_SYM)) == 0
|
1999-05-03 09:29:11 +02:00
|
|
|
&& S_IS_DEFINED (symp))
|
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
1999-06-03 02:29:48 +02:00
|
|
|
symbol_get_bfdsym (symp)->flags |= BSF_OBJECT;
|
1999-05-03 09:29:11 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2001-10-09 08:07:33 +02:00
|
|
|
struct group_list
|
|
|
|
{
|
|
|
|
asection **head; /* Section lists. */
|
|
|
|
unsigned int *elt_count; /* Number of sections in each list. */
|
|
|
|
unsigned int num_group; /* Number of lists. */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Called via bfd_map_over_sections. If SEC is a member of a group,
|
|
|
|
add it to a list of sections belonging to the group. INF is a
|
|
|
|
pointer to a struct group_list, which is where we store the head of
|
|
|
|
each list. */
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
build_group_lists (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
|
2001-10-09 08:07:33 +02:00
|
|
|
{
|
2003-12-13 13:57:40 +01:00
|
|
|
struct group_list *list = inf;
|
2001-10-09 15:13:09 +02:00
|
|
|
const char *group_name = elf_group_name (sec);
|
2001-10-09 08:07:33 +02:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (group_name == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* If this group already has a list, add the section to the head of
|
|
|
|
the list. */
|
|
|
|
for (i = 0; i < list->num_group; i++)
|
|
|
|
{
|
2001-10-09 15:13:09 +02:00
|
|
|
if (strcmp (group_name, elf_group_name (list->head[i])) == 0)
|
2001-10-09 08:07:33 +02:00
|
|
|
{
|
2001-10-09 15:13:09 +02:00
|
|
|
elf_next_in_group (sec) = list->head[i];
|
2001-10-09 08:07:33 +02:00
|
|
|
list->head[i] = sec;
|
|
|
|
list->elt_count[i] += 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* New group. Make the arrays bigger in chunks to minimize calls to
|
|
|
|
realloc. */
|
|
|
|
i = list->num_group;
|
|
|
|
if ((i & 127) == 0)
|
|
|
|
{
|
|
|
|
unsigned int newsize = i + 128;
|
|
|
|
list->head = xrealloc (list->head, newsize * sizeof (*list->head));
|
|
|
|
list->elt_count = xrealloc (list->elt_count,
|
|
|
|
newsize * sizeof (*list->elt_count));
|
|
|
|
}
|
|
|
|
list->head[i] = sec;
|
|
|
|
list->elt_count[i] = 1;
|
|
|
|
list->num_group += 1;
|
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_frob_file (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2001-10-09 08:07:33 +02:00
|
|
|
struct group_list list;
|
|
|
|
unsigned int i;
|
|
|
|
|
2003-12-13 13:57:40 +01:00
|
|
|
bfd_map_over_sections (stdoutput, adjust_stab_sections, NULL);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2001-10-09 08:07:33 +02:00
|
|
|
/* Go find section groups. */
|
|
|
|
list.num_group = 0;
|
|
|
|
list.head = NULL;
|
|
|
|
list.elt_count = NULL;
|
2003-12-13 13:57:40 +01:00
|
|
|
bfd_map_over_sections (stdoutput, build_group_lists, &list);
|
2001-10-09 08:07:33 +02:00
|
|
|
|
|
|
|
/* Make the SHT_GROUP sections that describe each section group. We
|
|
|
|
can't set up the section contents here yet, because elf section
|
|
|
|
indices have yet to be calculated. elf.c:set_group_contents does
|
|
|
|
the rest of the work. */
|
|
|
|
for (i = 0; i < list.num_group; i++)
|
|
|
|
{
|
2001-10-09 15:13:09 +02:00
|
|
|
const char *group_name = elf_group_name (list.head[i]);
|
2002-06-07 16:57:50 +02:00
|
|
|
const char *sec_name;
|
2001-10-09 08:07:33 +02:00
|
|
|
asection *s;
|
|
|
|
flagword flags;
|
2002-06-07 16:57:50 +02:00
|
|
|
struct symbol *sy;
|
|
|
|
int has_sym;
|
2001-10-09 08:07:33 +02:00
|
|
|
|
|
|
|
flags = SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_GROUP;
|
2002-06-04 03:06:16 +02:00
|
|
|
for (s = list.head[i]; s != NULL; s = elf_next_in_group (s))
|
bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
to struct sec. Remove linkonce_p field.
(elf_linkonce_p): Delete.
(elf_discarded_section): Update for sec_info_type change.
* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
(ELF_INFO_TYPE_NONE): Define.
(ELF_INFO_TYPE_STABS): Define.
(ELF_INFO_TYPE_MERGE): Define.
(ELF_INFO_TYPE_EH_FRAME): Define.
(ELF_INFO_TYPE_JUST_SYMS): Define.
(STD_SECTION): Update struct sec initializer.
* ecoff.c (bfd_debug_section): Likewise.
* elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
* elflink.h: Likewise.
* elf-eh-frame.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
referring to used_by_bfd.
* elf64-sparc.c (sec_do_relax): Likewise.
* elf64-mmix.c (mmix_elf_section_data): Likewise.
* elfxx-mips.c (mips_elf_section_data): Likewise.
* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
(ieee_get_section_contents): Likewise.
(ieee_new_section_hook): Formatting.
(ieee_canonicalize_reloc): Remove commented out code.
* mmo.c (mmo_section_data): Define. Use throughout file.
* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
gas
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 13:34:08 +01:00
|
|
|
if ((s->flags ^ flags) & SEC_LINK_ONCE)
|
2002-06-04 03:06:16 +02:00
|
|
|
{
|
|
|
|
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
|
|
|
if (s != list.head[i])
|
|
|
|
{
|
|
|
|
as_warn (_("assuming all members of group `%s' are COMDAT"),
|
|
|
|
group_name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-07 16:57:50 +02:00
|
|
|
sec_name = group_name;
|
|
|
|
sy = symbol_find_exact (group_name);
|
|
|
|
has_sym = 0;
|
|
|
|
if (sy != NULL
|
|
|
|
&& (sy == symbol_lastP
|
|
|
|
|| (sy->sy_next != NULL
|
|
|
|
&& sy->sy_next->sy_previous == sy)))
|
|
|
|
{
|
|
|
|
has_sym = 1;
|
|
|
|
sec_name = ".group";
|
|
|
|
}
|
|
|
|
s = subseg_force_new (sec_name, 0);
|
2001-10-09 08:07:33 +02:00
|
|
|
if (s == NULL
|
|
|
|
|| !bfd_set_section_flags (stdoutput, s, flags)
|
|
|
|
|| !bfd_set_section_alignment (stdoutput, s, 2))
|
|
|
|
{
|
|
|
|
as_fatal (_("can't create group: %s"),
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
|
|
|
}
|
2003-07-25 16:35:56 +02:00
|
|
|
elf_section_type (s) = SHT_GROUP;
|
2001-10-09 08:07:33 +02:00
|
|
|
|
2001-10-09 15:13:09 +02:00
|
|
|
/* Pass a pointer to the first section in this group. */
|
|
|
|
elf_next_in_group (s) = list.head[i];
|
2002-06-07 16:57:50 +02:00
|
|
|
if (has_sym)
|
|
|
|
elf_group_id (s) = sy->bsym;
|
2001-10-09 08:07:33 +02:00
|
|
|
|
|
|
|
s->_raw_size = 4 * (list.elt_count[i] + 1);
|
|
|
|
s->contents = frag_more (s->_raw_size);
|
|
|
|
frag_now->fr_fix = frag_now_fix_octets ();
|
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
#ifdef elf_tc_final_processing
|
|
|
|
elf_tc_final_processing ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2000-11-14 21:57:30 +01:00
|
|
|
/* It removes any unneeded versioned symbols from the symbol table. */
|
2000-11-08 01:24:23 +01:00
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_frob_file_before_adjust (void)
|
2000-11-08 01:24:23 +01:00
|
|
|
{
|
|
|
|
if (symbol_rootP)
|
|
|
|
{
|
|
|
|
symbolS *symp;
|
|
|
|
|
|
|
|
for (symp = symbol_rootP; symp; symp = symbol_next (symp))
|
2002-01-28 14:34:39 +01:00
|
|
|
if (!S_IS_DEFINED (symp))
|
2000-11-13 22:23:34 +01:00
|
|
|
{
|
2002-01-28 14:34:39 +01:00
|
|
|
if (symbol_get_obj (symp)->versioned_name)
|
2000-11-13 22:23:34 +01:00
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
/* The @@@ syntax is a special case. If the symbol is
|
|
|
|
not defined, 2 `@'s will be removed from the
|
|
|
|
versioned_name. */
|
|
|
|
|
|
|
|
p = strchr (symbol_get_obj (symp)->versioned_name,
|
|
|
|
ELF_VER_CHR);
|
|
|
|
know (p != NULL);
|
2003-12-13 13:57:40 +01:00
|
|
|
if (p[1] == ELF_VER_CHR && p[2] == ELF_VER_CHR)
|
2000-11-13 22:23:34 +01:00
|
|
|
{
|
|
|
|
size_t l = strlen (&p[3]) + 1;
|
2003-12-13 13:57:40 +01:00
|
|
|
memmove (&p[1], &p[3], l);
|
2000-11-13 22:23:34 +01:00
|
|
|
}
|
|
|
|
if (symbol_used_p (symp) == 0
|
|
|
|
&& symbol_used_in_reloc_p (symp) == 0)
|
|
|
|
symbol_remove (symp, &symbol_rootP, &symbol_lastP);
|
|
|
|
}
|
2002-01-28 14:34:39 +01:00
|
|
|
|
|
|
|
/* If there was .weak foo, but foo was neither defined nor
|
|
|
|
used anywhere, remove it. */
|
|
|
|
|
|
|
|
else if (S_IS_WEAK (symp)
|
|
|
|
&& symbol_used_p (symp) == 0
|
|
|
|
&& symbol_used_in_reloc_p (symp) == 0)
|
|
|
|
symbol_remove (symp, &symbol_rootP, &symbol_lastP);
|
2000-11-13 22:23:34 +01:00
|
|
|
}
|
2000-11-08 01:24:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
/* It is required that we let write_relocs have the opportunity to
|
|
|
|
optimize away fixups before output has begun, since it is possible
|
|
|
|
to eliminate all fixups for a section and thus we never should
|
|
|
|
have generated the relocation section. */
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_frob_file_after_relocs (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
/* Generate the ECOFF debugging information. */
|
|
|
|
{
|
|
|
|
const struct ecoff_debug_swap *debug_swap;
|
|
|
|
struct ecoff_debug_info debug;
|
|
|
|
char *buf;
|
|
|
|
asection *sec;
|
|
|
|
|
|
|
|
debug_swap
|
|
|
|
= get_elf_backend_data (stdoutput)->elf_backend_ecoff_debug_swap;
|
2003-12-13 13:57:40 +01:00
|
|
|
know (debug_swap != NULL);
|
1999-05-03 09:29:11 +02:00
|
|
|
ecoff_build_debug (&debug.symbolic_header, &buf, debug_swap);
|
|
|
|
|
|
|
|
/* Set up the pointers in debug. */
|
|
|
|
#define SET(ptr, offset, type) \
|
|
|
|
debug.ptr = (type) (buf + debug.symbolic_header.offset)
|
|
|
|
|
|
|
|
SET (line, cbLineOffset, unsigned char *);
|
2003-12-13 13:57:40 +01:00
|
|
|
SET (external_dnr, cbDnOffset, void *);
|
|
|
|
SET (external_pdr, cbPdOffset, void *);
|
|
|
|
SET (external_sym, cbSymOffset, void *);
|
|
|
|
SET (external_opt, cbOptOffset, void *);
|
1999-05-03 09:29:11 +02:00
|
|
|
SET (external_aux, cbAuxOffset, union aux_ext *);
|
|
|
|
SET (ss, cbSsOffset, char *);
|
2003-12-13 13:57:40 +01:00
|
|
|
SET (external_fdr, cbFdOffset, void *);
|
|
|
|
SET (external_rfd, cbRfdOffset, void *);
|
1999-05-03 09:29:11 +02:00
|
|
|
/* ssext and external_ext are set up just below. */
|
|
|
|
|
|
|
|
#undef SET
|
|
|
|
|
|
|
|
/* Set up the external symbols. */
|
|
|
|
debug.ssext = debug.ssext_end = NULL;
|
|
|
|
debug.external_ext = debug.external_ext_end = NULL;
|
2002-11-30 09:39:46 +01:00
|
|
|
if (! bfd_ecoff_debug_externals (stdoutput, &debug, debug_swap, TRUE,
|
1999-05-03 09:29:11 +02:00
|
|
|
elf_get_extr, elf_set_index))
|
2001-10-07 08:16:54 +02:00
|
|
|
as_fatal (_("failed to set up debugging information: %s"),
|
1999-05-03 09:29:11 +02:00
|
|
|
bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
|
|
|
sec = bfd_get_section_by_name (stdoutput, ".mdebug");
|
|
|
|
assert (sec != NULL);
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
know (!stdoutput->output_has_begun);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
/* We set the size of the section, call bfd_set_section_contents
|
|
|
|
to force the ELF backend to allocate a file position, and then
|
|
|
|
write out the data. FIXME: Is this really the best way to do
|
|
|
|
this? */
|
|
|
|
sec->_raw_size = bfd_ecoff_debug_size (stdoutput, &debug, debug_swap);
|
|
|
|
|
1999-11-03 23:13:33 +01:00
|
|
|
/* Pass BUF to bfd_set_section_contents because this will
|
2003-12-13 09:59:24 +01:00
|
|
|
eventually become a call to fwrite, and ISO C prohibits
|
|
|
|
passing a NULL pointer to a stdio function even if the
|
|
|
|
pointer will not be used. */
|
2003-12-13 13:57:40 +01:00
|
|
|
if (! bfd_set_section_contents (stdoutput, sec, buf, 0, 0))
|
2001-10-07 08:16:54 +02:00
|
|
|
as_fatal (_("can't start writing .mdebug section: %s"),
|
1999-05-03 09:29:11 +02:00
|
|
|
bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
know (stdoutput->output_has_begun);
|
1999-05-03 09:29:11 +02:00
|
|
|
know (sec->filepos != 0);
|
|
|
|
|
|
|
|
if (! bfd_ecoff_write_debug (stdoutput, &debug, debug_swap,
|
|
|
|
sec->filepos))
|
2001-10-07 08:16:54 +02:00
|
|
|
as_fatal (_("could not write .mdebug section: %s"),
|
1999-05-03 09:29:11 +02:00
|
|
|
bfd_errmsg (bfd_get_error ()));
|
|
|
|
}
|
|
|
|
#endif /* NEED_ECOFF_DEBUG */
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef SCO_ELF
|
|
|
|
|
2003-11-20 01:01:55 +01:00
|
|
|
/* Heavily plagiarized from obj_elf_version. The idea is to emit the
|
1999-05-03 09:29:11 +02:00
|
|
|
SCO specific identifier in the .notes section to satisfy the SCO
|
|
|
|
linker.
|
|
|
|
|
|
|
|
This looks more complicated than it really is. As opposed to the
|
|
|
|
"obvious" solution, this should handle the cross dev cases
|
|
|
|
correctly. (i.e, hosting on a 64 bit big endian processor, but
|
|
|
|
generating SCO Elf code) Efficiency isn't a concern, as there
|
|
|
|
should be exactly one of these sections per object module.
|
|
|
|
|
|
|
|
SCO OpenServer 5 identifies it's ELF modules with a standard ELF
|
|
|
|
.note section.
|
|
|
|
|
2000-01-27 00:58:13 +01:00
|
|
|
int_32 namesz = 4 ; Name size
|
|
|
|
int_32 descsz = 12 ; Descriptive information
|
|
|
|
int_32 type = 1 ;
|
|
|
|
char name[4] = "SCO" ; Originator name ALWAYS SCO + NULL
|
1999-05-03 09:29:11 +02:00
|
|
|
int_32 version = (major ver # << 16) | version of tools ;
|
|
|
|
int_32 source = (tool_id << 16 ) | 1 ;
|
|
|
|
int_32 info = 0 ; These are set by the SCO tools, but we
|
2003-12-13 09:59:24 +01:00
|
|
|
don't know enough about the source
|
1999-05-03 09:29:11 +02:00
|
|
|
environment to set them. SCO ld currently
|
|
|
|
ignores them, and recommends we set them
|
|
|
|
to zero. */
|
|
|
|
|
|
|
|
#define SCO_MAJOR_VERSION 0x1
|
|
|
|
#define SCO_MINOR_VERSION 0x1
|
|
|
|
|
|
|
|
void
|
2003-12-13 13:57:40 +01:00
|
|
|
sco_id (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
char *name;
|
|
|
|
unsigned int c;
|
|
|
|
char ch;
|
|
|
|
char *p;
|
|
|
|
asection *seg = now_seg;
|
|
|
|
subsegT subseg = now_subseg;
|
|
|
|
Elf_Internal_Note i_note;
|
|
|
|
Elf_External_Note e_note;
|
2003-12-13 13:57:40 +01:00
|
|
|
asection *note_secp = NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
int i, 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 version string */
|
|
|
|
|
2000-01-27 00:58:13 +01:00
|
|
|
i_note.namesz = 4;
|
1999-05-03 09:29:11 +02:00
|
|
|
i_note.descsz = 12; /* 12 descriptive bytes */
|
|
|
|
i_note.type = NT_VERSION; /* Contains a version string */
|
|
|
|
|
|
|
|
p = frag_more (sizeof (i_note.namesz));
|
2003-12-13 13:57:40 +01:00
|
|
|
md_number_to_chars (p, i_note.namesz, 4);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
p = frag_more (sizeof (i_note.descsz));
|
2003-12-13 13:57:40 +01:00
|
|
|
md_number_to_chars (p, i_note.descsz, 4);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
p = frag_more (sizeof (i_note.type));
|
2003-12-13 13:57:40 +01:00
|
|
|
md_number_to_chars (p, i_note.type, 4);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
p = frag_more (4);
|
2000-01-27 00:58:13 +01:00
|
|
|
strcpy (p, "SCO");
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
/* Note: this is the version number of the ELF we're representing */
|
|
|
|
p = frag_more (4);
|
|
|
|
md_number_to_chars (p, (SCO_MAJOR_VERSION << 16) | (SCO_MINOR_VERSION), 4);
|
|
|
|
|
|
|
|
/* Here, we pick a magic number for ourselves (yes, I "registered"
|
|
|
|
it with SCO. The bottom bit shows that we are compat with the
|
|
|
|
SCO ABI. */
|
|
|
|
p = frag_more (4);
|
|
|
|
md_number_to_chars (p, 0x4c520000 | 0x0001, 4);
|
|
|
|
|
|
|
|
/* If we knew (or cared) what the source language options were, we'd
|
|
|
|
fill them in here. SCO has given us permission to ignore these
|
|
|
|
and just set them to zero. */
|
|
|
|
p = frag_more (4);
|
|
|
|
md_number_to_chars (p, 0x0000, 4);
|
2000-01-27 00:58:13 +01:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
frag_align (2, 0, 0);
|
|
|
|
|
|
|
|
/* We probably can't restore the current segment, for there likely
|
|
|
|
isn't one yet... */
|
|
|
|
if (seg && subseg)
|
|
|
|
subseg_set (seg, subseg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* SCO_ELF */
|
|
|
|
|
* 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 23:19:43 +02:00
|
|
|
static int
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_separate_stab_sections (void)
|
* 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 23:19:43 +02:00
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
return (!ECOFF_DEBUGGING);
|
|
|
|
#else
|
|
|
|
return 1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 13:57:40 +01:00
|
|
|
elf_init_stab_section (segT seg)
|
* 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 23:19:43 +02:00
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (!ECOFF_DEBUGGING)
|
|
|
|
#endif
|
|
|
|
obj_elf_init_stab_section (seg);
|
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
const struct format_ops elf_format_ops =
|
|
|
|
{
|
|
|
|
bfd_target_elf_flavour,
|
2000-01-26 23:48:31 +01:00
|
|
|
0, /* dfl_leading_underscore */
|
|
|
|
1, /* emit_section_symbols */
|
* 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 23:19:43 +02:00
|
|
|
elf_begin,
|
|
|
|
elf_file_symbol,
|
1999-05-03 09:29:11 +02:00
|
|
|
elf_frob_symbol,
|
|
|
|
elf_frob_file,
|
2000-11-08 01:24:23 +01:00
|
|
|
elf_frob_file_before_adjust,
|
2002-09-05 02:01:18 +02:00
|
|
|
0, /* obj_frob_file_before_fix */
|
1999-05-03 09:29:11 +02:00
|
|
|
elf_frob_file_after_relocs,
|
|
|
|
elf_s_get_size, elf_s_set_size,
|
|
|
|
elf_s_get_align, elf_s_set_align,
|
2000-01-26 23:48:31 +01:00
|
|
|
elf_s_get_other,
|
* 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 23:19:43 +02:00
|
|
|
elf_s_set_other,
|
2000-01-26 23:48:31 +01:00
|
|
|
0, /* s_get_desc */
|
* 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 23:19:43 +02:00
|
|
|
0, /* s_set_desc */
|
|
|
|
0, /* s_get_type */
|
|
|
|
0, /* s_set_type */
|
1999-05-03 09:29:11 +02:00
|
|
|
elf_copy_symbol_attributes,
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
ecoff_generate_asm_lineno,
|
|
|
|
ecoff_stab,
|
|
|
|
#else
|
2000-01-26 23:48:31 +01:00
|
|
|
0, /* generate_asm_lineno */
|
|
|
|
0, /* process_stab */
|
1999-05-03 09:29:11 +02:00
|
|
|
#endif
|
* 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 23:19:43 +02:00
|
|
|
elf_separate_stab_sections,
|
|
|
|
elf_init_stab_section,
|
1999-05-03 09:29:11 +02:00
|
|
|
elf_sec_sym_ok_for_reloc,
|
|
|
|
elf_pop_insert,
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
elf_ecoff_set_ext,
|
|
|
|
#else
|
2000-01-26 23:48:31 +01:00
|
|
|
0, /* ecoff_set_ext */
|
1999-05-03 09:29:11 +02:00
|
|
|
#endif
|
2000-01-26 23:48:31 +01:00
|
|
|
elf_obj_read_begin_hook,
|
* 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 23:19:43 +02:00
|
|
|
elf_obj_symbol_new_hook
|
1999-05-03 09:29:11 +02:00
|
|
|
};
|