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,
|
2012-02-02 10:26:04 +01:00
|
|
|
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
2007-07-03 05:29:40 +02:00
|
|
|
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
|
2007-07-03 13:01:12 +02:00
|
|
|
published by the Free Software Foundation; either version 3,
|
1999-05-03 09:29:11 +02:00
|
|
|
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
|
2005-05-05 11:13:19 +02:00
|
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
02110-1301, 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
|
|
|
|
|
2005-07-25 17:41:08 +02:00
|
|
|
#ifdef TC_I386
|
|
|
|
#include "elf/x86-64.h"
|
|
|
|
#endif
|
|
|
|
|
2007-02-05 21:10:25 +01:00
|
|
|
#ifdef TC_MEP
|
|
|
|
#include "elf/mep.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);
|
2005-04-15 13:38:59 +02:00
|
|
|
static void obj_elf_struct (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 },
|
2005-09-20 20:24:48 +02:00
|
|
|
{ "loc_mark_labels", dwarf2_directive_loc_mark_labels, 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},
|
2005-04-15 13:38:59 +02:00
|
|
|
{"offset", obj_elf_struct, 0},
|
|
|
|
{"struct", obj_elf_struct, 0},
|
1999-05-03 09:29:11 +02:00
|
|
|
{"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. */
|
|
|
|
|
2005-07-25 17:41:08 +02:00
|
|
|
asection *elf_com_section_ptr;
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
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));
|
2005-07-25 17:41:08 +02:00
|
|
|
elf_com_section_ptr = bfd_com_section_ptr;
|
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
|
2004-11-10 04:28:45 +01:00
|
|
|
elf_file_symbol (const char *s, int appfile)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2004-11-10 04:28:45 +01:00
|
|
|
if (!appfile
|
|
|
|
|| symbol_rootP == NULL
|
|
|
|
|| symbol_rootP->bsym == NULL
|
|
|
|
|| (symbol_rootP->bsym->flags & BSF_FILE) == 0)
|
|
|
|
{
|
|
|
|
symbolS *sym;
|
2009-07-27 12:04:25 +02:00
|
|
|
unsigned int name_length;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2004-11-10 04:28:45 +01:00
|
|
|
sym = symbol_new (s, absolute_section, 0, NULL);
|
|
|
|
symbol_set_frag (sym, &zero_address_frag);
|
2009-07-27 12:04:25 +02:00
|
|
|
|
|
|
|
name_length = strlen (s);
|
|
|
|
if (name_length > strlen (S_GET_NAME (sym)))
|
|
|
|
{
|
|
|
|
obstack_grow (¬es, s, name_length + 1);
|
2009-09-11 17:27:38 +02:00
|
|
|
S_SET_NAME (sym, (const char *) obstack_finish (¬es));
|
2009-07-27 12:04:25 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
strcpy ((char *) S_GET_NAME (sym), s);
|
|
|
|
|
2004-11-10 04:28:45 +01:00
|
|
|
symbol_get_bfdsym (sym)->flags |= BSF_FILE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2004-11-10 04:28:45 +01:00
|
|
|
if (symbol_rootP != sym)
|
|
|
|
{
|
|
|
|
symbol_remove (sym, &symbol_rootP, &symbol_lastP);
|
|
|
|
symbol_insert (sym, symbol_rootP, &symbol_rootP, &symbol_lastP);
|
1999-05-03 09:29:11 +02:00
|
|
|
#ifdef DEBUG
|
2004-11-10 04:28:45 +01:00
|
|
|
verify_symbol_chain (symbol_rootP, symbol_lastP);
|
1999-05-03 09:29:11 +02:00
|
|
|
#endif
|
2004-11-10 04:28:45 +01:00
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
2005-02-17 14:46:05 +01:00
|
|
|
ecoff_new_file (s, appfile);
|
1999-05-03 09:29:11 +02:00
|
|
|
#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. */
|
|
|
|
|
2005-07-25 17:41:08 +02:00
|
|
|
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);
|
2005-07-25 17:41:08 +02:00
|
|
|
S_SET_SEGMENT (symbolP, elf_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;
|
|
|
|
}
|
|
|
|
|
2010-07-15 16:34:42 +02:00
|
|
|
static symbolS *
|
|
|
|
get_sym_from_input_line_and_check (void)
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
char c;
|
|
|
|
symbolS *sym;
|
|
|
|
|
|
|
|
name = input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
sym = symbol_find_or_make (name);
|
|
|
|
*input_line_pointer = c;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
|
|
|
|
/* There is no symbol name if input_line_pointer has not moved. */
|
|
|
|
if (name == input_line_pointer)
|
|
|
|
as_bad (_("Missing symbol name in directive"));
|
|
|
|
return sym;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
int c;
|
|
|
|
symbolS *symbolP;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2010-08-17 22:03:41 +02:00
|
|
|
symbolP = get_sym_from_input_line_and_check ();
|
2010-07-15 16:34:42 +02:00
|
|
|
c = *input_line_pointer;
|
1999-05-03 09:29:11 +02:00
|
|
|
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
|
|
|
{
|
|
|
|
int c;
|
|
|
|
symbolS *symbolP;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2010-08-17 22:03:41 +02:00
|
|
|
symbolP = get_sym_from_input_line_and_check ();
|
2010-07-15 16:34:42 +02:00
|
|
|
c = *input_line_pointer;
|
1999-05-03 09:29:11 +02:00
|
|
|
S_SET_WEAK (symbolP);
|
|
|
|
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
|
|
|
{
|
|
|
|
int c;
|
|
|
|
symbolS *symbolP;
|
|
|
|
asymbol *bfdsym;
|
|
|
|
elf_symbol_type *elfsym;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2010-07-15 16:34:42 +02:00
|
|
|
symbolP = get_sym_from_input_line_and_check ();
|
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
|
|
|
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-22 19:56:02 +02:00
|
|
|
gas_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
|
|
|
|
2010-07-15 16:34:42 +02:00
|
|
|
c = *input_line_pointer;
|
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;
|
|
|
|
|
2004-05-02 16:36:25 +02:00
|
|
|
static bfd_boolean
|
2004-04-30 18:47:46 +02:00
|
|
|
get_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
|
|
|
|
{
|
2009-09-11 17:27:38 +02:00
|
|
|
const char *gname = (const char *) inf;
|
2004-04-30 18:47:46 +02:00
|
|
|
const char *group_name = elf_group_name (sec);
|
2009-07-25 01:49:51 +02:00
|
|
|
|
2004-05-02 16:36:25 +02:00
|
|
|
return (group_name == gname
|
2004-04-30 18:47:46 +02:00
|
|
|
|| (group_name != NULL
|
2004-05-02 16:36:25 +02:00
|
|
|
&& gname != NULL
|
|
|
|
&& strcmp (group_name, gname) == 0));
|
2004-04-30 18:47:46 +02:00
|
|
|
}
|
|
|
|
|
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,
|
* include/elf/ia64.h (SHT_IA_64_VMS_DISPLAY_NAME_INFO,
EF_IA_64_ARCHVER_1): New macros. Minor reformatting.
* bfd/Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo
(BFD32_BACKENDS_CFILES): Add new file vmsutil.c
(vmsutil.lo): Add dependency rule
* bfd/Makefile.in: Regenerate
* bfd/config.bfd (ia64*-*-*vms*): Add case.
* bfd/configure.in (bfd_elf64_ia64_vms_vec): Add case.
* bfd/configure: Regenerate
* bfd/vmsutil.[ch]: New files
* bfd/elf-bfd.h (struct bfd_elf_special_section): Change type of
attr to bfd_vma.
* bfd/elfxx-ia64.c (elfNN_vms_post_process_headers,
elfNN_vms_section_processing, elfNN_vms_final_write_processing,
elfNN_vms_close_and_cleanup, elfNN_vms_section_from_shdr,
elfNN_vms_object_p): New functions
* bfd/targets.c (bfd_elf64_ia64_vms_vec): New target.
* gas/configure.tgt(ia64-*-*vms*): New target.
* gas/dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern.
* gas/tc.h (md_number_to_chars): Declare iff undefined.
* gas/config/obj-elf.c (obj_elf_change_section): Change type of
arg attr to bfd_vma.
(obj_elf_parse_section_letters): Return a bfd_vma. Change type of
variables attr, md_attr to bfd_vma.
(obj_elf_section_word): Likewise.
(obj_elf_section): Change type of variable attr to bfd_vma
* gas/config/obj-elf.h (obj_elf_change_section): Change type of
arg attr to bfd_vma
* gas/config/tc-ia64.c (bfdver.h,time.h): Include.
(ia64_elf_section_letter): Now returns a bfd_vma.
Handle VMS specific attributes.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(ia64_init): Don't turn on dependency checking for VMS.
(ia64_target_format): Check for VMS flag bit.
(do_alias): Hande decc$ functions.
(get_vms_time): New function.
(ia64_vms_note): New function.
* gas/config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(tc_init_after_args): Define for VMS.
* gas/config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma.
(alpha_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-alpha.h: Likewise.
* gas/config/tc-i386.c (x86_64_section_letter): Return a bfd_vma.
(x86_64_section_word): Return a bfd_vma.
* gas/config/tc-i386.h: Likewise.
* gas/config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg
attr to bfd_vma.
* gas/config/tc-ip2k.h: Likewise.
* gas/config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma.
(mep_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-mep.h: Likewise.
* gas/config/tc-ppc.c (ppc_section_letter): Return a bfd_vma.
(ppc_section_word): Return a bfd_vma.
(ppc_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-ppc.h: Likewise.
* gas/config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR,
DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME):
New file with new macros
* gas/dwarf2dbg.c (get_filenum, out_file_list): Default and call new
macros.
2009-01-15 13:42:52 +01:00
|
|
|
bfd_vma attr,
|
2003-12-13 13:57:40 +01:00
|
|
|
int entsize,
|
|
|
|
const char *group_name,
|
|
|
|
int linkonce,
|
|
|
|
int push)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2004-05-02 16:36:25 +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;
|
2005-07-04 03:53:44 +02:00
|
|
|
const struct elf_backend_data *bed;
|
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;
|
2009-09-11 17:27:38 +02:00
|
|
|
elt = (struct section_stack *) xmalloc (sizeof (struct section_stack));
|
1999-06-06 01:15:34 +02:00
|
|
|
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;
|
|
|
|
|
2004-05-02 16:36:25 +02:00
|
|
|
old_sec = bfd_get_section_by_name_if (stdoutput, name, get_section,
|
|
|
|
(void *) group_name);
|
|
|
|
if (old_sec)
|
2004-04-30 18:47:46 +02:00
|
|
|
{
|
2004-05-02 16:36:25 +02:00
|
|
|
sec = old_sec;
|
2004-04-30 18:47:46 +02:00
|
|
|
subseg_set (sec, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sec = subseg_force_new (name, 0);
|
|
|
|
|
2005-07-04 03:53:44 +02:00
|
|
|
bed = get_elf_backend_data (stdoutput);
|
|
|
|
ssect = (*bed->get_sec_type_attr) (stdoutput, sec);
|
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
|
|
|
{
|
2004-05-02 16:36:25 +02:00
|
|
|
if (old_sec == NULL
|
2009-11-06 12:51:04 +01:00
|
|
|
/* Some older versions of gcc 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"))).
|
2005-07-25 17:41:08 +02:00
|
|
|
"@progbits" is incorrect. Also for x86-64 large bss
|
2009-11-06 12:51:04 +01:00
|
|
|
sections, some older versions of gcc will emit
|
2005-07-25 17:41:08 +02:00
|
|
|
|
|
|
|
.section .lbss,"aw",@progbits
|
|
|
|
|
2003-07-25 16:35:56 +02:00
|
|
|
"@progbits" is incorrect. */
|
2005-07-25 17:41:08 +02:00
|
|
|
#ifdef TC_I386
|
|
|
|
&& (bed->s->arch_size != 64
|
|
|
|
|| !(ssect->attr & SHF_X86_64_LARGE))
|
|
|
|
#endif
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-02 16:36:25 +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;
|
2004-05-03 06:08:32 +02:00
|
|
|
/* .note.GNU-stack can have SHF_EXECINSTR. */
|
|
|
|
else if (attr == SHF_EXECINSTR
|
|
|
|
&& strcmp (name, ".note.GNU-stack") == 0)
|
|
|
|
override = TRUE;
|
2006-05-05 20:24:45 +02:00
|
|
|
#ifdef TC_ALPHA
|
|
|
|
/* A section on Alpha may have SHF_ALPHA_GPREL. */
|
|
|
|
else if ((attr & ~ssect->attr) == SHF_ALPHA_GPREL)
|
|
|
|
override = TRUE;
|
2012-11-09 18:00:44 +01:00
|
|
|
#endif
|
|
|
|
#ifdef TC_RX
|
|
|
|
else if (attr == (SHF_EXECINSTR | SHF_WRITE | SHF_ALLOC)
|
|
|
|
&& (ssect->type == SHT_INIT_ARRAY
|
|
|
|
|| ssect->type == SHT_FINI_ARRAY
|
|
|
|
|| ssect->type == SHT_PREINIT_ARRAY))
|
|
|
|
/* RX init/fini arrays can and should have the "awx" attributes set. */
|
|
|
|
;
|
2006-05-05 20:24:45 +02:00
|
|
|
#endif
|
2003-09-23 02:41:14 +02:00
|
|
|
else
|
2003-10-24 17:41:23 +02:00
|
|
|
{
|
2004-04-30 18:47:46 +02:00
|
|
|
if (group_name == NULL)
|
|
|
|
as_warn (_("setting incorrect section attributes for %s"),
|
|
|
|
name);
|
2003-10-24 17:41:23 +02:00
|
|
|
override = TRUE;
|
|
|
|
}
|
2003-07-25 16:35:56 +02:00
|
|
|
}
|
2004-05-02 16:36:25 +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
|
|
|
|
|
|
|
/* 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)
|
2010-05-18 05:31:07 +02:00
|
|
|
| ((attr & SHF_EXCLUDE) ? SEC_EXCLUDE: 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_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
|
|
|
|
|
2004-04-30 18:47:46 +02:00
|
|
|
if (linkonce)
|
|
|
|
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
|
|
|
|
2004-05-02 16:36:25 +02:00
|
|
|
if (old_sec == NULL)
|
2000-04-20 03:43:32 +02:00
|
|
|
{
|
|
|
|
symbolS *secsym;
|
|
|
|
|
2009-08-31 14:02:36 +02:00
|
|
|
if (type == SHT_NULL)
|
|
|
|
type = bfd_elf_get_default_section_type (flags);
|
2004-12-16 14:23:22 +01:00
|
|
|
elf_section_type (sec) = type;
|
|
|
|
elf_section_flags (sec) = attr;
|
|
|
|
|
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_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
|
|
|
}
|
2004-12-16 14:23:22 +01:00
|
|
|
else
|
2000-04-20 03:43:32 +02:00
|
|
|
{
|
2004-12-16 14:23:22 +01:00
|
|
|
if (type != SHT_NULL
|
|
|
|
&& (unsigned) type != elf_section_type (old_sec))
|
|
|
|
as_warn (_("ignoring changed section type for %s"), name);
|
|
|
|
|
|
|
|
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. */
|
|
|
|
if (((old_sec->flags ^ flags)
|
|
|
|
& (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
|
|
|
|
| SEC_EXCLUDE | SEC_SORT_ENTRIES | SEC_MERGE | SEC_STRINGS
|
|
|
|
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
|
|
|
|
| SEC_THREAD_LOCAL)))
|
|
|
|
as_warn (_("ignoring changed section attributes for %s"), name);
|
|
|
|
if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize)
|
|
|
|
as_warn (_("ignoring changed section entity size 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
|
|
|
|
}
|
|
|
|
|
* include/elf/ia64.h (SHT_IA_64_VMS_DISPLAY_NAME_INFO,
EF_IA_64_ARCHVER_1): New macros. Minor reformatting.
* bfd/Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo
(BFD32_BACKENDS_CFILES): Add new file vmsutil.c
(vmsutil.lo): Add dependency rule
* bfd/Makefile.in: Regenerate
* bfd/config.bfd (ia64*-*-*vms*): Add case.
* bfd/configure.in (bfd_elf64_ia64_vms_vec): Add case.
* bfd/configure: Regenerate
* bfd/vmsutil.[ch]: New files
* bfd/elf-bfd.h (struct bfd_elf_special_section): Change type of
attr to bfd_vma.
* bfd/elfxx-ia64.c (elfNN_vms_post_process_headers,
elfNN_vms_section_processing, elfNN_vms_final_write_processing,
elfNN_vms_close_and_cleanup, elfNN_vms_section_from_shdr,
elfNN_vms_object_p): New functions
* bfd/targets.c (bfd_elf64_ia64_vms_vec): New target.
* gas/configure.tgt(ia64-*-*vms*): New target.
* gas/dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern.
* gas/tc.h (md_number_to_chars): Declare iff undefined.
* gas/config/obj-elf.c (obj_elf_change_section): Change type of
arg attr to bfd_vma.
(obj_elf_parse_section_letters): Return a bfd_vma. Change type of
variables attr, md_attr to bfd_vma.
(obj_elf_section_word): Likewise.
(obj_elf_section): Change type of variable attr to bfd_vma
* gas/config/obj-elf.h (obj_elf_change_section): Change type of
arg attr to bfd_vma
* gas/config/tc-ia64.c (bfdver.h,time.h): Include.
(ia64_elf_section_letter): Now returns a bfd_vma.
Handle VMS specific attributes.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(ia64_init): Don't turn on dependency checking for VMS.
(ia64_target_format): Check for VMS flag bit.
(do_alias): Hande decc$ functions.
(get_vms_time): New function.
(ia64_vms_note): New function.
* gas/config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(tc_init_after_args): Define for VMS.
* gas/config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma.
(alpha_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-alpha.h: Likewise.
* gas/config/tc-i386.c (x86_64_section_letter): Return a bfd_vma.
(x86_64_section_word): Return a bfd_vma.
* gas/config/tc-i386.h: Likewise.
* gas/config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg
attr to bfd_vma.
* gas/config/tc-ip2k.h: Likewise.
* gas/config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma.
(mep_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-mep.h: Likewise.
* gas/config/tc-ppc.c (ppc_section_letter): Return a bfd_vma.
(ppc_section_word): Return a bfd_vma.
(ppc_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-ppc.h: Likewise.
* gas/config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR,
DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME):
New file with new macros
* gas/dwarf2dbg.c (get_filenum, out_file_list): Default and call new
macros.
2009-01-15 13:42:52 +01:00
|
|
|
static bfd_vma
|
2012-02-02 10:26:04 +01:00
|
|
|
obj_elf_parse_section_letters (char *str, size_t len, bfd_boolean *is_clone)
|
1999-06-06 01:15:34 +02:00
|
|
|
{
|
* include/elf/ia64.h (SHT_IA_64_VMS_DISPLAY_NAME_INFO,
EF_IA_64_ARCHVER_1): New macros. Minor reformatting.
* bfd/Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo
(BFD32_BACKENDS_CFILES): Add new file vmsutil.c
(vmsutil.lo): Add dependency rule
* bfd/Makefile.in: Regenerate
* bfd/config.bfd (ia64*-*-*vms*): Add case.
* bfd/configure.in (bfd_elf64_ia64_vms_vec): Add case.
* bfd/configure: Regenerate
* bfd/vmsutil.[ch]: New files
* bfd/elf-bfd.h (struct bfd_elf_special_section): Change type of
attr to bfd_vma.
* bfd/elfxx-ia64.c (elfNN_vms_post_process_headers,
elfNN_vms_section_processing, elfNN_vms_final_write_processing,
elfNN_vms_close_and_cleanup, elfNN_vms_section_from_shdr,
elfNN_vms_object_p): New functions
* bfd/targets.c (bfd_elf64_ia64_vms_vec): New target.
* gas/configure.tgt(ia64-*-*vms*): New target.
* gas/dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern.
* gas/tc.h (md_number_to_chars): Declare iff undefined.
* gas/config/obj-elf.c (obj_elf_change_section): Change type of
arg attr to bfd_vma.
(obj_elf_parse_section_letters): Return a bfd_vma. Change type of
variables attr, md_attr to bfd_vma.
(obj_elf_section_word): Likewise.
(obj_elf_section): Change type of variable attr to bfd_vma
* gas/config/obj-elf.h (obj_elf_change_section): Change type of
arg attr to bfd_vma
* gas/config/tc-ia64.c (bfdver.h,time.h): Include.
(ia64_elf_section_letter): Now returns a bfd_vma.
Handle VMS specific attributes.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(ia64_init): Don't turn on dependency checking for VMS.
(ia64_target_format): Check for VMS flag bit.
(do_alias): Hande decc$ functions.
(get_vms_time): New function.
(ia64_vms_note): New function.
* gas/config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(tc_init_after_args): Define for VMS.
* gas/config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma.
(alpha_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-alpha.h: Likewise.
* gas/config/tc-i386.c (x86_64_section_letter): Return a bfd_vma.
(x86_64_section_word): Return a bfd_vma.
* gas/config/tc-i386.h: Likewise.
* gas/config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg
attr to bfd_vma.
* gas/config/tc-ip2k.h: Likewise.
* gas/config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma.
(mep_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-mep.h: Likewise.
* gas/config/tc-ppc.c (ppc_section_letter): Return a bfd_vma.
(ppc_section_word): Return a bfd_vma.
(ppc_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-ppc.h: Likewise.
* gas/config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR,
DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME):
New file with new macros
* gas/dwarf2dbg.c (get_filenum, out_file_list): Default and call new
macros.
2009-01-15 13:42:52 +01:00
|
|
|
bfd_vma attr = 0;
|
2012-02-02 10:26:04 +01:00
|
|
|
*is_clone = FALSE;
|
1999-06-06 01:15:34 +02:00
|
|
|
|
|
|
|
while (len > 0)
|
|
|
|
{
|
|
|
|
switch (*str)
|
|
|
|
{
|
|
|
|
case 'a':
|
|
|
|
attr |= SHF_ALLOC;
|
|
|
|
break;
|
2010-05-18 05:31:07 +02:00
|
|
|
case 'e':
|
|
|
|
attr |= SHF_EXCLUDE;
|
|
|
|
break;
|
1999-06-06 01:15:34 +02:00
|
|
|
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;
|
2010-08-17 22:03:41 +02:00
|
|
|
case '?':
|
2012-02-02 10:26:04 +01:00
|
|
|
*is_clone = TRUE;
|
2010-08-17 22:03:41 +02:00
|
|
|
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:
|
|
|
|
{
|
2010-05-18 05:31:07 +02:00
|
|
|
char *bad_msg = _("unrecognized .section attribute: want a,e,w,x,M,S,G,T");
|
1999-06-06 01:15:34 +02:00
|
|
|
#ifdef md_elf_section_letter
|
* include/elf/ia64.h (SHT_IA_64_VMS_DISPLAY_NAME_INFO,
EF_IA_64_ARCHVER_1): New macros. Minor reformatting.
* bfd/Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo
(BFD32_BACKENDS_CFILES): Add new file vmsutil.c
(vmsutil.lo): Add dependency rule
* bfd/Makefile.in: Regenerate
* bfd/config.bfd (ia64*-*-*vms*): Add case.
* bfd/configure.in (bfd_elf64_ia64_vms_vec): Add case.
* bfd/configure: Regenerate
* bfd/vmsutil.[ch]: New files
* bfd/elf-bfd.h (struct bfd_elf_special_section): Change type of
attr to bfd_vma.
* bfd/elfxx-ia64.c (elfNN_vms_post_process_headers,
elfNN_vms_section_processing, elfNN_vms_final_write_processing,
elfNN_vms_close_and_cleanup, elfNN_vms_section_from_shdr,
elfNN_vms_object_p): New functions
* bfd/targets.c (bfd_elf64_ia64_vms_vec): New target.
* gas/configure.tgt(ia64-*-*vms*): New target.
* gas/dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern.
* gas/tc.h (md_number_to_chars): Declare iff undefined.
* gas/config/obj-elf.c (obj_elf_change_section): Change type of
arg attr to bfd_vma.
(obj_elf_parse_section_letters): Return a bfd_vma. Change type of
variables attr, md_attr to bfd_vma.
(obj_elf_section_word): Likewise.
(obj_elf_section): Change type of variable attr to bfd_vma
* gas/config/obj-elf.h (obj_elf_change_section): Change type of
arg attr to bfd_vma
* gas/config/tc-ia64.c (bfdver.h,time.h): Include.
(ia64_elf_section_letter): Now returns a bfd_vma.
Handle VMS specific attributes.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(ia64_init): Don't turn on dependency checking for VMS.
(ia64_target_format): Check for VMS flag bit.
(do_alias): Hande decc$ functions.
(get_vms_time): New function.
(ia64_vms_note): New function.
* gas/config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(tc_init_after_args): Define for VMS.
* gas/config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma.
(alpha_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-alpha.h: Likewise.
* gas/config/tc-i386.c (x86_64_section_letter): Return a bfd_vma.
(x86_64_section_word): Return a bfd_vma.
* gas/config/tc-i386.h: Likewise.
* gas/config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg
attr to bfd_vma.
* gas/config/tc-ip2k.h: Likewise.
* gas/config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma.
(mep_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-mep.h: Likewise.
* gas/config/tc-ppc.c (ppc_section_letter): Return a bfd_vma.
(ppc_section_word): Return a bfd_vma.
(ppc_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-ppc.h: Likewise.
* gas/config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR,
DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME):
New file with new macros
* gas/dwarf2dbg.c (get_filenum, out_file_list): Default and call new
macros.
2009-01-15 13:42:52 +01:00
|
|
|
bfd_vma md_attr = md_elf_section_letter (*str, &bad_msg);
|
2010-09-17 01:55:10 +02:00
|
|
|
if (md_attr != (bfd_vma) -1)
|
1999-06-06 01:15:34 +02:00
|
|
|
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
|
2008-04-23 15:54:56 +02:00
|
|
|
obj_elf_section_type (char *str, size_t len, bfd_boolean warn)
|
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;
|
2004-09-08 22:52:49 +02:00
|
|
|
if (len == 10 && strncmp (str, "init_array", 10) == 0)
|
|
|
|
return SHT_INIT_ARRAY;
|
|
|
|
if (len == 10 && strncmp (str, "fini_array", 10) == 0)
|
|
|
|
return SHT_FINI_ARRAY;
|
|
|
|
if (len == 13 && strncmp (str, "preinit_array", 13) == 0)
|
|
|
|
return SHT_PREINIT_ARRAY;
|
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
|
|
|
|
|
2008-04-23 15:54:56 +02:00
|
|
|
if (warn)
|
|
|
|
as_warn (_("unrecognized section type"));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
* include/elf/ia64.h (SHT_IA_64_VMS_DISPLAY_NAME_INFO,
EF_IA_64_ARCHVER_1): New macros. Minor reformatting.
* bfd/Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo
(BFD32_BACKENDS_CFILES): Add new file vmsutil.c
(vmsutil.lo): Add dependency rule
* bfd/Makefile.in: Regenerate
* bfd/config.bfd (ia64*-*-*vms*): Add case.
* bfd/configure.in (bfd_elf64_ia64_vms_vec): Add case.
* bfd/configure: Regenerate
* bfd/vmsutil.[ch]: New files
* bfd/elf-bfd.h (struct bfd_elf_special_section): Change type of
attr to bfd_vma.
* bfd/elfxx-ia64.c (elfNN_vms_post_process_headers,
elfNN_vms_section_processing, elfNN_vms_final_write_processing,
elfNN_vms_close_and_cleanup, elfNN_vms_section_from_shdr,
elfNN_vms_object_p): New functions
* bfd/targets.c (bfd_elf64_ia64_vms_vec): New target.
* gas/configure.tgt(ia64-*-*vms*): New target.
* gas/dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern.
* gas/tc.h (md_number_to_chars): Declare iff undefined.
* gas/config/obj-elf.c (obj_elf_change_section): Change type of
arg attr to bfd_vma.
(obj_elf_parse_section_letters): Return a bfd_vma. Change type of
variables attr, md_attr to bfd_vma.
(obj_elf_section_word): Likewise.
(obj_elf_section): Change type of variable attr to bfd_vma
* gas/config/obj-elf.h (obj_elf_change_section): Change type of
arg attr to bfd_vma
* gas/config/tc-ia64.c (bfdver.h,time.h): Include.
(ia64_elf_section_letter): Now returns a bfd_vma.
Handle VMS specific attributes.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(ia64_init): Don't turn on dependency checking for VMS.
(ia64_target_format): Check for VMS flag bit.
(do_alias): Hande decc$ functions.
(get_vms_time): New function.
(ia64_vms_note): New function.
* gas/config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(tc_init_after_args): Define for VMS.
* gas/config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma.
(alpha_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-alpha.h: Likewise.
* gas/config/tc-i386.c (x86_64_section_letter): Return a bfd_vma.
(x86_64_section_word): Return a bfd_vma.
* gas/config/tc-i386.h: Likewise.
* gas/config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg
attr to bfd_vma.
* gas/config/tc-ip2k.h: Likewise.
* gas/config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma.
(mep_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-mep.h: Likewise.
* gas/config/tc-ppc.c (ppc_section_letter): Return a bfd_vma.
(ppc_section_word): Return a bfd_vma.
(ppc_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-ppc.h: Likewise.
* gas/config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR,
DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME):
New file with new macros
* gas/dwarf2dbg.c (get_filenum, out_file_list): Default and call new
macros.
2009-01-15 13:42:52 +01:00
|
|
|
static bfd_vma
|
2008-04-23 15:54:56 +02:00
|
|
|
obj_elf_section_word (char *str, size_t len, int *type)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
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;
|
2010-05-18 05:31:07 +02:00
|
|
|
if (len == 7 && strncmp (str, "exclude", 7) == 0)
|
|
|
|
return SHF_EXCLUDE;
|
2008-04-23 15:54:56 +02:00
|
|
|
if (len == 3 && strncmp (str, "tls", 3) == 0)
|
|
|
|
return SHF_TLS;
|
|
|
|
|
|
|
|
#ifdef md_elf_section_word
|
|
|
|
{
|
* include/elf/ia64.h (SHT_IA_64_VMS_DISPLAY_NAME_INFO,
EF_IA_64_ARCHVER_1): New macros. Minor reformatting.
* bfd/Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo
(BFD32_BACKENDS_CFILES): Add new file vmsutil.c
(vmsutil.lo): Add dependency rule
* bfd/Makefile.in: Regenerate
* bfd/config.bfd (ia64*-*-*vms*): Add case.
* bfd/configure.in (bfd_elf64_ia64_vms_vec): Add case.
* bfd/configure: Regenerate
* bfd/vmsutil.[ch]: New files
* bfd/elf-bfd.h (struct bfd_elf_special_section): Change type of
attr to bfd_vma.
* bfd/elfxx-ia64.c (elfNN_vms_post_process_headers,
elfNN_vms_section_processing, elfNN_vms_final_write_processing,
elfNN_vms_close_and_cleanup, elfNN_vms_section_from_shdr,
elfNN_vms_object_p): New functions
* bfd/targets.c (bfd_elf64_ia64_vms_vec): New target.
* gas/configure.tgt(ia64-*-*vms*): New target.
* gas/dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern.
* gas/tc.h (md_number_to_chars): Declare iff undefined.
* gas/config/obj-elf.c (obj_elf_change_section): Change type of
arg attr to bfd_vma.
(obj_elf_parse_section_letters): Return a bfd_vma. Change type of
variables attr, md_attr to bfd_vma.
(obj_elf_section_word): Likewise.
(obj_elf_section): Change type of variable attr to bfd_vma
* gas/config/obj-elf.h (obj_elf_change_section): Change type of
arg attr to bfd_vma
* gas/config/tc-ia64.c (bfdver.h,time.h): Include.
(ia64_elf_section_letter): Now returns a bfd_vma.
Handle VMS specific attributes.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(ia64_init): Don't turn on dependency checking for VMS.
(ia64_target_format): Check for VMS flag bit.
(do_alias): Hande decc$ functions.
(get_vms_time): New function.
(ia64_vms_note): New function.
* gas/config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(tc_init_after_args): Define for VMS.
* gas/config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma.
(alpha_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-alpha.h: Likewise.
* gas/config/tc-i386.c (x86_64_section_letter): Return a bfd_vma.
(x86_64_section_word): Return a bfd_vma.
* gas/config/tc-i386.h: Likewise.
* gas/config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg
attr to bfd_vma.
* gas/config/tc-ip2k.h: Likewise.
* gas/config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma.
(mep_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-mep.h: Likewise.
* gas/config/tc-ppc.c (ppc_section_letter): Return a bfd_vma.
(ppc_section_word): Return a bfd_vma.
(ppc_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-ppc.h: Likewise.
* gas/config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR,
DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME):
New file with new macros
* gas/dwarf2dbg.c (get_filenum, out_file_list): Default and call new
macros.
2009-01-15 13:42:52 +01:00
|
|
|
bfd_vma md_attr = md_elf_section_word (str, len);
|
|
|
|
if (md_attr > 0)
|
2008-04-23 15:54:56 +02:00
|
|
|
return md_attr;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ret = obj_elf_section_type (str, len, FALSE);
|
|
|
|
if (ret != 0)
|
|
|
|
*type = ret;
|
|
|
|
else
|
|
|
|
as_warn (_("unrecognized section attribute"));
|
|
|
|
|
1999-06-06 01:15:34 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-10-07 08:16:54 +02:00
|
|
|
/* Get name of section. */
|
2010-01-13 15:08:54 +01:00
|
|
|
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)
|
|
|
|
{
|
2004-03-18 14:31:04 +01:00
|
|
|
as_bad (_("missing name"));
|
2001-10-07 08:16:54 +02:00
|
|
|
ignore_rest_of_line ();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-09-11 17:27:38 +02:00
|
|
|
name = (char *) xmalloc (end - input_line_pointer + 1);
|
2001-10-07 08:16:54 +02:00
|
|
|
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;
|
* include/elf/ia64.h (SHT_IA_64_VMS_DISPLAY_NAME_INFO,
EF_IA_64_ARCHVER_1): New macros. Minor reformatting.
* bfd/Makefile.am (BFD32_BACKENDS): Add new object vmsutil.lo
(BFD32_BACKENDS_CFILES): Add new file vmsutil.c
(vmsutil.lo): Add dependency rule
* bfd/Makefile.in: Regenerate
* bfd/config.bfd (ia64*-*-*vms*): Add case.
* bfd/configure.in (bfd_elf64_ia64_vms_vec): Add case.
* bfd/configure: Regenerate
* bfd/vmsutil.[ch]: New files
* bfd/elf-bfd.h (struct bfd_elf_special_section): Change type of
attr to bfd_vma.
* bfd/elfxx-ia64.c (elfNN_vms_post_process_headers,
elfNN_vms_section_processing, elfNN_vms_final_write_processing,
elfNN_vms_close_and_cleanup, elfNN_vms_section_from_shdr,
elfNN_vms_object_p): New functions
* bfd/targets.c (bfd_elf64_ia64_vms_vec): New target.
* gas/configure.tgt(ia64-*-*vms*): New target.
* gas/dwarf2dbg.h (dwarf2_loc_mark_labels): Make extern.
* gas/tc.h (md_number_to_chars): Declare iff undefined.
* gas/config/obj-elf.c (obj_elf_change_section): Change type of
arg attr to bfd_vma.
(obj_elf_parse_section_letters): Return a bfd_vma. Change type of
variables attr, md_attr to bfd_vma.
(obj_elf_section_word): Likewise.
(obj_elf_section): Change type of variable attr to bfd_vma
* gas/config/obj-elf.h (obj_elf_change_section): Change type of
arg attr to bfd_vma
* gas/config/tc-ia64.c (bfdver.h,time.h): Include.
(ia64_elf_section_letter): Now returns a bfd_vma.
Handle VMS specific attributes.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(ia64_init): Don't turn on dependency checking for VMS.
(ia64_target_format): Check for VMS flag bit.
(do_alias): Hande decc$ functions.
(get_vms_time): New function.
(ia64_vms_note): New function.
* gas/config/tc-ia64.h (ia64_elf_section_letter): Now returns a bfd_vma.
(ia64_elf_section_flags): Arg attr now a bfd_vma.
(tc_init_after_args): Define for VMS.
* gas/config/tc-alpha.c (alpha_elf_section_letter): Return a bfd_vma.
(alpha_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-alpha.h: Likewise.
* gas/config/tc-i386.c (x86_64_section_letter): Return a bfd_vma.
(x86_64_section_word): Return a bfd_vma.
* gas/config/tc-i386.h: Likewise.
* gas/config/tc-ip2k.c (ip2k_elf_section_flags): Change type of arg
attr to bfd_vma.
* gas/config/tc-ip2k.h: Likewise.
* gas/config/tc-mep.c (mep_elf_section_letter): Return a bfd_vma.
(mep_elf_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-mep.h: Likewise.
* gas/config/tc-ppc.c (ppc_section_letter): Return a bfd_vma.
(ppc_section_word): Return a bfd_vma.
(ppc_section_flags): Change type of arg attr to bfd_vma.
* gas/config/tc-ppc.h: Likewise.
* gas/config/te-vms.h (DWARF2_DIR_SHOULD_END_WITH_SEPARATOR,
DWAR2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILEN_NAME):
New file with new macros
* gas/dwarf2dbg.c (get_filenum, out_file_list): Default and call new
macros.
2009-01-15 13:42:52 +01:00
|
|
|
int type, dummy;
|
|
|
|
bfd_vma attr;
|
2001-04-13 02:34:36 +02:00
|
|
|
int entsize;
|
2002-06-04 03:06:16 +02:00
|
|
|
int linkonce;
|
2007-10-11 22:20:55 +02:00
|
|
|
subsegT new_subsection = -1;
|
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 ();
|
|
|
|
|
2007-10-27 19:45:53 +02:00
|
|
|
if (push && ISDIGIT (*input_line_pointer))
|
2007-10-11 22:20:55 +02:00
|
|
|
{
|
2007-10-27 19:45:53 +02:00
|
|
|
/* .pushsection has an optional subsection. */
|
2007-10-11 22:20:55 +02:00
|
|
|
new_subsection = (subsegT) get_absolute_expression ();
|
2007-10-27 19:45:53 +02:00
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
|
|
|
|
/* Stop if we don't see a comma. */
|
|
|
|
if (*input_line_pointer != ',')
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* Skip the comma. */
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
2007-10-11 22:20:55 +02:00
|
|
|
}
|
2007-10-27 19:45:53 +02:00
|
|
|
|
|
|
|
if (*input_line_pointer == '"')
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2012-02-02 10:26:04 +01:00
|
|
|
bfd_boolean is_clone;
|
2010-08-17 22:03:41 +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
|
|
|
}
|
2012-02-02 10:26:04 +01:00
|
|
|
attr |= obj_elf_parse_section_letters (beg, strlen (beg), &is_clone);
|
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
|
|
|
}
|
2008-04-23 15:54:56 +02:00
|
|
|
type = obj_elf_section_type (beg, strlen (beg), TRUE);
|
1999-06-06 01:15:34 +02:00
|
|
|
}
|
|
|
|
else if (c == '@' || c == '%')
|
|
|
|
{
|
|
|
|
beg = ++input_line_pointer;
|
|
|
|
c = get_symbol_end ();
|
|
|
|
*input_line_pointer = c;
|
2008-04-23 15:54:56 +02:00
|
|
|
type = obj_elf_section_type (beg, input_line_pointer - beg, TRUE);
|
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
|
|
|
|
2012-02-02 10:26:04 +01:00
|
|
|
if ((attr & SHF_GROUP) != 0 && is_clone)
|
2010-08-17 22:03:41 +02:00
|
|
|
{
|
|
|
|
as_warn (_("? section flag ignored with G present"));
|
2012-02-02 10:26:04 +01:00
|
|
|
is_clone = FALSE;
|
2010-08-17 22:03:41 +02:00
|
|
|
}
|
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;
|
2012-05-19 12:36:32 +02:00
|
|
|
else if (*input_line_pointer == ',')
|
2002-06-04 03:06:16 +02:00
|
|
|
{
|
2012-05-19 12:36:32 +02:00
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (strncmp (input_line_pointer, "comdat", 6) == 0)
|
|
|
|
{
|
|
|
|
input_line_pointer += 6;
|
|
|
|
linkonce = 1;
|
|
|
|
}
|
2002-06-04 03:06:16 +02:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
2010-08-17 22:03:41 +02:00
|
|
|
|
2012-02-02 10:26:04 +01:00
|
|
|
if (is_clone)
|
2010-08-17 22:03:41 +02:00
|
|
|
{
|
|
|
|
const char *now_group = elf_group_name (now_seg);
|
|
|
|
if (now_group != NULL)
|
|
|
|
{
|
|
|
|
group_name = xstrdup (now_group);
|
|
|
|
linkonce = (now_seg->flags & SEC_LINK_ONCE) != 0;
|
|
|
|
}
|
|
|
|
}
|
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 != '#')
|
|
|
|
{
|
2004-03-18 14:31:04 +01:00
|
|
|
as_bad (_("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;
|
|
|
|
|
2008-04-23 15:54:56 +02:00
|
|
|
attr |= obj_elf_section_word (beg, input_line_pointer - beg, & type);
|
1999-06-06 01:15:34 +02:00
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
}
|
|
|
|
while (*input_line_pointer++ == ',');
|
|
|
|
--input_line_pointer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-27 19:45:53 +02:00
|
|
|
done:
|
1999-05-03 09:29:11 +02:00
|
|
|
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);
|
2007-10-11 22:20:55 +02:00
|
|
|
|
|
|
|
if (push && new_subsection != -1)
|
|
|
|
subseg_set (now_seg, new_subsection);
|
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
|
|
|
|
}
|
|
|
|
|
2005-04-15 13:38:59 +02:00
|
|
|
/* Change to the *ABS* section. */
|
|
|
|
|
|
|
|
void
|
|
|
|
obj_elf_struct (int i)
|
|
|
|
{
|
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
previous_section = now_seg;
|
|
|
|
previous_subsection = now_subseg;
|
|
|
|
s_struct (i);
|
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
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
|
|
|
{
|
2007-10-11 22:20:55 +02:00
|
|
|
int temp;
|
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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2010-07-15 16:34:42 +02:00
|
|
|
sym = get_sym_from_input_line_and_check ();
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
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
|
|
|
{
|
PR gas/5121 gas/5122 gas/5123 gas/5124 gas/5125 gas/5126 gas/5129 gas/5131 gas/5132 gas/5137 gas/5143
* Makefile.am (CFILES): Add cgen.c
(TARGET_CPU_CFILES): Add tc-iq2000.c, tc-maxq.c, tc-mt.c, tc-tic4x.c and xtensa-relax.c.
(TARGET_CPU_HFILES): Add tc-iq2000.h, tc-maxq.h, tc-mt.h, tc-tic4x.h and xtensa-relax.h.
(TARG_ENV_HFILES): Remove te-aux.h, te-delta.h, te-delt88.h, te-ic960.h, te-linux.h.
Add te-aix5.h, te-armeabi.h, te-freebsd.h, te-gnu.h, te-interix.h, te-vxworks.h.
(CONFIG_ATOF_CFILES): New variable.
(POTFILES): Add CONFIG_ATOF_CFILES to dependencies. Fix typo with dependency upon TARG_ENV_HFILES.
(DEPTC): Do not put "#include opcodes/<foo>-desc.h" into cgen-desc.h when foo-desc.h does not exit.
Run make dep-am.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
* po/es.po: Regenerate.
* po/fr.po: Regenerate.
* po/gas.pot: Regenerate.
* po/rw.po: Regenerate.
* po/tr.po: Regenerate.
* config/obj-elf.c (obj_elf_vtable_inherit): Allow for translation of error messages.
* config/obj-som.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-bfin.c: Likewise.
* config/tc-frv.c: Likewise.
2007-10-08 17:26:42 +02:00
|
|
|
as_bad (_("expected `%s' to have already been set for .vtable_inherit"),
|
1999-05-03 09:29:11 +02:00
|
|
|
cname);
|
|
|
|
bad = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
*input_line_pointer = c;
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer != ',')
|
|
|
|
{
|
PR gas/5121 gas/5122 gas/5123 gas/5124 gas/5125 gas/5126 gas/5129 gas/5131 gas/5132 gas/5137 gas/5143
* Makefile.am (CFILES): Add cgen.c
(TARGET_CPU_CFILES): Add tc-iq2000.c, tc-maxq.c, tc-mt.c, tc-tic4x.c and xtensa-relax.c.
(TARGET_CPU_HFILES): Add tc-iq2000.h, tc-maxq.h, tc-mt.h, tc-tic4x.h and xtensa-relax.h.
(TARG_ENV_HFILES): Remove te-aux.h, te-delta.h, te-delt88.h, te-ic960.h, te-linux.h.
Add te-aix5.h, te-armeabi.h, te-freebsd.h, te-gnu.h, te-interix.h, te-vxworks.h.
(CONFIG_ATOF_CFILES): New variable.
(POTFILES): Add CONFIG_ATOF_CFILES to dependencies. Fix typo with dependency upon TARG_ENV_HFILES.
(DEPTC): Do not put "#include opcodes/<foo>-desc.h" into cgen-desc.h when foo-desc.h does not exit.
Run make dep-am.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
* po/es.po: Regenerate.
* po/fr.po: Regenerate.
* po/gas.pot: Regenerate.
* po/rw.po: Regenerate.
* po/tr.po: Regenerate.
* config/obj-elf.c (obj_elf_vtable_inherit): Allow for translation of error messages.
* config/obj-som.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-bfin.c: Likewise.
* config/tc-frv.c: Likewise.
2007-10-08 17:26:42 +02:00
|
|
|
as_bad (_("expected comma after name in .vtable_inherit"));
|
1999-05-03 09:29:11 +02:00
|
|
|
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
|
|
|
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-22 19:56:02 +02:00
|
|
|
gas_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
|
|
|
{
|
|
|
|
symbolS *sym;
|
|
|
|
offsetT offset;
|
|
|
|
|
|
|
|
if (*input_line_pointer == '#')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
2010-07-15 16:34:42 +02:00
|
|
|
sym = get_sym_from_input_line_and_check ();
|
1999-05-03 09:29:11 +02:00
|
|
|
if (*input_line_pointer != ',')
|
|
|
|
{
|
PR gas/5121 gas/5122 gas/5123 gas/5124 gas/5125 gas/5126 gas/5129 gas/5131 gas/5132 gas/5137 gas/5143
* Makefile.am (CFILES): Add cgen.c
(TARGET_CPU_CFILES): Add tc-iq2000.c, tc-maxq.c, tc-mt.c, tc-tic4x.c and xtensa-relax.c.
(TARGET_CPU_HFILES): Add tc-iq2000.h, tc-maxq.h, tc-mt.h, tc-tic4x.h and xtensa-relax.h.
(TARG_ENV_HFILES): Remove te-aux.h, te-delta.h, te-delt88.h, te-ic960.h, te-linux.h.
Add te-aix5.h, te-armeabi.h, te-freebsd.h, te-gnu.h, te-interix.h, te-vxworks.h.
(CONFIG_ATOF_CFILES): New variable.
(POTFILES): Add CONFIG_ATOF_CFILES to dependencies. Fix typo with dependency upon TARG_ENV_HFILES.
(DEPTC): Do not put "#include opcodes/<foo>-desc.h" into cgen-desc.h when foo-desc.h does not exit.
Run make dep-am.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
* po/es.po: Regenerate.
* po/fr.po: Regenerate.
* po/gas.pot: Regenerate.
* po/rw.po: Regenerate.
* po/tr.po: Regenerate.
* config/obj-elf.c (obj_elf_vtable_inherit): Allow for translation of error messages.
* config/obj-som.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-bfin.c: Likewise.
* config/tc-frv.c: Likewise.
2007-10-08 17:26:42 +02:00
|
|
|
as_bad (_("expected comma after name in .vtable_entry"));
|
1999-05-03 09:29:11 +02:00
|
|
|
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)
|
2009-09-11 17:27:38 +02:00
|
|
|
destelf->size = (expressionS *) 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;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == '\"')
|
|
|
|
{
|
2006-11-10 08:47:14 +01:00
|
|
|
unsigned int len;
|
|
|
|
|
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;
|
|
|
|
|
2006-11-10 08:47:14 +01:00
|
|
|
/* Create the .note section. */
|
1999-05-03 09:29:11 +02:00
|
|
|
note_secp = subseg_new (".note", 0);
|
|
|
|
bfd_set_section_flags (stdoutput,
|
|
|
|
note_secp,
|
|
|
|
SEC_HAS_CONTENTS | SEC_READONLY);
|
|
|
|
|
2006-11-10 08:47:14 +01:00
|
|
|
/* Process the version string. */
|
|
|
|
len = strlen (name) + 1;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2006-11-10 08:47:14 +01:00
|
|
|
/* PR 3456: Although the name field is padded out to an 4-byte
|
|
|
|
boundary, the namesz field should not be adjusted. */
|
|
|
|
i_note.namesz = len;
|
|
|
|
i_note.descsz = 0; /* No description. */
|
1999-05-03 09:29:11 +02:00
|
|
|
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));
|
2006-11-10 08:47:14 +01:00
|
|
|
p = frag_more (len);
|
2006-11-22 04:35:36 +01:00
|
|
|
memcpy (p, name, len);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
frag_align (2, 0, 0);
|
|
|
|
|
|
|
|
subseg_set (seg, subseg);
|
|
|
|
}
|
|
|
|
else
|
2006-11-10 08:47:14 +01: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
|
|
|
|
{
|
2009-09-11 17:27:38 +02:00
|
|
|
symbol_get_obj (sym)->size =
|
|
|
|
(expressionS *) 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.
|
2008-04-23 15:54:56 +02:00
|
|
|
There are six 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"
|
2008-04-23 15:54:56 +02:00
|
|
|
The sixth (emitted by recent SunPRO under Solaris) is
|
|
|
|
.type SYM,[0-9]
|
|
|
|
where the integer is the STT_* value.
|
1999-05-03 09:29:11 +02:00
|
|
|
*/
|
|
|
|
|
2008-04-23 15:54:56 +02:00
|
|
|
static char *
|
|
|
|
obj_elf_type_name (char *cp)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = input_line_pointer;
|
|
|
|
if (*input_line_pointer >= '0'
|
|
|
|
&& *input_line_pointer <= '9')
|
|
|
|
{
|
|
|
|
while (*input_line_pointer >= '0'
|
|
|
|
&& *input_line_pointer <= '9')
|
|
|
|
++input_line_pointer;
|
|
|
|
*cp = *input_line_pointer;
|
|
|
|
*input_line_pointer = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*cp = get_symbol_end ();
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
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 c;
|
|
|
|
int type;
|
2009-09-11 17:27:38 +02:00
|
|
|
const char *type_name;
|
1999-05-03 09:29:11 +02:00
|
|
|
symbolS *sym;
|
2000-09-05 05:23:05 +02:00
|
|
|
elf_symbol_type *elfsym;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
2010-07-15 16:34:42 +02:00
|
|
|
sym = get_sym_from_input_line_and_check ();
|
|
|
|
c = *input_line_pointer;
|
2000-09-05 05:23:05 +02:00
|
|
|
elfsym = (elf_symbol_type *) symbol_get_bfdsym (sym);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2009-09-11 17:27:38 +02:00
|
|
|
type_name = obj_elf_type_name (& c);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
type = 0;
|
2009-09-11 17:27:38 +02:00
|
|
|
if (strcmp (type_name, "function") == 0
|
|
|
|
|| strcmp (type_name, "2") == 0
|
|
|
|
|| strcmp (type_name, "STT_FUNC") == 0)
|
1999-05-03 09:29:11 +02:00
|
|
|
type = BSF_FUNCTION;
|
2009-09-11 17:27:38 +02:00
|
|
|
else if (strcmp (type_name, "object") == 0
|
|
|
|
|| strcmp (type_name, "1") == 0
|
|
|
|
|| strcmp (type_name, "STT_OBJECT") == 0)
|
1999-05-03 09:29:11 +02:00
|
|
|
type = BSF_OBJECT;
|
2009-09-11 17:27:38 +02:00
|
|
|
else if (strcmp (type_name, "tls_object") == 0
|
|
|
|
|| strcmp (type_name, "6") == 0
|
|
|
|
|| strcmp (type_name, "STT_TLS") == 0)
|
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
|
|
|
type = BSF_OBJECT | BSF_THREAD_LOCAL;
|
2009-09-11 17:27:38 +02:00
|
|
|
else if (strcmp (type_name, "notype") == 0
|
|
|
|
|| strcmp (type_name, "0") == 0
|
|
|
|
|| strcmp (type_name, "STT_NOTYPE") == 0)
|
2003-05-02 05:01:44 +02:00
|
|
|
;
|
2009-09-11 17:27:38 +02:00
|
|
|
else if (strcmp (type_name, "common") == 0
|
|
|
|
|| strcmp (type_name, "5") == 0
|
|
|
|
|| strcmp (type_name, "STT_COMMON") == 0)
|
2007-10-16 16:42:15 +02:00
|
|
|
{
|
|
|
|
type = BSF_OBJECT;
|
|
|
|
|
|
|
|
if (! S_IS_COMMON (sym))
|
|
|
|
{
|
|
|
|
if (S_IS_VOLATILE (sym))
|
|
|
|
{
|
|
|
|
sym = symbol_clone (sym, 1);
|
|
|
|
S_SET_SEGMENT (sym, bfd_com_section_ptr);
|
|
|
|
S_SET_VALUE (sym, 0);
|
|
|
|
S_SET_EXTERNAL (sym);
|
|
|
|
symbol_set_frag (sym, &zero_address_frag);
|
|
|
|
S_CLEAR_VOLATILE (sym);
|
|
|
|
}
|
|
|
|
else if (S_IS_DEFINED (sym) || symbol_equated_p (sym))
|
|
|
|
as_bad (_("symbol '%s' is already defined"), S_GET_NAME (sym));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* FIXME: Is it safe to just change the section ? */
|
|
|
|
S_SET_SEGMENT (sym, bfd_com_section_ptr);
|
|
|
|
S_SET_VALUE (sym, 0);
|
|
|
|
S_SET_EXTERNAL (sym);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-09-11 17:27:38 +02:00
|
|
|
else if (strcmp (type_name, "gnu_indirect_function") == 0
|
|
|
|
|| strcmp (type_name, "10") == 0
|
|
|
|
|| strcmp (type_name, "STT_GNU_IFUNC") == 0)
|
2009-04-30 17:47:13 +02:00
|
|
|
{
|
|
|
|
const struct elf_backend_data *bed;
|
|
|
|
|
|
|
|
bed = get_elf_backend_data (stdoutput);
|
2011-07-03 15:37:09 +02:00
|
|
|
if (!(bed->elf_osabi == ELFOSABI_GNU
|
2011-12-15 12:37:03 +01:00
|
|
|
|| bed->elf_osabi == ELFOSABI_FREEBSD
|
2011-07-03 15:37:09 +02:00
|
|
|
/* GNU is still using the default value 0. */
|
2009-04-30 17:47:13 +02:00
|
|
|
|| bed->elf_osabi == ELFOSABI_NONE))
|
2011-12-15 12:37:03 +01:00
|
|
|
as_bad (_("symbol type \"%s\" is supported only by GNU and FreeBSD targets"),
|
2009-09-11 17:27:38 +02:00
|
|
|
type_name);
|
2009-04-30 17:47:13 +02:00
|
|
|
type = BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION;
|
|
|
|
}
|
2009-09-11 17:27:38 +02:00
|
|
|
else if (strcmp (type_name, "gnu_unique_object") == 0)
|
2009-07-23 15:00:30 +02:00
|
|
|
{
|
Updated sources to avoid using the identifier name "new", which is a
keyword in c++.
* bfd/aoutx.h (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol.
* bfd/coffgen.c (coff_make_empty_symbol)
(coff_bfd_make_debug_symbol): Rename variable new to new_symbol.
* bfd/cpu-ia64-opc.c (ext_reg, ins_imms_scaled): Rename variable
new to new_insn.
* bfd/doc/chew.c (newentry, add_intrinsic): Rename variable new to
new_d.
* bfd/ecoff.c (_bfd_ecoff_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/elf32-m68k.c (elf_m68k_get_got_entry_type): Rename argument
new to new_reloc.
* bfd/hash.c (bfd_hash_lookup): Rename variable new to new_string.
* bfd/ieee.c (ieee_make_empty_symbol): Rename variable new to
new_symbol.
* bfd/linker.c (bfd_new_link_order): Rename variable new to
new_lo.
* bfd/mach-o.c (bfd_mach_o_sizeof_headers): Rename variable new to
symbol.
* bfd/oasys.c (oasys_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/pdp11.c (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol_type.
* bfd/plugin.c (bfd_plugin_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/rs6000-core.c (CoreHdr, VmInfo): Rename union member new to
new_dump.
(read_hdr, rs6000coff_core_p)
(rs6000coff_core_file_matches_executable_p)
(rs6000coff_core_file_failing_command)
(rs6000coff_core_file_failing_signal): Updated function to use new
union member name.
* bfd/som.c (som_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/syms.c (_bfd_generic_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/tekhex.c (first_phase, tekhex_make_empty_symbol): Rename
variable new to new_symbol.
* binutils/nlmconv.c (main): Rename variable new to new_name.
* gas/config/tc-arm.c (insert_reg_alias): Rename variable new to
new_reg.
* gas/config/tc-dlx.c (parse_operand): Rename variable new to
new_pos.
* gas/config/tc-ia64.c (ia64_gen_real_reloc_type): Rename variable
new to newr.
* gas/config/tc-mcore.c (parse_exp, parse_imm): Rename variable
new to new_pointer.
* gas/config/tc-microblaze.c (parse_exp, parse_imm, check_got):
Change name from new to new_pointer.
* gas/config/tc-or32.c (parse_operand): Rename variable new to
new_pointer.
* gas/config/tc-pdp11.c (md_assemble): Rename variable new to
new_pointer.
* gas/config/tc-pj.c (alias): Change argument new to new_name.
* gas/config/tc-score.c (s3_build_score_ops_hsh): Rename variable
new to new_opcode. (s3_build_dependency_insn_hsh) Rename variable
new to new_i2n. (s3_convert): Rename variables old and new to
r_old and r_new.
* gas/config/tc-score7.c (s7_build_score_ops_hsh): Rename variable
new to new_opcode. (s7_build_dependency_insn_hsh): Rename variable
new to new_i2d. (s7_b32_relax_to_b16, s7_convert_frag): Rename
variables old and new to r_old and r_new.
* gas/config/tc-sh.c (parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-sh64.c (shmedia_parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-tic4x.c (tic4x_operand_parse): Rename variable new
to new_pointer.
* gas/config/tc-z8k.c (parse_exp): Rename variable new to
new_pointer.
* gas/listing.c (listing_newline): Rename variable new to new_i.
* ld/ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
(exp_trinop, exp_unop, exp_nameop, exp_assop): Rename variable new
to new_e.
* ld/ldfile.c (ldfile_add_library_path): Rename variable new to
new_dirs. (ldfile_add_arch): Rename variable new to new_arch.
* ld/ldlang.c (new_statement, lang_final, lang_add_wild)
(lang_target, lang_add_fill, lang_add_data, lang_add_assignment)
(lang_add_insert): Rename variable new to new_stmt. (new_afile):
Added missing cast. (lang_memory_region_lookup): Rename variable
new to new_region. (init_os): Rename variable new to
new_userdata. (lang_add_section): Rename variable new to
new_section. (ldlang_add_undef): Rename variable new to
new_undef. (realsymbol): Rename variable new to new_name.
* opcodes/z8kgen.c (internal, gas): Rename variable new to new_op.
Updated sources to avoid using the identifier name "template",
which is a keyword in c++.
* bfd/elf32-arm.c (struct stub_def): Rename member template to
template_sequence. (arm_build_one_stub,
find_stub_size_and_template, arm_size_one_stub, arm_map_one_stub):
Rename variable template to template_sequence.
* bfd/elfxx-ia64.c (elfNN_ia64_relax_br, elfNN_ia64_relax_brl):
Rename variable template to template_val.
* gas/config/tc-arm.c (struct asm_cond, struct asm_psr, struct
asm_barrier_opt): Change member template to
template_name. (md_begin): Update code to reflect new member
names.
* gas/config/tc-i386.c (struct templates, struct _i386_insn)
(match_template, cpu_flags_match, match_reg_size, match_mem_size)
(operand_size_match, md_begin, i386_print_statistics, pi)
(build_vex_prefix, md_assemble, parse_insn, optimize_imm)
(optimize_disp): Updated code to use new names. (parse_insn):
Added casts.
* gas/config/tc-ia64.c (dot_template, emit_one_bundle): Updated
code to use new names.
* gas/config/tc-score.c (struct s3_asm_opcode): Renamed member
template to template_name. (s3_parse_16_32_inst, s3_parse_48_inst,
s3_do_macro_ldst_label, s3_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-score7.c (struct s7_asm_opcode): Renamed member
template to template_name. (s7_parse_16_32_inst,
s7_do_macro_ldst_label, s7_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-tic30.c (md_begin, struct tic30_insn)
(md_assemble): Update code to use new names.
* gas/config/tc-tic54x.c (struct _tic54x_insn, md_begin)
(optimize_insn, tic54x_parse_insn, next_line_shows_parallel):
Update code to use new names.
* include/opcode/tic30.h (template): Rename type template to
insn_template. Updated code to use new name.
* include/opcode/tic54x.h (template): Rename type template to
insn_template.
* opcodes/cris-dis.c (bytes_to_skip): Update code to use new name.
* opcodes/i386-dis.c (putop): Update code to use new name.
* opcodes/i386-gen.c (process_i386_opcodes): Update code to use
new name.
* opcodes/i386-opc.h (struct template): Rename struct template to
insn_template. Update code accordingly.
* opcodes/i386-tbl.h (i386_optab): Update type to use new name.
* opcodes/ia64-dis.c (print_insn_ia64): Rename variable template
to template_val.
* opcodes/tic30-dis.c (struct instruction, get_tic30_instruction):
Update code to use new name.
* opcodes/tic54x-dis.c (has_lkaddr, get_insn_size)
(print_parallel_instruction, print_insn_tic54x, tic54x_get_insn):
Update code to use new name.
* opcodes/tic54x-opc.c (tic54x_unknown_opcode, tic54x_optab):
Update type to new name.
2009-08-30 00:11:02 +02:00
|
|
|
struct elf_backend_data *bed;
|
2009-07-23 15:00:30 +02:00
|
|
|
|
Updated sources to avoid using the identifier name "new", which is a
keyword in c++.
* bfd/aoutx.h (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol.
* bfd/coffgen.c (coff_make_empty_symbol)
(coff_bfd_make_debug_symbol): Rename variable new to new_symbol.
* bfd/cpu-ia64-opc.c (ext_reg, ins_imms_scaled): Rename variable
new to new_insn.
* bfd/doc/chew.c (newentry, add_intrinsic): Rename variable new to
new_d.
* bfd/ecoff.c (_bfd_ecoff_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/elf32-m68k.c (elf_m68k_get_got_entry_type): Rename argument
new to new_reloc.
* bfd/hash.c (bfd_hash_lookup): Rename variable new to new_string.
* bfd/ieee.c (ieee_make_empty_symbol): Rename variable new to
new_symbol.
* bfd/linker.c (bfd_new_link_order): Rename variable new to
new_lo.
* bfd/mach-o.c (bfd_mach_o_sizeof_headers): Rename variable new to
symbol.
* bfd/oasys.c (oasys_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/pdp11.c (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol_type.
* bfd/plugin.c (bfd_plugin_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/rs6000-core.c (CoreHdr, VmInfo): Rename union member new to
new_dump.
(read_hdr, rs6000coff_core_p)
(rs6000coff_core_file_matches_executable_p)
(rs6000coff_core_file_failing_command)
(rs6000coff_core_file_failing_signal): Updated function to use new
union member name.
* bfd/som.c (som_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/syms.c (_bfd_generic_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/tekhex.c (first_phase, tekhex_make_empty_symbol): Rename
variable new to new_symbol.
* binutils/nlmconv.c (main): Rename variable new to new_name.
* gas/config/tc-arm.c (insert_reg_alias): Rename variable new to
new_reg.
* gas/config/tc-dlx.c (parse_operand): Rename variable new to
new_pos.
* gas/config/tc-ia64.c (ia64_gen_real_reloc_type): Rename variable
new to newr.
* gas/config/tc-mcore.c (parse_exp, parse_imm): Rename variable
new to new_pointer.
* gas/config/tc-microblaze.c (parse_exp, parse_imm, check_got):
Change name from new to new_pointer.
* gas/config/tc-or32.c (parse_operand): Rename variable new to
new_pointer.
* gas/config/tc-pdp11.c (md_assemble): Rename variable new to
new_pointer.
* gas/config/tc-pj.c (alias): Change argument new to new_name.
* gas/config/tc-score.c (s3_build_score_ops_hsh): Rename variable
new to new_opcode. (s3_build_dependency_insn_hsh) Rename variable
new to new_i2n. (s3_convert): Rename variables old and new to
r_old and r_new.
* gas/config/tc-score7.c (s7_build_score_ops_hsh): Rename variable
new to new_opcode. (s7_build_dependency_insn_hsh): Rename variable
new to new_i2d. (s7_b32_relax_to_b16, s7_convert_frag): Rename
variables old and new to r_old and r_new.
* gas/config/tc-sh.c (parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-sh64.c (shmedia_parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-tic4x.c (tic4x_operand_parse): Rename variable new
to new_pointer.
* gas/config/tc-z8k.c (parse_exp): Rename variable new to
new_pointer.
* gas/listing.c (listing_newline): Rename variable new to new_i.
* ld/ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
(exp_trinop, exp_unop, exp_nameop, exp_assop): Rename variable new
to new_e.
* ld/ldfile.c (ldfile_add_library_path): Rename variable new to
new_dirs. (ldfile_add_arch): Rename variable new to new_arch.
* ld/ldlang.c (new_statement, lang_final, lang_add_wild)
(lang_target, lang_add_fill, lang_add_data, lang_add_assignment)
(lang_add_insert): Rename variable new to new_stmt. (new_afile):
Added missing cast. (lang_memory_region_lookup): Rename variable
new to new_region. (init_os): Rename variable new to
new_userdata. (lang_add_section): Rename variable new to
new_section. (ldlang_add_undef): Rename variable new to
new_undef. (realsymbol): Rename variable new to new_name.
* opcodes/z8kgen.c (internal, gas): Rename variable new to new_op.
Updated sources to avoid using the identifier name "template",
which is a keyword in c++.
* bfd/elf32-arm.c (struct stub_def): Rename member template to
template_sequence. (arm_build_one_stub,
find_stub_size_and_template, arm_size_one_stub, arm_map_one_stub):
Rename variable template to template_sequence.
* bfd/elfxx-ia64.c (elfNN_ia64_relax_br, elfNN_ia64_relax_brl):
Rename variable template to template_val.
* gas/config/tc-arm.c (struct asm_cond, struct asm_psr, struct
asm_barrier_opt): Change member template to
template_name. (md_begin): Update code to reflect new member
names.
* gas/config/tc-i386.c (struct templates, struct _i386_insn)
(match_template, cpu_flags_match, match_reg_size, match_mem_size)
(operand_size_match, md_begin, i386_print_statistics, pi)
(build_vex_prefix, md_assemble, parse_insn, optimize_imm)
(optimize_disp): Updated code to use new names. (parse_insn):
Added casts.
* gas/config/tc-ia64.c (dot_template, emit_one_bundle): Updated
code to use new names.
* gas/config/tc-score.c (struct s3_asm_opcode): Renamed member
template to template_name. (s3_parse_16_32_inst, s3_parse_48_inst,
s3_do_macro_ldst_label, s3_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-score7.c (struct s7_asm_opcode): Renamed member
template to template_name. (s7_parse_16_32_inst,
s7_do_macro_ldst_label, s7_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-tic30.c (md_begin, struct tic30_insn)
(md_assemble): Update code to use new names.
* gas/config/tc-tic54x.c (struct _tic54x_insn, md_begin)
(optimize_insn, tic54x_parse_insn, next_line_shows_parallel):
Update code to use new names.
* include/opcode/tic30.h (template): Rename type template to
insn_template. Updated code to use new name.
* include/opcode/tic54x.h (template): Rename type template to
insn_template.
* opcodes/cris-dis.c (bytes_to_skip): Update code to use new name.
* opcodes/i386-dis.c (putop): Update code to use new name.
* opcodes/i386-gen.c (process_i386_opcodes): Update code to use
new name.
* opcodes/i386-opc.h (struct template): Rename struct template to
insn_template. Update code accordingly.
* opcodes/i386-tbl.h (i386_optab): Update type to use new name.
* opcodes/ia64-dis.c (print_insn_ia64): Rename variable template
to template_val.
* opcodes/tic30-dis.c (struct instruction, get_tic30_instruction):
Update code to use new name.
* opcodes/tic54x-dis.c (has_lkaddr, get_insn_size)
(print_parallel_instruction, print_insn_tic54x, tic54x_get_insn):
Update code to use new name.
* opcodes/tic54x-opc.c (tic54x_unknown_opcode, tic54x_optab):
Update type to new name.
2009-08-30 00:11:02 +02:00
|
|
|
bed = (struct elf_backend_data *) get_elf_backend_data (stdoutput);
|
2011-07-03 15:37:09 +02:00
|
|
|
if (!(bed->elf_osabi == ELFOSABI_GNU
|
|
|
|
/* GNU is still using the default value 0. */
|
2009-07-23 15:00:30 +02:00
|
|
|
|| bed->elf_osabi == ELFOSABI_NONE))
|
|
|
|
as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
|
2009-09-11 17:27:38 +02:00
|
|
|
type_name);
|
2009-07-23 15:00:30 +02:00
|
|
|
type = BSF_OBJECT | BSF_GNU_UNIQUE;
|
2011-07-03 15:37:09 +02:00
|
|
|
/* PR 10549: Always set OSABI field to GNU for objects containing unique symbols. */
|
|
|
|
bed->elf_osabi = ELFOSABI_GNU;
|
2009-07-23 15:00:30 +02:00
|
|
|
}
|
2000-09-05 05:23:05 +02:00
|
|
|
#ifdef md_elf_symbol_type
|
2009-09-11 17:27:38 +02:00
|
|
|
else if ((type = md_elf_symbol_type (type_name, sym, elfsym)) != -1)
|
2000-09-05 05:23:05 +02:00
|
|
|
;
|
|
|
|
#endif
|
1999-05-03 09:29:11 +02:00
|
|
|
else
|
2009-09-11 17:27:38 +02:00
|
|
|
as_bad (_("unrecognized symbol type \"%s\""), type_name);
|
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,
|
2009-07-25 01:49:51 +02:00
|
|
|
SEC_READONLY | SEC_HAS_CONTENTS
|
|
|
|
| SEC_MERGE | SEC_STRINGS);
|
|
|
|
comment_section->entsize = 1;
|
2009-07-31 20:14:07 +02:00
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
1999-05-03 09:29:11 +02:00
|
|
|
p = frag_more (1);
|
|
|
|
*p = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
subseg_set (comment_section, 0);
|
2007-10-04 19:05:37 +02:00
|
|
|
stringer (8 + 1);
|
1999-05-03 09:29:11 +02:00
|
|
|
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);
|
2009-09-11 17:27:38 +02:00
|
|
|
stabstr_name = (char *) 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);
|
2010-08-31 07:34:46 +02:00
|
|
|
know (stroff == 1 || (stroff == 0 && file[0] == '\0'));
|
1999-05-03 09:29:11 +02:00
|
|
|
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;
|
|
|
|
|
2009-09-11 17:27:38 +02:00
|
|
|
name = (char *) 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;
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-22 19:56:02 +02:00
|
|
|
gas_assert (p != 0);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
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. */
|
|
|
|
|
2007-07-03 05:29:40 +02:00
|
|
|
#ifdef OBJ_MAYBE_ELF
|
|
|
|
static
|
|
|
|
#endif
|
1999-05-03 09:29:11 +02:00
|
|
|
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;
|
2011-03-06 15:05:25 +01:00
|
|
|
expressionS *size;
|
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
|
|
|
|
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);
|
|
|
|
|
2011-03-06 15:05:25 +01:00
|
|
|
size = sy_obj->size;
|
|
|
|
if (size != NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2011-03-06 15:05:25 +01:00
|
|
|
if (resolve_expression (size)
|
|
|
|
&& size->X_op == O_constant)
|
|
|
|
S_SET_SIZE (symp, size->X_add_number);
|
2011-02-25 14:45:54 +01:00
|
|
|
else
|
2011-03-06 15:05:25 +01:00
|
|
|
{
|
2011-03-16 13:58:26 +01:00
|
|
|
if (flag_size_check == size_check_error)
|
2011-03-18 12:21:33 +01:00
|
|
|
as_bad (_(".size expression for %s "
|
|
|
|
"does not evaluate to a constant"), S_GET_NAME (symp));
|
2011-03-16 13:58:26 +01:00
|
|
|
else
|
2011-03-18 12:21:33 +01:00
|
|
|
as_warn (_(".size expression for %s "
|
|
|
|
"does not evaluate to a constant"), S_GET_NAME (symp));
|
2011-03-06 15:05:25 +01: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
|
|
|
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
|
|
|
|
}
|
|
|
|
|
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. */
|
2009-09-11 17:27:38 +02:00
|
|
|
struct hash_control *indexes; /* Maps group name to index in head array. */
|
2001-10-09 08:07:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* 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
|
|
|
{
|
2009-09-11 17:27:38 +02:00
|
|
|
struct group_list *list = (struct group_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;
|
2009-09-11 17:27:38 +02:00
|
|
|
unsigned int *elem_idx;
|
|
|
|
unsigned int *idx_ptr;
|
2001-10-09 08:07:33 +02:00
|
|
|
|
|
|
|
if (group_name == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* If this group already has a list, add the section to the head of
|
|
|
|
the list. */
|
2009-09-11 17:27:38 +02:00
|
|
|
elem_idx = (unsigned int *) hash_find (list->indexes, group_name);
|
|
|
|
if (elem_idx != NULL)
|
2001-10-09 08:07:33 +02:00
|
|
|
{
|
2009-09-11 17:27:38 +02:00
|
|
|
elf_next_in_group (sec) = list->head[*elem_idx];
|
|
|
|
list->head[*elem_idx] = sec;
|
|
|
|
list->elt_count[*elem_idx] += 1;
|
|
|
|
return;
|
2001-10-09 08:07:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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;
|
2009-09-11 17:27:38 +02:00
|
|
|
list->head = (asection **) xrealloc (list->head,
|
|
|
|
newsize * sizeof (*list->head));
|
|
|
|
list->elt_count = (unsigned int *)
|
|
|
|
xrealloc (list->elt_count, newsize * sizeof (*list->elt_count));
|
2001-10-09 08:07:33 +02:00
|
|
|
}
|
|
|
|
list->head[i] = sec;
|
|
|
|
list->elt_count[i] = 1;
|
|
|
|
list->num_group += 1;
|
2009-09-11 17:27:38 +02:00
|
|
|
|
|
|
|
/* Add index to hash. */
|
Update soruces to make alpha, arc and arm targets compile cleanly
with -Wc++-compat:
* config/tc-alpha.c: Add casts.
(extended_bfd_reloc_code_real_type): New type. Used to avoid
enumeration conversion warnings.
(struct alpha_fixup, void assemble_insn, assemble_insn)
(assemble_tokens): Use new type.
* ecoff.c: Add casts. (mark_stabs): Use enumeration names.
* config/obj-elf.c: Add cast
* config/tc-arc.c: Add casts.
* config/obj-aout.h (text_section,data_section,bss_section):
Make extern.
* config/obj-elf.c: Add cast.
* config/tc-arm.c: Add casts.
(X, TxCE, TxCE, TxC3, TxC3w, TxCM_, TxCM, TUE, TUF, CE, CL, cCE)
(cCL, C3E, xCM_, nUF, nCE_tag): Change input format to avoid the
need for keywords as arguments.
* ecoff.c: Add casts.
* ecofflink.c: Add casts.
* elf64-alpha.c: Add casts.
(struct alpha_elf_got_entry, struct alpha_elf_reloc_entry): Move
to top level.
(SKIP_HOWTO): Use enum name.
* elf32-arm.c: Add casts.
(elf32_arm_vxworks_bed): Update code to avoid multiple
declarations.
(struct map_stub): Move to top level.
* arc-dis.c Fix casts.
* arc-ext.c: Add casts.
* arm-dis.c (enum opcode_sentinel_enum): Gave name to anonymous
enum.
* emultempl/armelf.em: Add casts.
2009-09-25 21:13:27 +02:00
|
|
|
idx_ptr = (unsigned int *) xmalloc (sizeof (unsigned int));
|
2009-09-11 17:27:38 +02:00
|
|
|
*idx_ptr = i;
|
|
|
|
hash_insert (list->indexes, group_name, idx_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void free_section_idx (const char *key ATTRIBUTE_UNUSED, void *val)
|
|
|
|
{
|
|
|
|
free ((unsigned int *) val);
|
2001-10-09 08:07:33 +02:00
|
|
|
}
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
void
|
2010-10-23 20:05:10 +02:00
|
|
|
elf_adjust_symtab (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
{
|
2001-10-09 08:07:33 +02:00
|
|
|
struct group_list list;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
/* Go find section groups. */
|
|
|
|
list.num_group = 0;
|
|
|
|
list.head = NULL;
|
|
|
|
list.elt_count = NULL;
|
2010-10-23 20:05:10 +02:00
|
|
|
list.indexes = hash_new ();
|
2003-12-13 13:57:40 +01:00
|
|
|
bfd_map_over_sections (stdoutput, build_group_lists, &list);
|
2010-10-23 20:05:10 +02:00
|
|
|
|
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. */
|
2010-10-23 20:05:10 +02:00
|
|
|
for (i = 0; i < list.num_group; i++)
|
2001-10-09 08:07:33 +02:00
|
|
|
{
|
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;
|
2004-06-15 03:16:35 +02:00
|
|
|
bfd_size_type size;
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-23 20:05:10 +02:00
|
|
|
sec_name = ".group";
|
2002-06-07 16:57:50 +02:00
|
|
|
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];
|
2010-10-23 20:05:10 +02:00
|
|
|
/* Make sure that the signature symbol for the group has the
|
|
|
|
name of the group. */
|
|
|
|
sy = symbol_find_exact (group_name);
|
|
|
|
if (!sy
|
|
|
|
|| (sy != symbol_lastP
|
|
|
|
&& (sy->sy_next == NULL
|
|
|
|
|| sy->sy_next->sy_previous != sy)))
|
|
|
|
{
|
|
|
|
/* Create the symbol now. */
|
|
|
|
sy = symbol_new (group_name, now_seg, (valueT) 0, frag_now);
|
2010-11-18 17:00:25 +01:00
|
|
|
#ifdef TE_SOLARIS
|
|
|
|
/* Before Solaris 11 build 154, Sun ld rejects local group
|
|
|
|
signature symbols, so make them weak hidden instead. */
|
|
|
|
symbol_get_bfdsym (sy)->flags |= BSF_WEAK;
|
|
|
|
S_SET_OTHER (sy, STV_HIDDEN);
|
|
|
|
#else
|
2010-10-23 20:05:10 +02:00
|
|
|
symbol_get_obj (sy)->local = 1;
|
2010-11-18 17:00:25 +01:00
|
|
|
#endif
|
2010-10-23 20:05:10 +02:00
|
|
|
symbol_table_insert (sy);
|
|
|
|
}
|
|
|
|
elf_group_id (s) = symbol_get_bfdsym (sy);
|
2001-10-09 08:07:33 +02:00
|
|
|
|
2004-06-15 03:16:35 +02:00
|
|
|
size = 4 * (list.elt_count[i] + 1);
|
|
|
|
bfd_set_section_size (stdoutput, s, size);
|
2005-02-22 13:58:35 +01:00
|
|
|
s->contents = (unsigned char *) frag_more (size);
|
2001-10-09 08:07:33 +02:00
|
|
|
frag_now->fr_fix = frag_now_fix_octets ();
|
2007-02-27 08:16:31 +01:00
|
|
|
frag_wane (frag_now);
|
2001-10-09 08:07:33 +02:00
|
|
|
}
|
|
|
|
|
2009-09-11 17:27:38 +02:00
|
|
|
/* Cleanup hash. */
|
|
|
|
hash_traverse (list.indexes, free_section_idx);
|
|
|
|
hash_die (list.indexes);
|
1999-05-03 09:29:11 +02:00
|
|
|
}
|
|
|
|
|
2010-10-23 20:05:10 +02:00
|
|
|
void
|
|
|
|
elf_frob_file (void)
|
|
|
|
{
|
|
|
|
bfd_map_over_sections (stdoutput, adjust_stab_sections, NULL);
|
|
|
|
|
|
|
|
#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");
|
* gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
gas/config/obj-coff.c, gas/config/obj-ecoff.c,
gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
gas/config/tc-s390.c, gas/config/tc-score.c,
gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
gas macro `assert' to `gas_assert'.
2009-06-22 19:56:02 +02:00
|
|
|
gas_assert (sec != NULL);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
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? */
|
2004-06-15 03:16:35 +02:00
|
|
|
bfd_set_section_size
|
|
|
|
(stdoutput, sec, bfd_ecoff_debug_size (stdoutput, &debug, debug_swap));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
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 */
|
|
|
|
|
2010-11-15 13:31:05 +01:00
|
|
|
static void
|
|
|
|
elf_generate_asm_lineno (void)
|
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
ecoff_generate_asm_lineno ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-15 19:12:42 +01:00
|
|
|
elf_process_stab (segT sec ATTRIBUTE_UNUSED,
|
|
|
|
int what ATTRIBUTE_UNUSED,
|
|
|
|
const char *string ATTRIBUTE_UNUSED,
|
|
|
|
int type ATTRIBUTE_UNUSED,
|
|
|
|
int other ATTRIBUTE_UNUSED,
|
|
|
|
int desc ATTRIBUTE_UNUSED)
|
2010-11-15 13:31:05 +01:00
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
ecoff_stab (sec, what, string, type, other, desc);
|
|
|
|
#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
|
|
|
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,
|
2010-11-15 13:31:05 +01:00
|
|
|
elf_generate_asm_lineno,
|
|
|
|
elf_process_stab,
|
* 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,
|
2009-11-02 12:49:48 +01:00
|
|
|
elf_obj_symbol_new_hook,
|
2010-10-25 14:38:42 +02:00
|
|
|
0,
|
|
|
|
elf_adjust_symtab
|
1999-05-03 09:29:11 +02:00
|
|
|
};
|