1999-05-03 15:29:11 +08:00
|
|
|
/* ELF object file format
|
2019-01-01 18:31:27 +08:00
|
|
|
Copyright (C) 1992-2019 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08: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 19:01:12 +08:00
|
|
|
published by the Free Software Foundation; either version 3,
|
1999-05-03 15:29:11 +08: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 17:13:19 +08:00
|
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define OBJ_HEADER "obj-elf.h"
|
|
|
|
#include "as.h"
|
2001-09-19 13:33:36 +08:00
|
|
|
#include "safe-ctype.h"
|
1999-05-03 15:29:11 +08:00
|
|
|
#include "subsegs.h"
|
|
|
|
#include "obstack.h"
|
2003-05-21 20:07:56 +08:00
|
|
|
#include "dwarf2dbg.h"
|
1999-05-03 15:29:11 +08: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
|
|
|
|
|
2005-07-25 23:41:08 +08:00
|
|
|
#ifdef TC_I386
|
|
|
|
#include "elf/x86-64.h"
|
|
|
|
#endif
|
|
|
|
|
2007-02-06 04:10:25 +08:00
|
|
|
#ifdef TC_MEP
|
|
|
|
#include "elf/mep.h"
|
|
|
|
#endif
|
|
|
|
|
2013-02-07 07:22:26 +08:00
|
|
|
#ifdef TC_NIOS2
|
|
|
|
#include "elf/nios2.h"
|
|
|
|
#endif
|
|
|
|
|
2016-12-28 04:43:38 +08:00
|
|
|
#ifdef TC_PRU
|
|
|
|
#include "elf/pru.h"
|
|
|
|
#endif
|
|
|
|
|
2003-12-13 20:57:40 +08: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);
|
* read.h (s_vendor_attribute): Move to...
* config/obj-elf.h (obj_elf_vendor_attribute): ... here.
* read.c (potable): Remove "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): Delete, move
to config/obj-elf.c.
(s_vendor_attribute): Delete, move to obj_elf_vendor_attribute
in config/obj-elf.c.
(s_gnu_attribute): Delete, move to obj_elf_gnu_attribute in
config/obj-elf.c.
* config/obj-elf.c (elf_pseudo_table): Add "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): New, moved
from read.c.
(obj_elf_vendor_attribute): New, moved from s_vendor_attribute
in read.c.
(obj_elf_gnu_attribute): New, moved from s_gnu_attribute in
read.c.
* config/tc-arm.c (s_arm_eabi_attribute): Rename
s_vendor_attribute to obj_elf_vendor_attribute.
* config/tc-tic6x.c (s_tic6x_c6xabi_attribute): Likewise.
2012-11-10 02:07:10 +08:00
|
|
|
static void obj_elf_gnu_attribute (int);
|
2003-12-13 20:57:40 +08:00
|
|
|
static void obj_elf_tls_common (int);
|
2003-12-13 16:59:24 +08:00
|
|
|
static void obj_elf_lcomm (int);
|
2005-04-15 19:38:59 +08:00
|
|
|
static void obj_elf_struct (int);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
static const pseudo_typeS elf_pseudo_table[] =
|
|
|
|
{
|
|
|
|
{"comm", obj_elf_common, 0},
|
1999-06-07 10:28:54 +08:00
|
|
|
{"common", obj_elf_common, 1},
|
1999-05-03 15:29:11 +08:00
|
|
|
{"ident", obj_elf_ident, 0},
|
2003-12-13 16:59:24 +08:00
|
|
|
{"lcomm", obj_elf_lcomm, 0},
|
1999-05-03 15:29:11 +08: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 07:15:34 +08:00
|
|
|
{"pushsection", obj_elf_section, 1},
|
|
|
|
{"popsection", obj_elf_popsection, 0},
|
1999-05-03 15:29:11 +08:00
|
|
|
{"size", obj_elf_size, 0},
|
|
|
|
{"type", obj_elf_type, 0},
|
|
|
|
{"version", obj_elf_version, 0},
|
|
|
|
{"weak", obj_elf_weak, 0},
|
|
|
|
|
2000-09-14 19:48:26 +08:00
|
|
|
/* These define symbol visibility. */
|
2000-01-04 02:34:24 +08:00
|
|
|
{"internal", obj_elf_visibility, STV_INTERNAL},
|
|
|
|
{"hidden", obj_elf_visibility, STV_HIDDEN},
|
|
|
|
{"protected", obj_elf_visibility, STV_PROTECTED},
|
|
|
|
|
1999-05-03 15:29:11 +08: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. */
|
2018-02-13 21:14:47 +08:00
|
|
|
{"vtable_inherit", obj_elf_vtable_inherit, 0},
|
|
|
|
{"vtable_entry", obj_elf_vtable_entry, 0},
|
1999-05-03 15:29:11 +08:00
|
|
|
|
* read.h (s_vendor_attribute): Move to...
* config/obj-elf.h (obj_elf_vendor_attribute): ... here.
* read.c (potable): Remove "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): Delete, move
to config/obj-elf.c.
(s_vendor_attribute): Delete, move to obj_elf_vendor_attribute
in config/obj-elf.c.
(s_gnu_attribute): Delete, move to obj_elf_gnu_attribute in
config/obj-elf.c.
* config/obj-elf.c (elf_pseudo_table): Add "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): New, moved
from read.c.
(obj_elf_vendor_attribute): New, moved from s_vendor_attribute
in read.c.
(obj_elf_gnu_attribute): New, moved from s_gnu_attribute in
read.c.
* config/tc-arm.c (s_arm_eabi_attribute): Rename
s_vendor_attribute to obj_elf_vendor_attribute.
* config/tc-tic6x.c (s_tic6x_c6xabi_attribute): Likewise.
2012-11-10 02:07:10 +08:00
|
|
|
/* A GNU extension for object attributes. */
|
|
|
|
{"gnu_attribute", obj_elf_gnu_attribute, 0},
|
|
|
|
|
2000-09-14 19:48:26 +08:00
|
|
|
/* These are used for dwarf. */
|
1999-05-03 15:29:11 +08:00
|
|
|
{"2byte", cons, 2},
|
|
|
|
{"4byte", cons, 4},
|
|
|
|
{"8byte", cons, 8},
|
2003-05-21 20:07:56 +08:00
|
|
|
/* These are used for dwarf2. */
|
2018-02-13 21:14:47 +08:00
|
|
|
{ "file", dwarf2_directive_file, 0 },
|
2003-05-21 20:07:56 +08:00
|
|
|
{ "loc", dwarf2_directive_loc, 0 },
|
2005-09-21 02:24:48 +08:00
|
|
|
{ "loc_mark_labels", dwarf2_directive_loc_mark_labels, 0 },
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* We need to trap the section changing calls to handle .previous. */
|
|
|
|
{"data", obj_elf_data, 0},
|
2005-04-15 19:38:59 +08:00
|
|
|
{"offset", obj_elf_struct, 0},
|
|
|
|
{"struct", obj_elf_struct, 0},
|
1999-05-03 15:29:11 +08: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 21:12:53 +08:00
|
|
|
{"tls_common", obj_elf_tls_common, 0},
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* End sentinel. */
|
1999-07-12 04:20:04 +08:00
|
|
|
{NULL, NULL, 0},
|
1999-05-03 15:29:11 +08: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. */
|
GAS: Add ECOFF `.aent' pseudo-op support
Implement the ECOFF `.aent' pseudo-op for ECOFF-style `.mdebug' section
support with ELF objects and, for consistency, also with ECOFF objects.
This is so that the same MIPS source can be assembled without and with
`.mdebug' section generation enabled.
Taking the `gas/testsuite/gas/mips/aent.s' test case source as an
example and the `mips-linux' target we have:
$ as -o aent.o aent.s
$ as -mdebug -o aent.o aent.s
aent.s: Assembler messages:
aent.s:10: Error: unknown pseudo-op: `.aent'
$
because for the !ECOFF_DEBUGGING case (which is the default) the
pseudo-op is already handled by the MIPS backend with `s_mips_ent',
however no handler is present for the opposite case.
For the MIPS target this is a functional regression introduced with
commit ecb4347adecd ("Last take: approval for MIPS_STABS_ELF killing"),
<https://sourceware.org/ml/binutils/2002-06/msg00443.html>, where
support for the `.mdebug' section was added along with its associated
`-mdebug'/`-no-mdebug' command-line options, bringing an inconsistency
between the assembly syntax supported for each of these options as far
as the `.aent' pseudo-op is concerned.
Assembly language documentation available describes the pseudo-op
respectively as follows[1]:
"
.aent name, symno Sets an alternate entry point for the current
procedure. Use this information when you want
to generate information for the debugger. It must
appear inside an .ent/.end pair."
and[2]:
"
.aent name [,symno]
Sets an alternate entry point for the current procedure. Use this
information when you want to generate information for the debugger.
This directive must appear between a pair of .ent and .end directives.
(The optional symno is for compiler use only. It refers to a dense
number in a .T file (symbol table).)"
Copy the approach from `s_mips_ent' then and add `.aent' support to the
`.ent' pseudo-op handler shared between the ELF and ECOFF object file
format backends, by setting BSF_FUNCTION for the symbol requested.
References:
[1] "MIPSpro Assembly Language Programmer's Guide", Silicon Graphics,
Inc., Document Number 007-2418-004, Section 8.1 "Op-Codes", p. 96
<http://techpubs.sgi.com/library/manuals/2000/007-2418-004/pdf/007-2418-004.pdf>
[2] "Digital UNIX Assembly Language Programmer's Guide", Digital
Equipment Corporation, Order Number: AA-PS31D-TE, March 1996,
Chapter 5 "Assembler Directives", p. 5-2
<http://h41361.www4.hpe.com/docs/base_doc/DOCUMENTATION/V40G_PDF/APS31DTE.PDF>
gas/
* ecoff.c (ecoff_directive_ent, add_procedure): Handle `.aent'.
* config/obj-ecoff.c (obj_pseudo_table): Add "aent" entry.
* config/obj-elf.c (ecoff_debug_pseudo_table): Likewise.
* testsuite/gas/mips/aent-2.d: New test.
* testsuite/gas/mips/aent-mdebug.d: New test.
* testsuite/gas/mips/aent-mdebug-2.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
2017-02-16 09:50:29 +08:00
|
|
|
{ "aent", ecoff_directive_ent, 1 },
|
1999-05-03 15:29:11 +08:00
|
|
|
{ "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-12 04:20:04 +08:00
|
|
|
{NULL, NULL, 0} /* end sentinel */
|
1999-05-03 15:29:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#undef NO_RELOC
|
|
|
|
#include "aout/aout64.h"
|
|
|
|
|
|
|
|
/* This is called when the assembler starts. */
|
|
|
|
|
2005-07-25 23:41:08 +08:00
|
|
|
asection *elf_com_section_ptr;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_begin (void)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2003-12-13 20:57:40 +08:00
|
|
|
asection *s;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Add symbols for the known sections to the symbol table. */
|
2003-12-13 20:57:40 +08: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 23:41:08 +08:00
|
|
|
elf_com_section_ptr = bfd_com_section_ptr;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_pop_insert (void)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
pop_insert (elf_pseudo_table);
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
pop_insert (ecoff_debug_pseudo_table);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bfd_vma
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_s_get_size (symbolS *sym)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return S_GET_SIZE (sym);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_s_set_size (symbolS *sym, bfd_vma sz)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
S_SET_SIZE (sym, sz);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bfd_vma
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_s_get_align (symbolS *sym)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return S_GET_ALIGN (sym);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_s_set_align (symbolS *sym, bfd_vma align)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
S_SET_ALIGN (sym, align);
|
|
|
|
}
|
|
|
|
|
2000-01-27 06:48:31 +08:00
|
|
|
int
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_s_get_other (symbolS *sym)
|
2000-01-27 06:48:31 +08: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-23 05:19:43 +08:00
|
|
|
static void
|
2003-12-13 20:57:40 +08: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-23 05:19:43 +08:00
|
|
|
{
|
|
|
|
S_SET_OTHER (sym, other);
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static int
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_sec_sym_ok_for_reloc (asection *sec)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return obj_sec_sym_ok_for_reloc (sec);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-11-10 11:28:45 +08:00
|
|
|
elf_file_symbol (const char *s, int appfile)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
asymbol *bsym;
|
|
|
|
|
2004-11-10 11:28:45 +08:00
|
|
|
if (!appfile
|
|
|
|
|| symbol_rootP == NULL
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
|| (bsym = symbol_get_bfdsym (symbol_rootP)) == NULL
|
|
|
|
|| (bsym->flags & BSF_FILE) == 0)
|
2004-11-10 11:28:45 +08:00
|
|
|
{
|
|
|
|
symbolS *sym;
|
2014-07-26 19:30:50 +08:00
|
|
|
size_t name_length;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2004-11-10 11:28:45 +08:00
|
|
|
sym = symbol_new (s, absolute_section, 0, NULL);
|
|
|
|
symbol_set_frag (sym, &zero_address_frag);
|
2009-07-27 18:04:25 +08:00
|
|
|
|
|
|
|
name_length = strlen (s);
|
|
|
|
if (name_length > strlen (S_GET_NAME (sym)))
|
|
|
|
{
|
|
|
|
obstack_grow (¬es, s, name_length + 1);
|
2009-09-11 23:27:38 +08:00
|
|
|
S_SET_NAME (sym, (const char *) obstack_finish (¬es));
|
2009-07-27 18:04:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
strcpy ((char *) S_GET_NAME (sym), s);
|
|
|
|
|
2004-11-10 11:28:45 +08:00
|
|
|
symbol_get_bfdsym (sym)->flags |= BSF_FILE;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2015-12-08 17:11:58 +08:00
|
|
|
if (symbol_rootP != sym
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
&& ((bsym = symbol_get_bfdsym (symbol_rootP)) == NULL
|
|
|
|
|| (bsym->flags & BSF_FILE) == 0))
|
2004-11-10 11:28:45 +08:00
|
|
|
{
|
|
|
|
symbol_remove (sym, &symbol_rootP, &symbol_lastP);
|
|
|
|
symbol_insert (sym, symbol_rootP, &symbol_rootP, &symbol_lastP);
|
2015-12-08 17:11:58 +08:00
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#ifdef DEBUG
|
2015-12-08 17:11:58 +08:00
|
|
|
verify_symbol_chain (symbol_rootP, symbol_lastP);
|
1999-05-03 15:29:11 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
2005-02-17 21:46:05 +08:00
|
|
|
ecoff_new_file (s, appfile);
|
1999-05-03 15:29:11 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2003-12-13 16:23:05 +08:00
|
|
|
/* Called from read.c:s_comm after we've parsed .comm symbol, size.
|
|
|
|
Parse a possible alignment value. */
|
|
|
|
|
2005-07-25 23:41:08 +08:00
|
|
|
symbolS *
|
2003-12-13 16:23:05 +08:00
|
|
|
elf_common_parse (int ignore ATTRIBUTE_UNUSED, symbolS *symbolP, addressT size)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2003-12-13 16:23:05 +08:00
|
|
|
addressT align = 0;
|
|
|
|
int is_local = symbol_get_obj (symbolP)->local;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-12-13 16:23:05 +08:00
|
|
|
if (*input_line_pointer == ',')
|
1999-06-07 10:28:54 +08:00
|
|
|
{
|
2003-12-13 16:23:05 +08:00
|
|
|
char *save = input_line_pointer;
|
1999-06-07 10:28:54 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
input_line_pointer++;
|
|
|
|
SKIP_WHITESPACE ();
|
2003-12-13 16:23:05 +08:00
|
|
|
|
|
|
|
if (*input_line_pointer == '"')
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2003-12-13 16:23:05 +08: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 15:29:11 +08:00
|
|
|
{
|
2003-12-13 16:23:05 +08: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 15:29:11 +08:00
|
|
|
}
|
2003-12-13 16:23:05 +08:00
|
|
|
/* ??? Don't ask me why these are always global. */
|
|
|
|
is_local = 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-13 16:23:05 +08:00
|
|
|
input_line_pointer = save;
|
|
|
|
align = parse_align (is_local);
|
|
|
|
if (align == (addressT) -1)
|
|
|
|
return NULL;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
}
|
2003-12-13 16:23:05 +08:00
|
|
|
|
|
|
|
if (is_local)
|
|
|
|
{
|
|
|
|
bss_alloc (symbolP, size, align);
|
|
|
|
S_CLEAR_EXTERNAL (symbolP);
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
else
|
|
|
|
{
|
2003-12-13 16:23:05 +08:00
|
|
|
S_SET_VALUE (symbolP, size);
|
|
|
|
S_SET_ALIGN (symbolP, align);
|
|
|
|
S_SET_EXTERNAL (symbolP);
|
2005-07-25 23:41:08 +08:00
|
|
|
S_SET_SEGMENT (symbolP, elf_com_section_ptr);
|
1999-05-03 15:29:11 +08: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 08:29:48 +08:00
|
|
|
symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
|
1999-05-03 15:29:11 +08: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 21:12:53 +08:00
|
|
|
return symbolP;
|
1999-05-03 15:29:11 +08: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 21:12:53 +08:00
|
|
|
void
|
2003-12-13 20:57:40 +08: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 21:12:53 +08:00
|
|
|
{
|
2003-12-13 16:23:05 +08: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 21:12:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 20:57:40 +08: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 21:12:53 +08:00
|
|
|
{
|
2003-12-13 16:23:05 +08: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 21:12:53 +08:00
|
|
|
|
|
|
|
if (symbolP)
|
|
|
|
symbol_get_bfdsym (symbolP)->flags |= BSF_THREAD_LOCAL;
|
|
|
|
}
|
|
|
|
|
2003-12-13 16:59:24 +08: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 22:34:42 +08:00
|
|
|
static symbolS *
|
|
|
|
get_sym_from_input_line_and_check (void)
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
char c;
|
|
|
|
symbolS *sym;
|
|
|
|
|
2015-08-21 23:42:14 +08:00
|
|
|
c = get_symbol_name (& name);
|
2010-07-15 22:34:42 +08:00
|
|
|
sym = symbol_find_or_make (name);
|
|
|
|
*input_line_pointer = c;
|
2015-08-21 23:42:14 +08:00
|
|
|
SKIP_WHITESPACE_AFTER_NAME ();
|
2010-07-15 22:34:42 +08:00
|
|
|
|
|
|
|
/* 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 15:29:11 +08:00
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_local (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
int c;
|
|
|
|
symbolS *symbolP;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2010-08-18 04:03:41 +08:00
|
|
|
symbolP = get_sym_from_input_line_and_check ();
|
2010-07-15 22:34:42 +08:00
|
|
|
c = *input_line_pointer;
|
1999-05-03 15:29:11 +08: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 08:29:48 +08:00
|
|
|
symbol_get_obj (symbolP)->local = 1;
|
1999-05-03 15:29:11 +08: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 20:57:40 +08:00
|
|
|
obj_elf_weak (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
int c;
|
|
|
|
symbolS *symbolP;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2010-08-18 04:03:41 +08:00
|
|
|
symbolP = get_sym_from_input_line_and_check ();
|
2010-07-15 22:34:42 +08:00
|
|
|
c = *input_line_pointer;
|
1999-05-03 15:29:11 +08: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-04 02:34:24 +08:00
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_visibility (int visibility)
|
2000-01-04 02:34:24 +08:00
|
|
|
{
|
|
|
|
int c;
|
|
|
|
symbolS *symbolP;
|
|
|
|
asymbol *bfdsym;
|
|
|
|
elf_symbol_type *elfsym;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2010-07-15 22:34:42 +08:00
|
|
|
symbolP = get_sym_from_input_line_and_check ();
|
2000-01-27 07:58:13 +08:00
|
|
|
|
2000-01-04 02:34:24 +08:00
|
|
|
bfdsym = symbol_get_bfdsym (symbolP);
|
|
|
|
elfsym = elf_symbol_from (bfd_asymbol_bfd (bfdsym), bfdsym);
|
2000-01-27 07:58:13 +08: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-23 01:56:02 +08:00
|
|
|
gas_assert (elfsym);
|
2000-01-27 07:58:13 +08:00
|
|
|
|
2002-11-20 10:39:21 +08:00
|
|
|
elfsym->internal_elf_sym.st_other &= ~3;
|
|
|
|
elfsym->internal_elf_sym.st_other |= visibility;
|
2000-01-27 07:58:13 +08:00
|
|
|
|
2010-07-15 22:34:42 +08:00
|
|
|
c = *input_line_pointer;
|
2000-01-04 02:34:24 +08:00
|
|
|
if (c == ',')
|
|
|
|
{
|
|
|
|
input_line_pointer ++;
|
2000-01-27 07:58:13 +08:00
|
|
|
|
2000-01-04 02:34:24 +08:00
|
|
|
SKIP_WHITESPACE ();
|
2000-01-27 07:58:13 +08:00
|
|
|
|
2000-01-04 02:34:24 +08:00
|
|
|
if (*input_line_pointer == '\n')
|
|
|
|
c = '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (c == ',');
|
2000-01-27 07:58:13 +08:00
|
|
|
|
2000-01-04 02:34:24 +08:00
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static segT previous_section;
|
|
|
|
static int previous_subsection;
|
|
|
|
|
1999-06-06 07:15:34 +08:00
|
|
|
struct section_stack
|
|
|
|
{
|
|
|
|
struct section_stack *next;
|
|
|
|
segT seg, prev_seg;
|
|
|
|
int subseg, prev_subseg;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct section_stack *section_stack;
|
|
|
|
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
/* Match both section group name and the sh_info field. */
|
|
|
|
struct section_match
|
|
|
|
{
|
|
|
|
const char *group_name;
|
|
|
|
unsigned int info;
|
|
|
|
};
|
|
|
|
|
2004-05-02 22:36:25 +08:00
|
|
|
static bfd_boolean
|
2004-05-01 00:47:46 +08:00
|
|
|
get_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
|
|
|
|
{
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
struct section_match *match = (struct section_match *) inf;
|
|
|
|
const char *gname = match->group_name;
|
2004-05-01 00:47:46 +08:00
|
|
|
const char *group_name = elf_group_name (sec);
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
unsigned int info = elf_section_data (sec)->this_hdr.sh_info;
|
2009-07-25 07:49:51 +08:00
|
|
|
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
return (info == match->info
|
|
|
|
&& (group_name == gname
|
|
|
|
|| (group_name != NULL
|
|
|
|
&& gname != NULL
|
|
|
|
&& strcmp (group_name, gname) == 0)));
|
2004-05-01 00:47:46 +08:00
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08: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 23:09:29 +08:00
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_change_section (const char *name,
|
2016-02-15 19:11:46 +08:00
|
|
|
unsigned int type,
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
unsigned int info,
|
* 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 20:42:52 +08:00
|
|
|
bfd_vma attr,
|
2003-12-13 20:57:40 +08:00
|
|
|
int entsize,
|
|
|
|
const char *group_name,
|
|
|
|
int linkonce,
|
|
|
|
int push)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2004-05-02 22:36:25 +08:00
|
|
|
asection *old_sec;
|
1999-05-03 15:29:11 +08:00
|
|
|
segT sec;
|
2000-04-20 09:43:32 +08:00
|
|
|
flagword flags;
|
2005-07-04 09:53:44 +08:00
|
|
|
const struct elf_backend_data *bed;
|
2003-09-23 08:41:14 +08:00
|
|
|
const struct bfd_elf_special_section *ssect;
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
struct section_match match;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
1999-06-06 07:15:34 +08:00
|
|
|
/* Switch to the section, creating it if necessary. */
|
|
|
|
if (push)
|
|
|
|
{
|
|
|
|
struct section_stack *elt;
|
2016-04-01 21:26:30 +08:00
|
|
|
elt = XNEW (struct section_stack);
|
1999-06-06 07:15:34 +08: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;
|
|
|
|
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
match.group_name = group_name;
|
|
|
|
match.info = info;
|
2004-05-02 22:36:25 +08:00
|
|
|
old_sec = bfd_get_section_by_name_if (stdoutput, name, get_section,
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
(void *) &match);
|
2004-05-02 22:36:25 +08:00
|
|
|
if (old_sec)
|
2004-05-01 00:47:46 +08:00
|
|
|
{
|
2004-05-02 22:36:25 +08:00
|
|
|
sec = old_sec;
|
2004-05-01 00:47:46 +08:00
|
|
|
subseg_set (sec, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sec = subseg_force_new (name, 0);
|
|
|
|
|
2005-07-04 09:53:44 +08:00
|
|
|
bed = get_elf_backend_data (stdoutput);
|
|
|
|
ssect = (*bed->get_sec_type_attr) (stdoutput, sec);
|
1999-06-06 07:15:34 +08:00
|
|
|
|
2003-09-23 08:41:14 +08:00
|
|
|
if (ssect != NULL)
|
2003-07-25 22:35:56 +08:00
|
|
|
{
|
2003-10-24 23:41:23 +08:00
|
|
|
bfd_boolean override = FALSE;
|
|
|
|
|
2003-07-25 22:35:56 +08:00
|
|
|
if (type == SHT_NULL)
|
2003-09-23 08:41:14 +08:00
|
|
|
type = ssect->type;
|
|
|
|
else if (type != ssect->type)
|
2003-07-25 22:35:56 +08:00
|
|
|
{
|
2004-05-02 22:36:25 +08:00
|
|
|
if (old_sec == NULL
|
2009-11-06 19:51:04 +08:00
|
|
|
/* Some older versions of gcc will emit
|
2002-10-22 18:56:45 +08:00
|
|
|
|
2003-07-25 22:35:56 +08:00
|
|
|
.section .init_array,"aw",@progbits
|
2002-10-22 18:56:45 +08:00
|
|
|
|
2003-07-25 22:35:56 +08:00
|
|
|
for __attribute__ ((section (".init_array"))).
|
2005-07-25 23:41:08 +08:00
|
|
|
"@progbits" is incorrect. Also for x86-64 large bss
|
2009-11-06 19:51:04 +08:00
|
|
|
sections, some older versions of gcc will emit
|
2005-07-25 23:41:08 +08:00
|
|
|
|
|
|
|
.section .lbss,"aw",@progbits
|
|
|
|
|
2003-07-25 22:35:56 +08:00
|
|
|
"@progbits" is incorrect. */
|
2005-07-25 23:41:08 +08:00
|
|
|
#ifdef TC_I386
|
|
|
|
&& (bed->s->arch_size != 64
|
|
|
|
|| !(ssect->attr & SHF_X86_64_LARGE))
|
|
|
|
#endif
|
2003-09-23 08:41:14 +08:00
|
|
|
&& ssect->type != SHT_INIT_ARRAY
|
|
|
|
&& ssect->type != SHT_FINI_ARRAY
|
|
|
|
&& ssect->type != SHT_PREINIT_ARRAY)
|
2003-07-25 22:35:56 +08:00
|
|
|
{
|
|
|
|
/* We allow to specify any type for a .note section. */
|
2016-02-15 19:11:46 +08:00
|
|
|
if (ssect->type != SHT_NOTE
|
|
|
|
/* Processor and application defined types are allowed too. */
|
|
|
|
&& type < SHT_LOPROC)
|
2003-07-25 22:35:56 +08:00
|
|
|
as_warn (_("setting incorrect section type for %s"),
|
|
|
|
name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
as_warn (_("ignoring incorrect section type for %s"),
|
2000-04-20 09:43:32 +08:00
|
|
|
name);
|
2003-09-23 08:41:14 +08:00
|
|
|
type = ssect->type;
|
2003-07-25 22:35:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-15 19:11:46 +08:00
|
|
|
if (old_sec == NULL && ((attr & ~(SHF_MASKOS | SHF_MASKPROC))
|
|
|
|
& ~ssect->attr) != 0)
|
2003-07-25 22:35:56 +08:00
|
|
|
{
|
|
|
|
/* As a GNU extension, we permit a .note section to be
|
2003-09-23 08:41:14 +08:00
|
|
|
allocatable. If the linker sees an allocatable .note
|
2003-07-25 22:35:56 +08:00
|
|
|
section, it will create a PT_NOTE segment in the output
|
2003-07-30 22:11:03 +08:00
|
|
|
file. We also allow "x" for .note.GNU-stack. */
|
2003-09-23 08:41:14 +08: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 23:41:23 +08:00
|
|
|
&& (attr
|
|
|
|
& ~ssect->attr
|
|
|
|
& ~SHF_MERGE
|
|
|
|
& ~SHF_STRINGS) == 0)
|
2003-09-23 08:41:14 +08:00
|
|
|
;
|
2003-10-24 23:41:23 +08: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 12:08:32 +08:00
|
|
|
/* .note.GNU-stack can have SHF_EXECINSTR. */
|
|
|
|
else if (attr == SHF_EXECINSTR
|
|
|
|
&& strcmp (name, ".note.GNU-stack") == 0)
|
|
|
|
override = TRUE;
|
2006-05-06 02:24:45 +08: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-10 01:00:44 +08: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-06 02:24:45 +08:00
|
|
|
#endif
|
2003-09-23 08:41:14 +08:00
|
|
|
else
|
2003-10-24 23:41:23 +08:00
|
|
|
{
|
2004-05-01 00:47:46 +08:00
|
|
|
if (group_name == NULL)
|
|
|
|
as_warn (_("setting incorrect section attributes for %s"),
|
|
|
|
name);
|
2003-10-24 23:41:23 +08:00
|
|
|
override = TRUE;
|
|
|
|
}
|
2003-07-25 22:35:56 +08:00
|
|
|
}
|
2016-02-15 19:11:46 +08:00
|
|
|
|
2004-05-02 22:36:25 +08:00
|
|
|
if (!override && old_sec == NULL)
|
2003-09-23 08:41:14 +08:00
|
|
|
attr |= ssect->attr;
|
2003-07-25 22:35:56 +08:00
|
|
|
}
|
2000-04-20 09:43:32 +08:00
|
|
|
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
if ((attr & (SHF_ALLOC | SHF_GNU_MBIND)) == SHF_GNU_MBIND)
|
|
|
|
as_fatal (_("SHF_ALLOC isn't set for GNU_MBIND section: %s"), name);
|
|
|
|
|
2000-04-20 09:43:32 +08: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 08:34:36 +08: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 21:12:53 +08:00
|
|
|
| ((attr & SHF_STRINGS) ? SEC_STRINGS : 0)
|
2010-05-18 11:31:07 +08: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 21:12:53 +08:00
|
|
|
| ((attr & SHF_TLS) ? SEC_THREAD_LOCAL : 0));
|
1999-06-06 07:15:34 +08:00
|
|
|
#ifdef md_elf_section_flags
|
2000-04-20 09:43:32 +08:00
|
|
|
flags = md_elf_section_flags (flags, attr, type);
|
1999-06-06 07:15:34 +08:00
|
|
|
#endif
|
|
|
|
|
2004-05-01 00:47:46 +08:00
|
|
|
if (linkonce)
|
|
|
|
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
|
|
|
|
2004-05-02 22:36:25 +08:00
|
|
|
if (old_sec == NULL)
|
2000-04-20 09:43:32 +08:00
|
|
|
{
|
|
|
|
symbolS *secsym;
|
|
|
|
|
2009-08-31 20:02:36 +08:00
|
|
|
if (type == SHT_NULL)
|
|
|
|
type = bfd_elf_get_default_section_type (flags);
|
2004-12-16 21:23:22 +08:00
|
|
|
elf_section_type (sec) = type;
|
|
|
|
elf_section_flags (sec) = attr;
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
elf_section_data (sec)->this_hdr.sh_info = info;
|
2004-12-16 21:23:22 +08:00
|
|
|
|
1999-06-06 07:15:34 +08:00
|
|
|
/* Prevent SEC_HAS_CONTENTS from being inadvertently set. */
|
|
|
|
if (type == SHT_NOBITS)
|
2003-12-13 16:59:24 +08:00
|
|
|
seg_info (sec)->bss = 1;
|
1999-06-06 07:15:34 +08:00
|
|
|
|
|
|
|
bfd_set_section_flags (stdoutput, sec, flags);
|
2001-04-13 08:34:36 +08:00
|
|
|
if (flags & SEC_MERGE)
|
|
|
|
sec->entsize = entsize;
|
2001-10-09 21:13:09 +08:00
|
|
|
elf_group_name (sec) = group_name;
|
1999-06-06 07:15:34 +08: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 16:59:24 +08:00
|
|
|
symbol_table_insert (section_symbol (sec));
|
1999-06-06 07:15:34 +08:00
|
|
|
}
|
2004-12-16 21:23:22 +08:00
|
|
|
else
|
2000-04-20 09:43:32 +08:00
|
|
|
{
|
2004-12-16 21:23:22 +08: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);
|
2016-02-15 19:11:46 +08:00
|
|
|
else
|
|
|
|
/* FIXME: Maybe we should consider removing a previously set
|
|
|
|
processor or application specific attribute as suspicious ? */
|
|
|
|
elf_section_flags (sec) = attr;
|
|
|
|
|
2004-12-16 21:23:22 +08:00
|
|
|
if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize)
|
|
|
|
as_warn (_("ignoring changed section entity size for %s"), name);
|
|
|
|
}
|
2000-04-20 09:43:32 +08:00
|
|
|
}
|
1999-06-06 07:15:34 +08:00
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
2000-04-20 09:43:32 +08:00
|
|
|
md_elf_section_change_hook ();
|
1999-06-06 07:15:34 +08: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 20:42:52 +08:00
|
|
|
static bfd_vma
|
2012-02-02 17:26:04 +08:00
|
|
|
obj_elf_parse_section_letters (char *str, size_t len, bfd_boolean *is_clone)
|
1999-06-06 07:15:34 +08: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 20:42:52 +08:00
|
|
|
bfd_vma attr = 0;
|
2012-02-02 17:26:04 +08:00
|
|
|
*is_clone = FALSE;
|
1999-06-06 07:15:34 +08:00
|
|
|
|
|
|
|
while (len > 0)
|
|
|
|
{
|
|
|
|
switch (*str)
|
|
|
|
{
|
|
|
|
case 'a':
|
|
|
|
attr |= SHF_ALLOC;
|
|
|
|
break;
|
2010-05-18 11:31:07 +08:00
|
|
|
case 'e':
|
|
|
|
attr |= SHF_EXCLUDE;
|
|
|
|
break;
|
1999-06-06 07:15:34 +08:00
|
|
|
case 'w':
|
|
|
|
attr |= SHF_WRITE;
|
|
|
|
break;
|
|
|
|
case 'x':
|
|
|
|
attr |= SHF_EXECINSTR;
|
|
|
|
break;
|
2001-09-12 00:46:38 +08:00
|
|
|
case 'M':
|
2001-04-13 08:34:36 +08:00
|
|
|
attr |= SHF_MERGE;
|
|
|
|
break;
|
2001-09-12 00:46:38 +08:00
|
|
|
case 'S':
|
2001-04-13 08:34:36 +08:00
|
|
|
attr |= SHF_STRINGS;
|
|
|
|
break;
|
2001-10-09 14:07:33 +08: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 21:12:53 +08:00
|
|
|
case 'T':
|
|
|
|
attr |= SHF_TLS;
|
|
|
|
break;
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
case 'd':
|
|
|
|
attr |= SHF_GNU_MBIND;
|
|
|
|
break;
|
2010-08-18 04:03:41 +08:00
|
|
|
case '?':
|
2012-02-02 17:26:04 +08:00
|
|
|
*is_clone = TRUE;
|
2010-08-18 04:03:41 +08:00
|
|
|
break;
|
2001-10-01 14:30:19 +08:00
|
|
|
/* Compatibility. */
|
|
|
|
case 'm':
|
|
|
|
if (*(str - 1) == 'a')
|
|
|
|
{
|
|
|
|
attr |= SHF_MERGE;
|
|
|
|
if (len > 1 && str[1] == 's')
|
|
|
|
{
|
|
|
|
attr |= SHF_STRINGS;
|
|
|
|
str++, len--;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2016-10-05 15:47:02 +08:00
|
|
|
/* Fall through. */
|
1999-06-06 07:15:34 +08:00
|
|
|
default:
|
|
|
|
{
|
2016-04-01 20:07:50 +08:00
|
|
|
const char *bad_msg = _("unrecognized .section attribute:"
|
|
|
|
" want a,e,w,x,M,S,G,T or number");
|
1999-06-06 07:15:34 +08: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 20:42:52 +08:00
|
|
|
bfd_vma md_attr = md_elf_section_letter (*str, &bad_msg);
|
2010-09-17 07:55:10 +08:00
|
|
|
if (md_attr != (bfd_vma) -1)
|
1999-06-06 07:15:34 +08:00
|
|
|
attr |= md_attr;
|
|
|
|
else
|
|
|
|
#endif
|
2016-02-15 19:11:46 +08:00
|
|
|
if (ISDIGIT (*str))
|
|
|
|
{
|
|
|
|
char * end;
|
|
|
|
|
|
|
|
attr |= strtoul (str, & end, 0);
|
|
|
|
/* Update str and len, allowing for the fact that
|
|
|
|
we will execute str++ and len-- below. */
|
|
|
|
end --;
|
|
|
|
len -= (end - str);
|
|
|
|
str = end;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
as_fatal ("%s", bad_msg);
|
1999-06-06 07:15:34 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
str++, len--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return attr;
|
|
|
|
}
|
|
|
|
|
2001-08-09 22:42:07 +08:00
|
|
|
static int
|
2008-04-23 21:54:56 +08:00
|
|
|
obj_elf_section_type (char *str, size_t len, bfd_boolean warn)
|
1999-06-06 07:15:34 +08: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 10:03:33 +08:00
|
|
|
if (len == 4 && strncmp (str, "note", 4) == 0)
|
|
|
|
return SHT_NOTE;
|
2004-09-09 04:52:49 +08: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 07:15:34 +08:00
|
|
|
|
|
|
|
#ifdef md_elf_section_type
|
|
|
|
{
|
|
|
|
int md_type = md_elf_section_type (str, len);
|
|
|
|
if (md_type >= 0)
|
|
|
|
return md_type;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-02-15 19:11:46 +08:00
|
|
|
if (ISDIGIT (*str))
|
|
|
|
{
|
|
|
|
char * end;
|
|
|
|
int type = strtoul (str, & end, 0);
|
|
|
|
|
|
|
|
if (warn && (size_t) (end - str) != len)
|
|
|
|
as_warn (_("extraneous characters at end of numeric section type"));
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2008-04-23 21:54:56 +08: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 20:42:52 +08:00
|
|
|
static bfd_vma
|
2008-04-23 21:54:56 +08: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 11:31:07 +08:00
|
|
|
if (len == 7 && strncmp (str, "exclude", 7) == 0)
|
|
|
|
return SHF_EXCLUDE;
|
2008-04-23 21:54:56 +08: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 20:42:52 +08:00
|
|
|
bfd_vma md_attr = md_elf_section_word (str, len);
|
|
|
|
if (md_attr > 0)
|
2008-04-23 21:54:56 +08: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 07:15:34 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-10-07 14:16:54 +08:00
|
|
|
/* Get name of section. */
|
2016-03-24 10:39:13 +08:00
|
|
|
const char *
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_section_name (void)
|
2001-10-07 14:16:54 +08: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 21:31:04 +08:00
|
|
|
as_bad (_("missing name"));
|
2001-10-07 14:16:54 +08:00
|
|
|
ignore_rest_of_line ();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-03-28 17:49:15 +08:00
|
|
|
name = xmemdup0 (input_line_pointer, end - input_line_pointer);
|
2015-06-10 11:06:29 +08:00
|
|
|
|
|
|
|
while (flag_sectname_subst)
|
|
|
|
{
|
|
|
|
char *subst = strchr (name, '%');
|
|
|
|
if (subst && subst[1] == 'S')
|
|
|
|
{
|
|
|
|
int oldlen = strlen (name);
|
|
|
|
int substlen = strlen (now_seg->name);
|
|
|
|
int newlen = oldlen - 2 + substlen;
|
2016-04-07 04:26:46 +08:00
|
|
|
char *newname = XNEWVEC (char, newlen + 1);
|
2015-06-10 11:06:29 +08:00
|
|
|
int headlen = subst - name;
|
|
|
|
memcpy (newname, name, headlen);
|
|
|
|
strcpy (newname + headlen, now_seg->name);
|
|
|
|
strcat (newname + headlen, subst + 2);
|
|
|
|
xfree (name);
|
|
|
|
name = newname;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-05-02 10:46:36 +08:00
|
|
|
#ifdef tc_canonicalize_section_name
|
|
|
|
name = tc_canonicalize_section_name (name);
|
|
|
|
#endif
|
2001-10-07 14:16:54 +08:00
|
|
|
input_line_pointer = end;
|
|
|
|
}
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
1999-06-06 07:15:34 +08:00
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_section (int push)
|
1999-06-06 07:15:34 +08:00
|
|
|
{
|
2016-03-24 10:39:13 +08:00
|
|
|
const char *name, *group_name;
|
|
|
|
char *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 20:42:52 +08:00
|
|
|
int type, dummy;
|
|
|
|
bfd_vma attr;
|
2001-04-13 08:34:36 +08:00
|
|
|
int entsize;
|
2002-06-04 09:06:16 +08:00
|
|
|
int linkonce;
|
2007-10-12 04:20:55 +08:00
|
|
|
subsegT new_subsection = -1;
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
unsigned int info = 0;
|
1999-06-06 07:15:34 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
if (flag_mri)
|
|
|
|
{
|
|
|
|
char mri_type;
|
|
|
|
|
1999-06-06 07:15:34 +08:00
|
|
|
#ifdef md_flush_pending_output
|
2000-06-19 09:22:44 +08:00
|
|
|
md_flush_pending_output ();
|
1999-06-06 07:15:34 +08:00
|
|
|
#endif
|
|
|
|
|
1999-05-03 15:29:11 +08: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;
|
|
|
|
}
|
|
|
|
|
2001-10-07 14:16:54 +08:00
|
|
|
name = obj_elf_section_name ();
|
|
|
|
if (name == NULL)
|
|
|
|
return;
|
1999-05-03 15:29:11 +08:00
|
|
|
type = SHT_NULL;
|
|
|
|
attr = 0;
|
2001-10-09 21:13:09 +08:00
|
|
|
group_name = NULL;
|
2001-04-13 08:34:36 +08:00
|
|
|
entsize = 0;
|
2002-06-04 09:06:16 +08:00
|
|
|
linkonce = 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
{
|
|
|
|
/* Skip the comma. */
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
|
2007-10-28 01:45:53 +08:00
|
|
|
if (push && ISDIGIT (*input_line_pointer))
|
2007-10-12 04:20:55 +08:00
|
|
|
{
|
2007-10-28 01:45:53 +08:00
|
|
|
/* .pushsection has an optional subsection. */
|
2007-10-12 04:20:55 +08:00
|
|
|
new_subsection = (subsegT) get_absolute_expression ();
|
2007-10-28 01:45:53 +08: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-12 04:20:55 +08:00
|
|
|
}
|
2007-10-28 01:45:53 +08:00
|
|
|
|
|
|
|
if (*input_line_pointer == '"')
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2012-02-02 17:26:04 +08:00
|
|
|
bfd_boolean is_clone;
|
2010-08-18 04:03:41 +08:00
|
|
|
|
1999-06-06 07:15:34 +08:00
|
|
|
beg = demand_copy_C_string (&dummy);
|
|
|
|
if (beg == NULL)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
1999-06-06 07:15:34 +08:00
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2012-02-02 17:26:04 +08:00
|
|
|
attr |= obj_elf_parse_section_letters (beg, strlen (beg), &is_clone);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
{
|
1999-06-06 07:15:34 +08:00
|
|
|
char c;
|
2001-10-09 14:07:33 +08:00
|
|
|
char *save = input_line_pointer;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
1999-06-06 07:15:34 +08:00
|
|
|
c = *input_line_pointer;
|
|
|
|
if (c == '"')
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
1999-06-06 07:15:34 +08:00
|
|
|
beg = demand_copy_C_string (&dummy);
|
|
|
|
if (beg == NULL)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
1999-06-06 07:15:34 +08:00
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2008-04-23 21:54:56 +08:00
|
|
|
type = obj_elf_section_type (beg, strlen (beg), TRUE);
|
1999-06-06 07:15:34 +08:00
|
|
|
}
|
|
|
|
else if (c == '@' || c == '%')
|
|
|
|
{
|
2015-08-21 23:42:14 +08:00
|
|
|
++input_line_pointer;
|
2016-02-15 19:11:46 +08:00
|
|
|
|
|
|
|
if (ISDIGIT (* input_line_pointer))
|
|
|
|
{
|
|
|
|
type = strtoul (input_line_pointer, & input_line_pointer, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
c = get_symbol_name (& beg);
|
|
|
|
(void) restore_line_pointer (c);
|
|
|
|
type = obj_elf_section_type (beg, input_line_pointer - beg, TRUE);
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2001-10-09 14:07:33 +08:00
|
|
|
else
|
|
|
|
input_line_pointer = save;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
2001-04-13 08:34:36 +08:00
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
2001-10-07 14:16:54 +08:00
|
|
|
if ((attr & SHF_MERGE) != 0 && *input_line_pointer == ',')
|
2001-04-13 08:34:36 +08:00
|
|
|
{
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
entsize = get_absolute_expression ();
|
2001-10-07 14:16:54 +08:00
|
|
|
SKIP_WHITESPACE ();
|
2001-04-13 08:34:36 +08:00
|
|
|
if (entsize < 0)
|
|
|
|
{
|
2001-10-07 14:16:54 +08:00
|
|
|
as_warn (_("invalid merge entity size"));
|
2001-04-13 08:34:36 +08:00
|
|
|
attr &= ~SHF_MERGE;
|
|
|
|
entsize = 0;
|
|
|
|
}
|
|
|
|
}
|
2001-10-07 14:16:54 +08:00
|
|
|
else if ((attr & SHF_MERGE) != 0)
|
|
|
|
{
|
|
|
|
as_warn (_("entity size for SHF_MERGE not specified"));
|
|
|
|
attr &= ~SHF_MERGE;
|
|
|
|
}
|
2001-10-09 14:07:33 +08:00
|
|
|
|
2012-02-02 17:26:04 +08:00
|
|
|
if ((attr & SHF_GROUP) != 0 && is_clone)
|
2010-08-18 04:03:41 +08:00
|
|
|
{
|
|
|
|
as_warn (_("? section flag ignored with G present"));
|
2012-02-02 17:26:04 +08:00
|
|
|
is_clone = FALSE;
|
2010-08-18 04:03:41 +08:00
|
|
|
}
|
2001-10-09 14:07:33 +08:00
|
|
|
if ((attr & SHF_GROUP) != 0 && *input_line_pointer == ',')
|
|
|
|
{
|
|
|
|
++input_line_pointer;
|
2001-10-09 21:13:09 +08:00
|
|
|
group_name = obj_elf_section_name ();
|
|
|
|
if (group_name == NULL)
|
2001-10-09 14:07:33 +08:00
|
|
|
attr &= ~SHF_GROUP;
|
2012-05-19 18:36:32 +08:00
|
|
|
else if (*input_line_pointer == ',')
|
2002-06-04 09:06:16 +08:00
|
|
|
{
|
2012-05-19 18:36:32 +08:00
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (strncmp (input_line_pointer, "comdat", 6) == 0)
|
|
|
|
{
|
|
|
|
input_line_pointer += 6;
|
|
|
|
linkonce = 1;
|
|
|
|
}
|
2002-06-04 09:06:16 +08:00
|
|
|
}
|
|
|
|
else if (strncmp (name, ".gnu.linkonce", 13) == 0)
|
|
|
|
linkonce = 1;
|
2001-10-09 14:07:33 +08:00
|
|
|
}
|
|
|
|
else if ((attr & SHF_GROUP) != 0)
|
|
|
|
{
|
|
|
|
as_warn (_("group name for SHF_GROUP not specified"));
|
|
|
|
attr &= ~SHF_GROUP;
|
|
|
|
}
|
2010-08-18 04:03:41 +08:00
|
|
|
|
2012-02-02 17:26:04 +08:00
|
|
|
if (is_clone)
|
2010-08-18 04:03:41 +08: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;
|
|
|
|
}
|
|
|
|
}
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
|
|
|
|
if ((attr & SHF_GNU_MBIND) != 0 && *input_line_pointer == ',')
|
|
|
|
{
|
|
|
|
++input_line_pointer;
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (ISDIGIT (* input_line_pointer))
|
|
|
|
{
|
|
|
|
char *t = input_line_pointer;
|
|
|
|
info = strtoul (input_line_pointer,
|
|
|
|
&input_line_pointer, 0);
|
|
|
|
if (info == (unsigned int) -1)
|
|
|
|
{
|
|
|
|
as_warn (_("unsupported mbind section info: %s"), t);
|
|
|
|
info = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
1999-06-06 07:15:34 +08:00
|
|
|
char c;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer != '#')
|
|
|
|
{
|
2004-03-18 21:31:04 +08:00
|
|
|
as_bad (_("character following name is not '#'"));
|
1999-05-03 15:29:11 +08:00
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
2015-08-21 23:42:14 +08:00
|
|
|
++input_line_pointer;
|
|
|
|
c = get_symbol_name (& beg);
|
|
|
|
(void) restore_line_pointer (c);
|
1999-06-06 07:15:34 +08:00
|
|
|
|
2008-04-23 21:54:56 +08:00
|
|
|
attr |= obj_elf_section_word (beg, input_line_pointer - beg, & type);
|
1999-06-06 07:15:34 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
}
|
|
|
|
while (*input_line_pointer++ == ',');
|
|
|
|
--input_line_pointer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-28 01:45:53 +08:00
|
|
|
done:
|
1999-05-03 15:29:11 +08:00
|
|
|
demand_empty_rest_of_line ();
|
1999-06-06 07:15:34 +08:00
|
|
|
|
Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX
Mark an ALLOC section, which should be placed in special memory area,
with SHF_GNU_MBIND. Its sh_info field indicates the special memory
type. GNU_MBIND section names start with ".mbind" so that they are
placed as orphan sections by linker. All input GNU_MBIND sections
with the same sh_type, sh_flags and sh_info are placed in one output
GNU_MBIND section. In executable and shared object, create a
GNU_MBIND segment for each GNU_MBIND section and its segment type is
PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is
aligned at page boundary.
The assembler syntax:
.section .mbind.foo,"adx",%progbits
^ 0: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.foo,"adx",%progbits,0x1
^ 1: Special memory type.
|
'd' for SHF_GNU_MBIND.
.section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2
^ 2: Special memory type.
|
'd' for SHF_GNU_MBIND.
bfd/
* elf.c (get_program_header_size): Add a GNU_MBIND segment for
each GNU_MBIND section and align GNU_MBIND section to page size.
(_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
segment for each GNU_MBIND section.
(_bfd_elf_init_private_section_data): Copy sh_info from input
for GNU_MBIND section.
binutils/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX.
(get_elf_section_flags): Handle SHF_GNU_MBIND.
(process_section_headers): Likewise.
* testsuite/binutils-all/mbind1.s: New file.
* testsuite/binutils-all/objcopy.exp: Run readelf test on
mbind1.s.
gas/
* NEWS: Mention support for ELF SHF_GNU_MBIND.
* config/obj-elf.c (section_match): New.
(get_section): Match both sh_info and group name.
(obj_elf_change_section): Add argument for sh_info. Pass both
sh_info and group name to get_section. Issue an error for
SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info.
(obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'.
(obj_elf_section): Support SHF_GNU_MBIND section info.
* config/obj-elf.h (obj_elf_change_section): Add argument for
sh_info.
* config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to
obj_elf_change_section.
* config/tc-ia64.c (obj_elf_vms_common): Likewise.
* config/tc-microblaze.c (microblaze_s_data): Likewise.
(microblaze_s_sdata): Likewise.
(microblaze_s_rdata): Likewise.
(microblaze_s_bss): Likewise.
* config/tc-mips.c (s_change_section): Likewise.
* config/tc-msp430.c (msp430_profiler): Likewise.
* config/tc-rx.c (parse_rx_section): Likewise.
* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
* doc/as.texinfo: Document 'd' for SHF_GNU_MBIND.
* testsuite/gas/elf/elf.exp: Run section12a, section12b and
section13.
* testsuite/gas/elf/section10.d: Updated.
* testsuite/gas/elf/section10.s: Likewise.
* testsuite/gas/elf/section12.s: New file.
* testsuite/gas/elf/section12a.d: Likewise.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.l: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.s: Likewise.
include/
* elf/common.h (PT_GNU_MBIND_NUM): New.
(PT_GNU_MBIND_LO): Likewise.
(PT_GNU_MBIND_HI): Likewise.
(SHF_GNU_MBIND): Likewise.
ld/
* NEWS: Mention support for ELF SHF_GNU_MBIND and
PT_GNU_MBIND_XXX.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place
input GNU_MBIND sections with the same type, attributes and
sh_info field into a single output GNU_MBIND section.
* testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b.
* testsuite/ld-elf/mbind1.s: New file.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/mbind2a.s: Likewise.
* testsuite/ld-elf/mbind2b.c: Likewise.
2017-04-05 00:05:48 +08:00
|
|
|
obj_elf_change_section (name, type, info, attr, entsize, group_name,
|
|
|
|
linkonce, push);
|
2007-10-12 04:20:55 +08:00
|
|
|
|
|
|
|
if (push && new_subsection != -1)
|
|
|
|
subseg_set (now_seg, new_subsection);
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Change to the .data section. */
|
|
|
|
|
1999-06-23 17:27:09 +08:00
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_data (int i)
|
1999-05-03 15:29:11 +08: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 17:27:09 +08:00
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_text (int i)
|
1999-05-03 15:29:11 +08: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 19:38:59 +08: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 15:29:11 +08:00
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_subsection (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2007-10-12 04:20:55 +08:00
|
|
|
int temp;
|
1999-05-03 15:29:11 +08: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 20:57:40 +08:00
|
|
|
obj_elf_section_change_hook (void)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
previous_section = now_seg;
|
|
|
|
previous_subsection = now_subseg;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_previous (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
1999-06-06 07:15:34 +08:00
|
|
|
segT new_section;
|
|
|
|
int new_subsection;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
if (previous_section == 0)
|
|
|
|
{
|
2001-10-07 14:16:54 +08:00
|
|
|
as_warn (_(".previous without corresponding .section; ignored"));
|
1999-05-03 15:29:11 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
1999-06-06 07:15:34 +08: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 20:57:40 +08:00
|
|
|
obj_elf_popsection (int xxx ATTRIBUTE_UNUSED)
|
1999-06-06 07:15:34 +08:00
|
|
|
{
|
|
|
|
struct section_stack *top = section_stack;
|
|
|
|
|
|
|
|
if (top == NULL)
|
|
|
|
{
|
2001-10-07 14:16:54 +08:00
|
|
|
as_warn (_(".popsection without corresponding .pushsection; ignored"));
|
1999-06-06 07:15:34 +08: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 15:29:11 +08:00
|
|
|
|
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_line (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
/* Assume delimiter is part of expression. BSD4.2 as fails with
|
2000-09-14 19:48:26 +08:00
|
|
|
delightful bug, so we are not being incompatible here. */
|
2003-12-13 20:57:40 +08:00
|
|
|
new_logical_line (NULL, get_absolute_expression ());
|
1999-05-03 15:29:11 +08: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 20:57:40 +08:00
|
|
|
obj_elf_symver (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
char c;
|
2001-07-30 14:15:49 +08:00
|
|
|
char old_lexat;
|
1999-05-03 15:29:11 +08:00
|
|
|
symbolS *sym;
|
|
|
|
|
2010-07-15 22:34:42 +08:00
|
|
|
sym = get_sym_from_input_line_and_check ();
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
if (*input_line_pointer != ',')
|
|
|
|
{
|
|
|
|
as_bad (_("expected comma after name in .symver"));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
++input_line_pointer;
|
2003-04-29 19:52:37 +08:00
|
|
|
SKIP_WHITESPACE ();
|
2001-07-30 14:15:49 +08:00
|
|
|
|
|
|
|
/* Temporarily include '@' in symbol names. */
|
|
|
|
old_lexat = lex_type[(unsigned char) '@'];
|
|
|
|
lex_type[(unsigned char) '@'] |= LEX_NAME;
|
2015-08-21 23:42:14 +08:00
|
|
|
c = get_symbol_name (& name);
|
2001-07-30 14:15:49 +08:00
|
|
|
lex_type[(unsigned char) '@'] = old_lexat;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2017-06-26 20:11:07 +08:00
|
|
|
if (S_IS_COMMON (sym))
|
|
|
|
{
|
|
|
|
as_bad (_("`%s' can't be versioned to common symbol '%s'"),
|
|
|
|
name, S_GET_NAME (sym));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-11-08 08:24:23 +08:00
|
|
|
if (symbol_get_obj (sym)->versioned_name == NULL)
|
|
|
|
{
|
|
|
|
symbol_get_obj (sym)->versioned_name = xstrdup (name);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2015-08-21 23:42:14 +08:00
|
|
|
(void) restore_line_pointer (c);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-17 03:29:12 +08:00
|
|
|
if (strchr (symbol_get_obj (sym)->versioned_name,
|
|
|
|
ELF_VER_CHR) == NULL)
|
2000-11-08 08:24:23 +08: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 15:29:11 +08:00
|
|
|
{
|
2000-11-08 08:24:23 +08: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;
|
|
|
|
}
|
|
|
|
|
2015-08-21 23:42:14 +08:00
|
|
|
(void) restore_line_pointer (c);
|
1999-05-03 15:29:11 +08: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 11:23:05 +08:00
|
|
|
struct fix *
|
2018-02-13 21:14:47 +08:00
|
|
|
obj_elf_get_vtable_inherit (void)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
char *cname, *pname;
|
|
|
|
symbolS *csym, *psym;
|
|
|
|
char c, bad = 0;
|
|
|
|
|
|
|
|
if (*input_line_pointer == '#')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
2015-08-21 23:42:14 +08:00
|
|
|
c = get_symbol_name (& cname);
|
1999-05-03 15:29:11 +08:00
|
|
|
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 08:29:48 +08:00
|
|
|
if (csym == NULL || symbol_get_frag (csym) == NULL)
|
1999-05-03 15:29:11 +08: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 23:26:42 +08:00
|
|
|
as_bad (_("expected `%s' to have already been set for .vtable_inherit"),
|
1999-05-03 15:29:11 +08:00
|
|
|
cname);
|
|
|
|
bad = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
*input_line_pointer = c;
|
|
|
|
|
2015-08-21 23:42:14 +08:00
|
|
|
SKIP_WHITESPACE_AFTER_NAME ();
|
1999-05-03 15:29:11 +08: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 23:26:42 +08:00
|
|
|
as_bad (_("expected comma after name in .vtable_inherit"));
|
1999-05-03 15:29:11 +08:00
|
|
|
ignore_rest_of_line ();
|
2000-09-05 11:23:05 +08:00
|
|
|
return NULL;
|
1999-05-03 15:29:11 +08: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 13:33:36 +08:00
|
|
|
|| ISSPACE (input_line_pointer[1])))
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
psym = section_symbol (absolute_section);
|
|
|
|
++input_line_pointer;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-21 23:42:14 +08:00
|
|
|
c = get_symbol_name (& pname);
|
1999-05-03 15:29:11 +08:00
|
|
|
psym = symbol_find_or_make (pname);
|
2015-08-21 23:42:14 +08:00
|
|
|
restore_line_pointer (c);
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
|
|
|
|
if (bad)
|
2000-09-05 11:23:05 +08:00
|
|
|
return NULL;
|
1999-05-03 15:29:11 +08: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-23 01:56:02 +08:00
|
|
|
gas_assert (symbol_get_value_expression (csym)->X_op == O_constant);
|
2000-09-05 11:23:05 +08: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 15:29:11 +08:00
|
|
|
}
|
2000-01-27 07:58:13 +08:00
|
|
|
|
2018-02-13 21:14:47 +08:00
|
|
|
/* This is a version of obj_elf_get_vtable_inherit() that is
|
|
|
|
suitable for use in struct _pseudo_type tables. */
|
|
|
|
|
|
|
|
void
|
|
|
|
obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
(void) obj_elf_get_vtable_inherit ();
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08: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 11:23:05 +08:00
|
|
|
struct fix *
|
2018-02-13 21:14:47 +08:00
|
|
|
obj_elf_get_vtable_entry (void)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
symbolS *sym;
|
|
|
|
offsetT offset;
|
|
|
|
|
|
|
|
if (*input_line_pointer == '#')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
2010-07-15 22:34:42 +08:00
|
|
|
sym = get_sym_from_input_line_and_check ();
|
1999-05-03 15:29:11 +08: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 23:26:42 +08:00
|
|
|
as_bad (_("expected comma after name in .vtable_entry"));
|
1999-05-03 15:29:11 +08:00
|
|
|
ignore_rest_of_line ();
|
2000-09-05 11:23:05 +08:00
|
|
|
return NULL;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
++input_line_pointer;
|
|
|
|
if (*input_line_pointer == '#')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
|
|
|
offset = get_absolute_expression ();
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
2000-09-05 11:23:05 +08:00
|
|
|
|
|
|
|
return fix_new (frag_now, frag_now_fix (), 0, sym, offset, 0,
|
|
|
|
BFD_RELOC_VTABLE_ENTRY);
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
2018-02-13 21:14:47 +08:00
|
|
|
/* This is a version of obj_elf_get_vtable_entry() that is
|
|
|
|
suitable for use in struct _pseudo_type tables. */
|
|
|
|
|
|
|
|
void
|
|
|
|
obj_elf_vtable_entry (int ignore ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
(void) obj_elf_get_vtable_entry ();
|
|
|
|
}
|
|
|
|
|
* read.h (s_vendor_attribute): Move to...
* config/obj-elf.h (obj_elf_vendor_attribute): ... here.
* read.c (potable): Remove "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): Delete, move
to config/obj-elf.c.
(s_vendor_attribute): Delete, move to obj_elf_vendor_attribute
in config/obj-elf.c.
(s_gnu_attribute): Delete, move to obj_elf_gnu_attribute in
config/obj-elf.c.
* config/obj-elf.c (elf_pseudo_table): Add "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): New, moved
from read.c.
(obj_elf_vendor_attribute): New, moved from s_vendor_attribute
in read.c.
(obj_elf_gnu_attribute): New, moved from s_gnu_attribute in
read.c.
* config/tc-arm.c (s_arm_eabi_attribute): Rename
s_vendor_attribute to obj_elf_vendor_attribute.
* config/tc-tic6x.c (s_tic6x_c6xabi_attribute): Likewise.
2012-11-10 02:07:10 +08:00
|
|
|
#define skip_whitespace(str) do { if (*(str) == ' ') ++(str); } while (0)
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
skip_past_char (char ** str, char c)
|
|
|
|
{
|
|
|
|
if (**str == c)
|
|
|
|
{
|
|
|
|
(*str)++;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#define skip_past_comma(str) skip_past_char (str, ',')
|
|
|
|
|
2014-05-21 02:02:41 +08:00
|
|
|
/* A list of attributes that have been explicitly set by the assembly code.
|
|
|
|
VENDOR is the vendor id, BASE is the tag shifted right by the number
|
|
|
|
of bits in MASK, and bit N of MASK is set if tag BASE+N has been set. */
|
|
|
|
struct recorded_attribute_info {
|
|
|
|
struct recorded_attribute_info *next;
|
|
|
|
int vendor;
|
|
|
|
unsigned int base;
|
|
|
|
unsigned long mask;
|
|
|
|
};
|
|
|
|
static struct recorded_attribute_info *recorded_attributes;
|
|
|
|
|
|
|
|
/* Record that we have seen an explicit specification of attribute TAG
|
|
|
|
for vendor VENDOR. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
record_attribute (int vendor, unsigned int tag)
|
|
|
|
{
|
|
|
|
unsigned int base;
|
|
|
|
unsigned long mask;
|
|
|
|
struct recorded_attribute_info *rai;
|
|
|
|
|
|
|
|
base = tag / (8 * sizeof (rai->mask));
|
|
|
|
mask = 1UL << (tag % (8 * sizeof (rai->mask)));
|
|
|
|
for (rai = recorded_attributes; rai; rai = rai->next)
|
|
|
|
if (rai->vendor == vendor && rai->base == base)
|
|
|
|
{
|
|
|
|
rai->mask |= mask;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
rai = XNEW (struct recorded_attribute_info);
|
|
|
|
rai->next = recorded_attributes;
|
|
|
|
rai->vendor = vendor;
|
|
|
|
rai->base = base;
|
|
|
|
rai->mask = mask;
|
|
|
|
recorded_attributes = rai;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return true if we have seen an explicit specification of attribute TAG
|
|
|
|
for vendor VENDOR. */
|
|
|
|
|
|
|
|
bfd_boolean
|
|
|
|
obj_elf_seen_attribute (int vendor, unsigned int tag)
|
|
|
|
{
|
|
|
|
unsigned int base;
|
|
|
|
unsigned long mask;
|
|
|
|
struct recorded_attribute_info *rai;
|
|
|
|
|
|
|
|
base = tag / (8 * sizeof (rai->mask));
|
|
|
|
mask = 1UL << (tag % (8 * sizeof (rai->mask)));
|
|
|
|
for (rai = recorded_attributes; rai; rai = rai->next)
|
|
|
|
if (rai->vendor == vendor && rai->base == base)
|
|
|
|
return (rai->mask & mask) != 0;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
* read.h (s_vendor_attribute): Move to...
* config/obj-elf.h (obj_elf_vendor_attribute): ... here.
* read.c (potable): Remove "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): Delete, move
to config/obj-elf.c.
(s_vendor_attribute): Delete, move to obj_elf_vendor_attribute
in config/obj-elf.c.
(s_gnu_attribute): Delete, move to obj_elf_gnu_attribute in
config/obj-elf.c.
* config/obj-elf.c (elf_pseudo_table): Add "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): New, moved
from read.c.
(obj_elf_vendor_attribute): New, moved from s_vendor_attribute
in read.c.
(obj_elf_gnu_attribute): New, moved from s_gnu_attribute in
read.c.
* config/tc-arm.c (s_arm_eabi_attribute): Rename
s_vendor_attribute to obj_elf_vendor_attribute.
* config/tc-tic6x.c (s_tic6x_c6xabi_attribute): Likewise.
2012-11-10 02:07:10 +08:00
|
|
|
/* Parse an attribute directive for VENDOR.
|
|
|
|
Returns the attribute number read, or zero on error. */
|
|
|
|
|
|
|
|
int
|
|
|
|
obj_elf_vendor_attribute (int vendor)
|
|
|
|
{
|
|
|
|
expressionS exp;
|
|
|
|
int type;
|
|
|
|
int tag;
|
|
|
|
unsigned int i = 0;
|
|
|
|
char *s = NULL;
|
|
|
|
|
|
|
|
/* Read the first number or name. */
|
|
|
|
skip_whitespace (input_line_pointer);
|
|
|
|
s = input_line_pointer;
|
|
|
|
if (ISDIGIT (*input_line_pointer))
|
|
|
|
{
|
|
|
|
expression (& exp);
|
|
|
|
if (exp.X_op != O_constant)
|
|
|
|
goto bad;
|
|
|
|
tag = exp.X_add_number;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
/* A name may contain '_', but no other punctuation. */
|
|
|
|
for (; ISALNUM (*input_line_pointer) || *input_line_pointer == '_';
|
|
|
|
++input_line_pointer)
|
|
|
|
i++;
|
|
|
|
if (i == 0)
|
|
|
|
goto bad;
|
|
|
|
|
2016-04-02 21:27:18 +08:00
|
|
|
name = xstrndup (s, i);
|
* read.h (s_vendor_attribute): Move to...
* config/obj-elf.h (obj_elf_vendor_attribute): ... here.
* read.c (potable): Remove "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): Delete, move
to config/obj-elf.c.
(s_vendor_attribute): Delete, move to obj_elf_vendor_attribute
in config/obj-elf.c.
(s_gnu_attribute): Delete, move to obj_elf_gnu_attribute in
config/obj-elf.c.
* config/obj-elf.c (elf_pseudo_table): Add "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): New, moved
from read.c.
(obj_elf_vendor_attribute): New, moved from s_vendor_attribute
in read.c.
(obj_elf_gnu_attribute): New, moved from s_gnu_attribute in
read.c.
* config/tc-arm.c (s_arm_eabi_attribute): Rename
s_vendor_attribute to obj_elf_vendor_attribute.
* config/tc-tic6x.c (s_tic6x_c6xabi_attribute): Likewise.
2012-11-10 02:07:10 +08:00
|
|
|
|
|
|
|
#ifndef CONVERT_SYMBOLIC_ATTRIBUTE
|
|
|
|
#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
tag = CONVERT_SYMBOLIC_ATTRIBUTE (name);
|
|
|
|
if (tag == -1)
|
|
|
|
{
|
|
|
|
as_bad (_("Attribute name not recognised: %s"), name);
|
|
|
|
ignore_rest_of_line ();
|
2016-03-22 00:31:46 +08:00
|
|
|
free (name);
|
* read.h (s_vendor_attribute): Move to...
* config/obj-elf.h (obj_elf_vendor_attribute): ... here.
* read.c (potable): Remove "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): Delete, move
to config/obj-elf.c.
(s_vendor_attribute): Delete, move to obj_elf_vendor_attribute
in config/obj-elf.c.
(s_gnu_attribute): Delete, move to obj_elf_gnu_attribute in
config/obj-elf.c.
* config/obj-elf.c (elf_pseudo_table): Add "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): New, moved
from read.c.
(obj_elf_vendor_attribute): New, moved from s_vendor_attribute
in read.c.
(obj_elf_gnu_attribute): New, moved from s_gnu_attribute in
read.c.
* config/tc-arm.c (s_arm_eabi_attribute): Rename
s_vendor_attribute to obj_elf_vendor_attribute.
* config/tc-tic6x.c (s_tic6x_c6xabi_attribute): Likewise.
2012-11-10 02:07:10 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2016-03-22 00:31:46 +08:00
|
|
|
free (name);
|
* read.h (s_vendor_attribute): Move to...
* config/obj-elf.h (obj_elf_vendor_attribute): ... here.
* read.c (potable): Remove "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): Delete, move
to config/obj-elf.c.
(s_vendor_attribute): Delete, move to obj_elf_vendor_attribute
in config/obj-elf.c.
(s_gnu_attribute): Delete, move to obj_elf_gnu_attribute in
config/obj-elf.c.
* config/obj-elf.c (elf_pseudo_table): Add "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): New, moved
from read.c.
(obj_elf_vendor_attribute): New, moved from s_vendor_attribute
in read.c.
(obj_elf_gnu_attribute): New, moved from s_gnu_attribute in
read.c.
* config/tc-arm.c (s_arm_eabi_attribute): Rename
s_vendor_attribute to obj_elf_vendor_attribute.
* config/tc-tic6x.c (s_tic6x_c6xabi_attribute): Likewise.
2012-11-10 02:07:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type = _bfd_elf_obj_attrs_arg_type (stdoutput, vendor, tag);
|
|
|
|
|
|
|
|
if (skip_past_comma (&input_line_pointer) == -1)
|
|
|
|
goto bad;
|
|
|
|
if (type & 1)
|
|
|
|
{
|
|
|
|
expression (& exp);
|
|
|
|
if (exp.X_op != O_constant)
|
|
|
|
{
|
|
|
|
as_bad (_("expected numeric constant"));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
i = exp.X_add_number;
|
|
|
|
}
|
|
|
|
if ((type & 3) == 3
|
|
|
|
&& skip_past_comma (&input_line_pointer) == -1)
|
|
|
|
{
|
|
|
|
as_bad (_("expected comma"));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (type & 2)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
skip_whitespace (input_line_pointer);
|
|
|
|
if (*input_line_pointer != '"')
|
|
|
|
goto bad_string;
|
|
|
|
s = demand_copy_C_string (&len);
|
|
|
|
}
|
|
|
|
|
2014-05-21 02:02:41 +08:00
|
|
|
record_attribute (vendor, tag);
|
* read.h (s_vendor_attribute): Move to...
* config/obj-elf.h (obj_elf_vendor_attribute): ... here.
* read.c (potable): Remove "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): Delete, move
to config/obj-elf.c.
(s_vendor_attribute): Delete, move to obj_elf_vendor_attribute
in config/obj-elf.c.
(s_gnu_attribute): Delete, move to obj_elf_gnu_attribute in
config/obj-elf.c.
* config/obj-elf.c (elf_pseudo_table): Add "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): New, moved
from read.c.
(obj_elf_vendor_attribute): New, moved from s_vendor_attribute
in read.c.
(obj_elf_gnu_attribute): New, moved from s_gnu_attribute in
read.c.
* config/tc-arm.c (s_arm_eabi_attribute): Rename
s_vendor_attribute to obj_elf_vendor_attribute.
* config/tc-tic6x.c (s_tic6x_c6xabi_attribute): Likewise.
2012-11-10 02:07:10 +08:00
|
|
|
switch (type & 3)
|
|
|
|
{
|
|
|
|
case 3:
|
|
|
|
bfd_elf_add_obj_attr_int_string (stdoutput, vendor, tag, i, s);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
bfd_elf_add_obj_attr_string (stdoutput, vendor, tag, s);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
bfd_elf_add_obj_attr_int (stdoutput, vendor, tag, i);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
return tag;
|
|
|
|
bad_string:
|
|
|
|
as_bad (_("bad string constant"));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return 0;
|
|
|
|
bad:
|
|
|
|
as_bad (_("expected <tag> , <value>"));
|
|
|
|
ignore_rest_of_line ();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Parse a .gnu_attribute directive. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
obj_elf_gnu_attribute (int ignored ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
obj_elf_vendor_attribute (OBJ_ATTR_GNU);
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_obj_read_begin_hook (void)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
ecoff_read_begin_hook ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_obj_symbol_new_hook (symbolS *symbolP)
|
1999-05-03 15:29:11 +08: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 08:29:48 +08: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 15:29:11 +08:00
|
|
|
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
ecoff_symbol_new_hook (symbolP);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2001-08-08 21:11:58 +08: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 20:57:40 +08:00
|
|
|
elf_copy_symbol_attributes (symbolS *dest, symbolS *src)
|
2001-08-08 21:11:58 +08:00
|
|
|
{
|
2001-10-09 14:07:33 +08: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)
|
2016-04-01 21:26:30 +08:00
|
|
|
destelf->size = XNEW (expressionS);
|
2001-10-09 14:07:33 +08: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-02 02:36:08 +08: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 21:11:58 +08:00
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_version (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08: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 20:57:40 +08:00
|
|
|
asection *note_secp = NULL;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if (*input_line_pointer == '\"')
|
|
|
|
{
|
2006-11-10 15:47:14 +08:00
|
|
|
unsigned int len;
|
|
|
|
|
2000-09-14 19:48:26 +08:00
|
|
|
++input_line_pointer; /* -> 1st char of string. */
|
1999-05-03 15:29:11 +08: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 15:47:14 +08:00
|
|
|
/* Create the .note section. */
|
1999-05-03 15:29:11 +08:00
|
|
|
note_secp = subseg_new (".note", 0);
|
|
|
|
bfd_set_section_flags (stdoutput,
|
|
|
|
note_secp,
|
|
|
|
SEC_HAS_CONTENTS | SEC_READONLY);
|
2017-11-29 17:32:49 +08:00
|
|
|
record_alignment (note_secp, 2);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2006-11-10 15:47:14 +08:00
|
|
|
/* Process the version string. */
|
|
|
|
len = strlen (name) + 1;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2006-11-10 15:47:14 +08: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 15:29:11 +08:00
|
|
|
i_note.type = NT_VERSION;
|
|
|
|
p = frag_more (sizeof (e_note.namesz));
|
2003-12-13 20:57:40 +08:00
|
|
|
md_number_to_chars (p, i_note.namesz, sizeof (e_note.namesz));
|
1999-05-03 15:29:11 +08:00
|
|
|
p = frag_more (sizeof (e_note.descsz));
|
2003-12-13 20:57:40 +08:00
|
|
|
md_number_to_chars (p, i_note.descsz, sizeof (e_note.descsz));
|
1999-05-03 15:29:11 +08:00
|
|
|
p = frag_more (sizeof (e_note.type));
|
2003-12-13 20:57:40 +08:00
|
|
|
md_number_to_chars (p, i_note.type, sizeof (e_note.type));
|
2006-11-10 15:47:14 +08:00
|
|
|
p = frag_more (len);
|
2006-11-22 11:35:36 +08:00
|
|
|
memcpy (p, name, len);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
frag_align (2, 0, 0);
|
|
|
|
|
|
|
|
subseg_set (seg, subseg);
|
|
|
|
}
|
|
|
|
else
|
2006-11-10 15:47:14 +08:00
|
|
|
as_bad (_("expected quoted string"));
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_size (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2015-08-21 23:42:14 +08:00
|
|
|
char *name;
|
|
|
|
char c = get_symbol_name (&name);
|
1999-05-03 15:29:11 +08:00
|
|
|
char *p;
|
|
|
|
expressionS exp;
|
|
|
|
symbolS *sym;
|
|
|
|
|
|
|
|
p = input_line_pointer;
|
|
|
|
*p = c;
|
2015-08-21 23:42:14 +08:00
|
|
|
SKIP_WHITESPACE_AFTER_NAME ();
|
1999-05-03 15:29:11 +08:00
|
|
|
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-24 04:43:01 +08: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 15:29:11 +08:00
|
|
|
else
|
|
|
|
{
|
2016-04-01 21:26:30 +08:00
|
|
|
symbol_get_obj (sym)->size = XNEW (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 08:29:48 +08:00
|
|
|
*symbol_get_obj (sym)->size = exp;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the ELF .type pseudo-op. This sets the type of a symbol.
|
2008-04-23 21:54:56 +08:00
|
|
|
There are six syntaxes:
|
2000-01-27 07:58:13 +08:00
|
|
|
|
1999-05-03 15:29:11 +08: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 11:20:54 +08:00
|
|
|
The fifth (used on SVR4/860) is
|
|
|
|
.type SYM,"function"
|
2008-04-23 21:54:56 +08:00
|
|
|
The sixth (emitted by recent SunPRO under Solaris) is
|
|
|
|
.type SYM,[0-9]
|
|
|
|
where the integer is the STT_* value.
|
1999-05-03 15:29:11 +08:00
|
|
|
*/
|
|
|
|
|
2008-04-23 21:54:56 +08: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
|
2015-08-21 23:42:14 +08:00
|
|
|
*cp = get_symbol_name (&p);
|
2008-04-23 21:54:56 +08:00
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_type (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
char c;
|
|
|
|
int type;
|
2009-09-11 23:27:38 +08:00
|
|
|
const char *type_name;
|
1999-05-03 15:29:11 +08:00
|
|
|
symbolS *sym;
|
2000-09-05 11:23:05 +08:00
|
|
|
elf_symbol_type *elfsym;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2010-07-15 22:34:42 +08:00
|
|
|
sym = get_sym_from_input_line_and_check ();
|
|
|
|
c = *input_line_pointer;
|
2000-09-05 11:23:05 +08:00
|
|
|
elfsym = (elf_symbol_type *) symbol_get_bfdsym (sym);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
if (*input_line_pointer == ',')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
|
|
|
SKIP_WHITESPACE ();
|
|
|
|
if ( *input_line_pointer == '#'
|
|
|
|
|| *input_line_pointer == '@'
|
2000-07-29 11:20:54 +08:00
|
|
|
|| *input_line_pointer == '"'
|
1999-05-03 15:29:11 +08:00
|
|
|
|| *input_line_pointer == '%')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
2009-09-11 23:27:38 +08:00
|
|
|
type_name = obj_elf_type_name (& c);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
type = 0;
|
2009-09-11 23:27:38 +08:00
|
|
|
if (strcmp (type_name, "function") == 0
|
|
|
|
|| strcmp (type_name, "2") == 0
|
|
|
|
|| strcmp (type_name, "STT_FUNC") == 0)
|
1999-05-03 15:29:11 +08:00
|
|
|
type = BSF_FUNCTION;
|
2009-09-11 23:27:38 +08:00
|
|
|
else if (strcmp (type_name, "object") == 0
|
|
|
|
|| strcmp (type_name, "1") == 0
|
|
|
|
|| strcmp (type_name, "STT_OBJECT") == 0)
|
1999-05-03 15:29:11 +08:00
|
|
|
type = BSF_OBJECT;
|
2009-09-11 23:27:38 +08: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 07:44:45 +08:00
|
|
|
type = BSF_OBJECT | BSF_THREAD_LOCAL;
|
2009-09-11 23:27:38 +08:00
|
|
|
else if (strcmp (type_name, "notype") == 0
|
|
|
|
|| strcmp (type_name, "0") == 0
|
|
|
|
|| strcmp (type_name, "STT_NOTYPE") == 0)
|
2003-05-02 11:01:44 +08:00
|
|
|
;
|
2009-09-11 23:27:38 +08:00
|
|
|
else if (strcmp (type_name, "common") == 0
|
|
|
|
|| strcmp (type_name, "5") == 0
|
|
|
|
|| strcmp (type_name, "STT_COMMON") == 0)
|
2007-10-16 22:42:15 +08: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 23:27:38 +08: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 23:47:13 +08:00
|
|
|
{
|
|
|
|
const struct elf_backend_data *bed;
|
|
|
|
|
|
|
|
bed = get_elf_backend_data (stdoutput);
|
2011-07-03 21:37:09 +08:00
|
|
|
if (!(bed->elf_osabi == ELFOSABI_GNU
|
2011-12-15 19:37:03 +08:00
|
|
|
|| bed->elf_osabi == ELFOSABI_FREEBSD
|
2011-07-03 21:37:09 +08:00
|
|
|
/* GNU is still using the default value 0. */
|
2009-04-30 23:47:13 +08:00
|
|
|
|| bed->elf_osabi == ELFOSABI_NONE))
|
2011-12-15 19:37:03 +08:00
|
|
|
as_bad (_("symbol type \"%s\" is supported only by GNU and FreeBSD targets"),
|
2009-09-11 23:27:38 +08:00
|
|
|
type_name);
|
2009-04-30 23:47:13 +08:00
|
|
|
type = BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION;
|
|
|
|
}
|
2009-09-11 23:27:38 +08:00
|
|
|
else if (strcmp (type_name, "gnu_unique_object") == 0)
|
2009-07-23 21:00:30 +08: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 06:11:02 +08:00
|
|
|
struct elf_backend_data *bed;
|
2009-07-23 21:00:30 +08: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 06:11:02 +08:00
|
|
|
bed = (struct elf_backend_data *) get_elf_backend_data (stdoutput);
|
2011-07-03 21:37:09 +08:00
|
|
|
if (!(bed->elf_osabi == ELFOSABI_GNU
|
|
|
|
/* GNU is still using the default value 0. */
|
2009-07-23 21:00:30 +08:00
|
|
|
|| bed->elf_osabi == ELFOSABI_NONE))
|
|
|
|
as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
|
2009-09-11 23:27:38 +08:00
|
|
|
type_name);
|
2009-07-23 21:00:30 +08:00
|
|
|
type = BSF_OBJECT | BSF_GNU_UNIQUE;
|
2011-07-03 21:37:09 +08:00
|
|
|
/* PR 10549: Always set OSABI field to GNU for objects containing unique symbols. */
|
|
|
|
bed->elf_osabi = ELFOSABI_GNU;
|
2009-07-23 21:00:30 +08:00
|
|
|
}
|
2000-09-05 11:23:05 +08:00
|
|
|
#ifdef md_elf_symbol_type
|
2009-09-11 23:27:38 +08:00
|
|
|
else if ((type = md_elf_symbol_type (type_name, sym, elfsym)) != -1)
|
2000-09-05 11:23:05 +08:00
|
|
|
;
|
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
else
|
2009-09-11 23:27:38 +08:00
|
|
|
as_bad (_("unrecognized symbol type \"%s\""), type_name);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
*input_line_pointer = c;
|
|
|
|
|
2000-07-29 11:20:54 +08:00
|
|
|
if (*input_line_pointer == '"')
|
|
|
|
++input_line_pointer;
|
|
|
|
|
2019-07-04 16:35:47 +08:00
|
|
|
#ifdef md_elf_symbol_type_change
|
|
|
|
if (!md_elf_symbol_type_change (sym, elfsym, type))
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
flagword mask = BSF_FUNCTION | BSF_OBJECT;
|
|
|
|
|
|
|
|
if (type != BSF_FUNCTION)
|
|
|
|
mask |= BSF_GNU_INDIRECT_FUNCTION;
|
|
|
|
if (type != BSF_OBJECT)
|
|
|
|
{
|
|
|
|
mask |= BSF_GNU_UNIQUE | BSF_THREAD_LOCAL;
|
|
|
|
|
|
|
|
if (S_IS_COMMON (sym))
|
|
|
|
{
|
|
|
|
as_bad (_("cannot change type of common symbol '%s'"),
|
|
|
|
S_GET_NAME (sym));
|
|
|
|
mask = type = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Don't warn when changing to STT_NOTYPE. */
|
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
flagword new = (elfsym->symbol.flags & ~mask) | type;
|
|
|
|
|
|
|
|
if (new != (elfsym->symbol.flags | type))
|
|
|
|
as_warn (_("symbol '%s' already has its type set"), S_GET_NAME (sym));
|
|
|
|
elfsym->symbol.flags = new;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
elfsym->symbol.flags &= ~mask;
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
demand_empty_rest_of_line ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_ident (int ignore ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
static segT comment_section;
|
|
|
|
segT old_section = now_seg;
|
|
|
|
int old_subsection = now_subseg;
|
|
|
|
|
1999-11-04 06:13:33 +08:00
|
|
|
#ifdef md_flush_pending_output
|
|
|
|
md_flush_pending_output ();
|
|
|
|
#endif
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
if (!comment_section)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
comment_section = subseg_new (".comment", 0);
|
|
|
|
bfd_set_section_flags (stdoutput, comment_section,
|
2009-07-25 07:49:51 +08:00
|
|
|
SEC_READONLY | SEC_HAS_CONTENTS
|
|
|
|
| SEC_MERGE | SEC_STRINGS);
|
|
|
|
comment_section->entsize = 1;
|
2009-08-01 02:14:07 +08:00
|
|
|
#ifdef md_elf_section_change_hook
|
|
|
|
md_elf_section_change_hook ();
|
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
p = frag_more (1);
|
|
|
|
*p = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
subseg_set (comment_section, 0);
|
2007-10-05 01:05:37 +08:00
|
|
|
stringer (8 + 1);
|
1999-05-03 15:29:11 +08:00
|
|
|
subseg_set (old_section, old_subsection);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef INIT_STAB_SECTION
|
|
|
|
|
|
|
|
/* The first entry in a .stabs section is special. */
|
|
|
|
|
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
obj_elf_init_stab_section (segT seg)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2016-02-22 22:11:27 +08:00
|
|
|
const char *file;
|
1999-05-03 15:29:11 +08:00
|
|
|
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 19:48:26 +08:00
|
|
|
/* Make space for this first symbol. */
|
1999-05-03 15:29:11 +08:00
|
|
|
p = frag_more (12);
|
2000-09-14 19:48:26 +08:00
|
|
|
/* Zero it out. */
|
1999-05-03 15:29:11 +08:00
|
|
|
memset (p, 0, 12);
|
2016-02-22 22:11:27 +08:00
|
|
|
file = as_where (NULL);
|
2016-03-28 17:49:15 +08:00
|
|
|
stabstr_name = concat (segment_name (seg), "str", (char *) NULL);
|
2018-12-01 07:07:48 +08:00
|
|
|
stroff = get_stab_string_offset (file, stabstr_name, TRUE);
|
2010-08-31 13:34:46 +08:00
|
|
|
know (stroff == 1 || (stroff == 0 && file[0] == '\0'));
|
1999-05-03 15:29:11 +08: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 20:57:40 +08:00
|
|
|
adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08: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;
|
|
|
|
|
2016-03-22 00:31:46 +08:00
|
|
|
name = concat (sec->name, "str", NULL);
|
1999-05-03 15:29:11 +08:00
|
|
|
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-23 01:56:02 +08:00
|
|
|
gas_assert (p != 0);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-12-13 20:57:40 +08:00
|
|
|
bfd_h_put_16 (abfd, nsyms, p + 6);
|
|
|
|
bfd_h_put_32 (abfd, strsz, p + 8);
|
2016-03-22 00:31:46 +08:00
|
|
|
free (name);
|
1999-05-03 15:29:11 +08: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 11:29:40 +08:00
|
|
|
#ifdef OBJ_MAYBE_ELF
|
|
|
|
static
|
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_ecoff_set_ext (symbolS *sym, struct ecoff_extr *ext)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2003-12-13 20:57:40 +08:00
|
|
|
symbol_get_bfdsym (sym)->udata.p = ext;
|
1999-05-03 15:29:11 +08: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 16:39:46 +08:00
|
|
|
static bfd_boolean
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_get_extr (asymbol *sym, EXTR *ext)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
if (sym->udata.p == NULL)
|
2002-11-30 16:39:46 +08:00
|
|
|
return FALSE;
|
1999-05-03 15:29:11 +08:00
|
|
|
*ext = *(EXTR *) sym->udata.p;
|
2002-11-30 16:39:46 +08:00
|
|
|
return TRUE;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This function is called by bfd_ecoff_debug_externals. It has
|
|
|
|
nothing to do for ELF. */
|
|
|
|
|
|
|
|
static void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_set_index (asymbol *sym ATTRIBUTE_UNUSED,
|
|
|
|
bfd_size_type indx ATTRIBUTE_UNUSED)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* NEED_ECOFF_DEBUG */
|
|
|
|
|
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_frob_symbol (symbolS *symp, int *puntp)
|
1999-05-03 15:29:11 +08: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 08:29:48 +08:00
|
|
|
struct elf_obj_sy *sy_obj;
|
2011-03-06 22:05:25 +08: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 08:29:48 +08:00
|
|
|
|
1999-05-03 15:29:11 +08: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 08:29:48 +08:00
|
|
|
sy_obj = symbol_get_obj (symp);
|
|
|
|
|
2011-03-06 22:05:25 +08:00
|
|
|
size = sy_obj->size;
|
|
|
|
if (size != NULL)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2011-03-06 22:05:25 +08:00
|
|
|
if (resolve_expression (size)
|
|
|
|
&& size->X_op == O_constant)
|
|
|
|
S_SET_SIZE (symp, size->X_add_number);
|
2011-02-25 21:45:54 +08:00
|
|
|
else
|
2011-03-06 22:05:25 +08:00
|
|
|
{
|
2016-03-26 03:43:13 +08:00
|
|
|
if (!flag_allow_nonconst_size)
|
2011-03-18 19:21:33 +08:00
|
|
|
as_bad (_(".size expression for %s "
|
|
|
|
"does not evaluate to a constant"), S_GET_NAME (symp));
|
2011-03-16 20:58:26 +08:00
|
|
|
else
|
2011-03-18 19:21:33 +08:00
|
|
|
as_warn (_(".size expression for %s "
|
|
|
|
"does not evaluate to a constant"), S_GET_NAME (symp));
|
2011-03-06 22:05:25 +08: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 08:29:48 +08:00
|
|
|
free (sy_obj->size);
|
|
|
|
sy_obj->size = NULL;
|
1999-05-03 15:29:11 +08: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 08:29:48 +08:00
|
|
|
if (sy_obj->versioned_name != NULL)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2000-11-14 05:23:34 +08:00
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = strchr (sy_obj->versioned_name, ELF_VER_CHR);
|
2014-06-16 09:34:04 +08:00
|
|
|
if (p == NULL)
|
|
|
|
/* We will have already reported an error about a missing version. */
|
|
|
|
*puntp = TRUE;
|
2000-11-14 05:23:34 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* This symbol was given a new name with the .symver directive.
|
|
|
|
|
2003-12-13 16:59:24 +08: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 15:29:11 +08: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. */
|
|
|
|
|
2014-06-16 09:34:04 +08:00
|
|
|
else if (! S_IS_DEFINED (symp))
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
/* Verify that the name isn't using the @@ syntax--this is
|
2003-12-13 16:59:24 +08:00
|
|
|
reserved for definitions of the default version to link
|
|
|
|
against. */
|
1999-05-03 15:29:11 +08:00
|
|
|
if (p[1] == ELF_VER_CHR)
|
|
|
|
{
|
2014-06-16 09:34:04 +08:00
|
|
|
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 08:29:48 +08:00
|
|
|
sy_obj->versioned_name);
|
2002-11-30 16:39:46 +08:00
|
|
|
*puntp = TRUE;
|
1999-05-03 15:29:11 +08: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 08:29:48 +08:00
|
|
|
S_SET_NAME (symp, sy_obj->versioned_name);
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-13 20:57:40 +08:00
|
|
|
if (p[1] == ELF_VER_CHR && p[2] == ELF_VER_CHR)
|
2000-11-14 05:23:34 +08: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 20:57:40 +08:00
|
|
|
memmove (&p[2], &p[3], l);
|
2000-11-14 05:23:34 +08:00
|
|
|
S_SET_NAME (symp, sy_obj->versioned_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
symbolS *symp2;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-14 05:23:34 +08: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 15:29:11 +08:00
|
|
|
|
2000-11-14 05:23:34 +08:00
|
|
|
symp2 = symbol_find_or_make (sy_obj->versioned_name);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-14 05:23:34 +08:00
|
|
|
/* Now we act as though we saw symp2 = sym. */
|
2017-06-26 20:11:07 +08:00
|
|
|
if (S_IS_COMMON (symp))
|
|
|
|
{
|
|
|
|
as_bad (_("`%s' can't be versioned to common symbol '%s'"),
|
|
|
|
sy_obj->versioned_name, S_GET_NAME (symp));
|
|
|
|
*puntp = TRUE;
|
|
|
|
return;
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-14 05:23:34 +08:00
|
|
|
S_SET_SEGMENT (symp2, S_GET_SEGMENT (symp));
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-14 05:23:34 +08: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 15:29:11 +08:00
|
|
|
|
2000-11-14 05:23:34 +08:00
|
|
|
symbol_set_frag (symp2, symbol_get_frag (symp));
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-14 05:23:34 +08:00
|
|
|
/* This will copy over the size information. */
|
|
|
|
copy_symbol_attributes (symp2, symp);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-03-02 02:36:08 +08:00
|
|
|
S_SET_OTHER (symp2, S_GET_OTHER (symp));
|
|
|
|
|
2000-11-14 05:23:34 +08:00
|
|
|
if (S_IS_WEAK (symp))
|
|
|
|
S_SET_WEAK (symp2);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-14 05:23:34 +08:00
|
|
|
if (S_IS_EXTERNAL (symp))
|
|
|
|
S_SET_EXTERNAL (symp2);
|
|
|
|
}
|
1999-05-03 15:29:11 +08: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 08:29:48 +08:00
|
|
|
if (S_IS_WEAK (symp))
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
if (S_IS_COMMON (symp))
|
2001-10-07 14:16:54 +08:00
|
|
|
as_bad (_("symbol `%s' can not be both weak and common"),
|
1999-05-03 15:29:11 +08:00
|
|
|
S_GET_NAME (symp));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-09 14:07:33 +08:00
|
|
|
struct group_list
|
|
|
|
{
|
|
|
|
asection **head; /* Section lists. */
|
|
|
|
unsigned int num_group; /* Number of lists. */
|
2009-09-11 23:27:38 +08:00
|
|
|
struct hash_control *indexes; /* Maps group name to index in head array. */
|
2001-10-09 14:07:33 +08:00
|
|
|
};
|
|
|
|
|
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04 07:23:53 +08:00
|
|
|
static struct group_list groups;
|
|
|
|
|
2001-10-09 14:07:33 +08: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 20:57:40 +08:00
|
|
|
build_group_lists (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
|
2001-10-09 14:07:33 +08:00
|
|
|
{
|
2009-09-11 23:27:38 +08:00
|
|
|
struct group_list *list = (struct group_list *) inf;
|
2001-10-09 21:13:09 +08:00
|
|
|
const char *group_name = elf_group_name (sec);
|
2001-10-09 14:07:33 +08:00
|
|
|
unsigned int i;
|
2009-09-11 23:27:38 +08:00
|
|
|
unsigned int *elem_idx;
|
|
|
|
unsigned int *idx_ptr;
|
2001-10-09 14:07:33 +08: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 23:27:38 +08:00
|
|
|
elem_idx = (unsigned int *) hash_find (list->indexes, group_name);
|
|
|
|
if (elem_idx != NULL)
|
2001-10-09 14:07:33 +08:00
|
|
|
{
|
2009-09-11 23:27:38 +08:00
|
|
|
elf_next_in_group (sec) = list->head[*elem_idx];
|
|
|
|
list->head[*elem_idx] = sec;
|
|
|
|
return;
|
2001-10-09 14:07:33 +08: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;
|
2016-04-07 04:26:46 +08:00
|
|
|
list->head = XRESIZEVEC (asection *, list->head, newsize);
|
2001-10-09 14:07:33 +08:00
|
|
|
}
|
|
|
|
list->head[i] = sec;
|
|
|
|
list->num_group += 1;
|
2009-09-11 23:27:38 +08:00
|
|
|
|
|
|
|
/* Add index to hash. */
|
2016-04-01 21:26:30 +08:00
|
|
|
idx_ptr = XNEW (unsigned int);
|
2009-09-11 23:27:38 +08: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 14:07:33 +08:00
|
|
|
}
|
|
|
|
|
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04 07:23:53 +08:00
|
|
|
/* Create symbols for group signature. */
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
void
|
2010-10-24 02:05:10 +08:00
|
|
|
elf_adjust_symtab (void)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2001-10-09 14:07:33 +08:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
/* Go find section groups. */
|
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04 07:23:53 +08:00
|
|
|
groups.num_group = 0;
|
|
|
|
groups.head = NULL;
|
|
|
|
groups.indexes = hash_new ();
|
|
|
|
bfd_map_over_sections (stdoutput, build_group_lists, &groups);
|
2015-08-12 19:40:42 +08:00
|
|
|
|
2001-10-09 14:07:33 +08: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. */
|
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04 07:23:53 +08:00
|
|
|
for (i = 0; i < groups.num_group; i++)
|
2001-10-09 14:07:33 +08:00
|
|
|
{
|
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04 07:23:53 +08:00
|
|
|
const char *group_name = elf_group_name (groups.head[i]);
|
2002-06-07 22:57:50 +08:00
|
|
|
const char *sec_name;
|
2001-10-09 14:07:33 +08:00
|
|
|
asection *s;
|
|
|
|
flagword flags;
|
2002-06-07 22:57:50 +08:00
|
|
|
struct symbol *sy;
|
2001-10-09 14:07:33 +08:00
|
|
|
|
|
|
|
flags = SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_GROUP;
|
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04 07:23:53 +08:00
|
|
|
for (s = groups.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 20:34:08 +08:00
|
|
|
if ((s->flags ^ flags) & SEC_LINK_ONCE)
|
2002-06-04 09:06:16 +08:00
|
|
|
{
|
|
|
|
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04 07:23:53 +08:00
|
|
|
if (s != groups.head[i])
|
2002-06-04 09:06:16 +08:00
|
|
|
{
|
|
|
|
as_warn (_("assuming all members of group `%s' are COMDAT"),
|
|
|
|
group_name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-24 02:05:10 +08:00
|
|
|
sec_name = ".group";
|
2002-06-07 22:57:50 +08:00
|
|
|
s = subseg_force_new (sec_name, 0);
|
2001-10-09 14:07:33 +08: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 22:35:56 +08:00
|
|
|
elf_section_type (s) = SHT_GROUP;
|
2001-10-09 14:07:33 +08:00
|
|
|
|
2001-10-09 21:13:09 +08:00
|
|
|
/* Pass a pointer to the first section in this group. */
|
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04 07:23:53 +08:00
|
|
|
elf_next_in_group (s) = groups.head[i];
|
|
|
|
elf_sec_group (groups.head[i]) = s;
|
2010-10-24 02:05:10 +08:00
|
|
|
/* Make sure that the signature symbol for the group has the
|
|
|
|
name of the group. */
|
|
|
|
sy = symbol_find_exact (group_name);
|
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has
found its way into many gas files led to bugs, typically when code
expecting a symbolS* to point at a struct symbol is presented with a
struct local_symbol. Also, commit 158184ac9e changed these structs in
2012 but didn't catch all places where symbol bsym was being used to
test for a local_symbol.
* Makefile.am (HFILES): Delete struc-symbol.h.
* doc/internals.texi: Delete struc-symbol.h reference and out
of date local symbol description.
* struc-symbol.h: Delete. Move contents to..
* symbols.c: ..here.
(symbol_on_chain, symbol_symbolS): New functions.
* symbols.h (symbol_on_chain, symbol_symbolS): Declare.
* cgen.c: Don't #include struc-symbol.h.
(gas_cgen_parse_operand): Don't test for local_symbol using
bsym, instead call symbol_symbolS. Use symbol_get_bfdsym.
(weak_operand_overflow_check, make_right_shifted_expr): Use
symbol accessors.
* config/obj-coff.c: Don't #include struc-symbol.h.
(GET_FILENAME_STRING): Delete.
* config/obj-elf.c: Don't #include struc-symbol.h.
(elf_file_symbol): Use symbol accessors.
(elf_adjust_symtab): Call symbol_on_chain.
* config/obj-evax.c: Don't #include struc-symbol.h.
* config/tc-nds32.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-alpha.c: Likewise.
(add_to_link_pool, s_alpha_comm): Use symbol accessors.
* config/tc-arc.c: Don't #include struc-symbol.h.
(arc_check_relocs): Use symbol accessors, testing gas symbol
section rather than bfd symbol section.
* config/tc-avr.c: Don't #include struc-symbol.h.
(avr_patch_gccisr_frag): Use symbol accessors.
* config/tc-bfin.c: Don't #include struc-symbol.h.
(bfin_loop_beginend): Use symbol accessors.
* config/tc-csky.c: Don't #include struc-symbol.h.
(v2_work_movih, v2_work_ori): Use symbol accessors. Check for
absolute symbol as well as O_constant.
* config/tc-riscv.c: Don't #include struc-symbol.h.
(riscv_pre_output_hook): Use symbol accessors.
* config/tc-s390.c: Don't #include struc-symbol.h.
(s390_literals): Use symbol accessors.
* config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use
symbol accessors.
(s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't
test symbol bsym.
* config/tc-score7.c: Don't #include struc-symbol.h.
(s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors.
(s7_b32_relax_to_b16): Don't test symbol bsym.
* config/tc-sh.c: Don't #include struc-symbol.h.
(insert_loop_bounds): Use symbol accessors.
(sh_frob_section): Remove bogus symbol canonicalization.
* config/tc-tic54x.c: Don't #include struc-symbol.h.
(tic54x_bss): Use symbol accessors.
* config/tc-tilegx.c: Don't #include struc-symbol.h.
(emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors.
* config/tc-tilepro.c: Don't #include struc-symbol.h.
(emit_tilepro_instruction, tilepro_parse_name): Use accessors.
* config/tc-xtensa.c: Don't #include struc-symbol.h.
(xg_assemble_vliw_tokens): Use symbol accessors.
(xg_order_trampoline_chain): Likewise.
* ehopt.c: Don't #include struc-symbol.h.
(check_eh_frame): Correct local symbol test. Use symbol accessors.
* write.c: Don't #include struc-symbol.h.
(create_note_reloc, maybe_generate_build_notes): Use symbol accessors.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
2018-10-29 14:07:24 +08:00
|
|
|
if (!sy || !symbol_on_chain (sy, symbol_rootP, symbol_lastP))
|
2010-10-24 02:05:10 +08:00
|
|
|
{
|
|
|
|
/* Create the symbol now. */
|
|
|
|
sy = symbol_new (group_name, now_seg, (valueT) 0, frag_now);
|
2010-11-19 00:00:25 +08: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-24 02:05:10 +08:00
|
|
|
symbol_get_obj (sy)->local = 1;
|
2010-11-19 00:00:25 +08:00
|
|
|
#endif
|
2010-10-24 02:05:10 +08:00
|
|
|
symbol_table_insert (sy);
|
|
|
|
}
|
|
|
|
elf_group_id (s) = symbol_get_bfdsym (sy);
|
2001-10-09 14:07:33 +08:00
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
2010-10-24 02:05:10 +08: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-15 04:57:30 +08:00
|
|
|
/* It removes any unneeded versioned symbols from the symbol table. */
|
2000-11-08 08:24:23 +08:00
|
|
|
|
|
|
|
void
|
2003-12-13 20:57:40 +08:00
|
|
|
elf_frob_file_before_adjust (void)
|
2000-11-08 08:24:23 +08:00
|
|
|
{
|
|
|
|
if (symbol_rootP)
|
|
|
|
{
|
|
|
|
symbolS *symp;
|
|
|
|
|
|
|
|
for (symp = symbol_rootP; symp; symp = symbol_next (symp))
|
2002-01-28 21:34:39 +08:00
|
|
|
if (!S_IS_DEFINED (symp))
|
2000-11-14 05:23:34 +08:00
|
|
|
{
|
2002-01-28 21:34:39 +08:00
|
|
|
if (symbol_get_obj (symp)->versioned_name)
|
2000-11-14 05:23:34 +08: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);
|
2014-06-16 09:34:04 +08:00
|
|
|
if (p != NULL && p[1] == ELF_VER_CHR && p[2] == ELF_VER_CHR)
|
2000-11-14 05:23:34 +08:00
|
|
|
{
|
|
|
|
size_t l = strlen (&p[3]) + 1;
|
2003-12-13 20:57:40 +08:00
|
|
|
memmove (&p[1], &p[3], l);
|
2000-11-14 05:23:34 +08:00
|
|
|
}
|
|
|
|
if (symbol_used_p (symp) == 0
|
|
|
|
&& symbol_used_in_reloc_p (symp) == 0)
|
|
|
|
symbol_remove (symp, &symbol_rootP, &symbol_lastP);
|
|
|
|
}
|
2002-01-28 21:34:39 +08: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-14 05:23:34 +08:00
|
|
|
}
|
2000-11-08 08:24:23 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08: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 20:57:40 +08:00
|
|
|
elf_frob_file_after_relocs (void)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
2017-10-04 07:23:53 +08:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
/* Set SHT_GROUP section size. */
|
|
|
|
for (i = 0; i < groups.num_group; i++)
|
|
|
|
{
|
|
|
|
asection *s, *head, *group;
|
|
|
|
bfd_size_type size;
|
|
|
|
|
|
|
|
head = groups.head[i];
|
|
|
|
size = 4;
|
|
|
|
for (s = head; s != NULL; s = elf_next_in_group (s))
|
|
|
|
size += (s->flags & SEC_RELOC) != 0 ? 8 : 4;
|
|
|
|
|
|
|
|
group = elf_sec_group (head);
|
|
|
|
subseg_set (group, 0);
|
|
|
|
bfd_set_section_size (stdoutput, group, size);
|
|
|
|
group->contents = (unsigned char *) frag_more (size);
|
|
|
|
frag_now->fr_fix = frag_now_fix_octets ();
|
|
|
|
frag_wane (frag_now);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Cleanup hash. */
|
|
|
|
hash_traverse (groups.indexes, free_section_idx);
|
|
|
|
hash_die (groups.indexes);
|
|
|
|
|
1999-05-03 15:29:11 +08: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 20:57:40 +08:00
|
|
|
know (debug_swap != NULL);
|
1999-05-03 15:29:11 +08: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 20:57:40 +08:00
|
|
|
SET (external_dnr, cbDnOffset, void *);
|
|
|
|
SET (external_pdr, cbPdOffset, void *);
|
|
|
|
SET (external_sym, cbSymOffset, void *);
|
|
|
|
SET (external_opt, cbOptOffset, void *);
|
1999-05-03 15:29:11 +08:00
|
|
|
SET (external_aux, cbAuxOffset, union aux_ext *);
|
|
|
|
SET (ss, cbSsOffset, char *);
|
2003-12-13 20:57:40 +08:00
|
|
|
SET (external_fdr, cbFdOffset, void *);
|
|
|
|
SET (external_rfd, cbRfdOffset, void *);
|
1999-05-03 15:29:11 +08: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 16:39:46 +08:00
|
|
|
if (! bfd_ecoff_debug_externals (stdoutput, &debug, debug_swap, TRUE,
|
1999-05-03 15:29:11 +08:00
|
|
|
elf_get_extr, elf_set_index))
|
2001-10-07 14:16:54 +08:00
|
|
|
as_fatal (_("failed to set up debugging information: %s"),
|
1999-05-03 15:29:11 +08: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-23 01:56:02 +08:00
|
|
|
gas_assert (sec != NULL);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
know (!stdoutput->output_has_begun);
|
1999-05-03 15:29:11 +08: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 09:16:35 +08:00
|
|
|
bfd_set_section_size
|
|
|
|
(stdoutput, sec, bfd_ecoff_debug_size (stdoutput, &debug, debug_swap));
|
1999-05-03 15:29:11 +08:00
|
|
|
|
1999-11-04 06:13:33 +08:00
|
|
|
/* Pass BUF to bfd_set_section_contents because this will
|
2003-12-13 16:59:24 +08: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 20:57:40 +08:00
|
|
|
if (! bfd_set_section_contents (stdoutput, sec, buf, 0, 0))
|
2001-10-07 14:16:54 +08:00
|
|
|
as_fatal (_("can't start writing .mdebug section: %s"),
|
1999-05-03 15:29:11 +08:00
|
|
|
bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
2002-11-30 16:39:46 +08:00
|
|
|
know (stdoutput->output_has_begun);
|
1999-05-03 15:29:11 +08:00
|
|
|
know (sec->filepos != 0);
|
|
|
|
|
|
|
|
if (! bfd_ecoff_write_debug (stdoutput, &debug, debug_swap,
|
|
|
|
sec->filepos))
|
2001-10-07 14:16:54 +08:00
|
|
|
as_fatal (_("could not write .mdebug section: %s"),
|
1999-05-03 15:29:11 +08:00
|
|
|
bfd_errmsg (bfd_get_error ()));
|
|
|
|
}
|
|
|
|
#endif /* NEED_ECOFF_DEBUG */
|
|
|
|
}
|
|
|
|
|
2010-11-15 20:31:05 +08:00
|
|
|
static void
|
|
|
|
elf_generate_asm_lineno (void)
|
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (ECOFF_DEBUGGING)
|
|
|
|
ecoff_generate_asm_lineno ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-16 02:12:42 +08: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 20:31:05 +08: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-23 05:19:43 +08:00
|
|
|
static int
|
2003-12-13 20:57:40 +08: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-23 05:19:43 +08:00
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
return (!ECOFF_DEBUGGING);
|
|
|
|
#else
|
|
|
|
return 1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-13 20:57:40 +08: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-23 05:19:43 +08:00
|
|
|
{
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
if (!ECOFF_DEBUGGING)
|
|
|
|
#endif
|
|
|
|
obj_elf_init_stab_section (seg);
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
const struct format_ops elf_format_ops =
|
|
|
|
{
|
|
|
|
bfd_target_elf_flavour,
|
2000-01-27 06:48:31 +08: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-23 05:19:43 +08:00
|
|
|
elf_begin,
|
|
|
|
elf_file_symbol,
|
1999-05-03 15:29:11 +08:00
|
|
|
elf_frob_symbol,
|
|
|
|
elf_frob_file,
|
2000-11-08 08:24:23 +08:00
|
|
|
elf_frob_file_before_adjust,
|
2002-09-05 08:01:18 +08:00
|
|
|
0, /* obj_frob_file_before_fix */
|
1999-05-03 15:29:11 +08:00
|
|
|
elf_frob_file_after_relocs,
|
|
|
|
elf_s_get_size, elf_s_set_size,
|
|
|
|
elf_s_get_align, elf_s_set_align,
|
2000-01-27 06:48:31 +08: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-23 05:19:43 +08:00
|
|
|
elf_s_set_other,
|
2000-01-27 06:48:31 +08: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-23 05:19:43 +08:00
|
|
|
0, /* s_set_desc */
|
|
|
|
0, /* s_get_type */
|
|
|
|
0, /* s_set_type */
|
1999-05-03 15:29:11 +08:00
|
|
|
elf_copy_symbol_attributes,
|
2010-11-15 20:31:05 +08: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-23 05:19:43 +08:00
|
|
|
elf_separate_stab_sections,
|
|
|
|
elf_init_stab_section,
|
1999-05-03 15:29:11 +08:00
|
|
|
elf_sec_sym_ok_for_reloc,
|
|
|
|
elf_pop_insert,
|
|
|
|
#ifdef NEED_ECOFF_DEBUG
|
|
|
|
elf_ecoff_set_ext,
|
|
|
|
#else
|
2000-01-27 06:48:31 +08:00
|
|
|
0, /* ecoff_set_ext */
|
1999-05-03 15:29:11 +08:00
|
|
|
#endif
|
2000-01-27 06:48:31 +08:00
|
|
|
elf_obj_read_begin_hook,
|
2009-11-02 19:49:48 +08:00
|
|
|
elf_obj_symbol_new_hook,
|
2010-10-25 20:38:42 +08:00
|
|
|
0,
|
|
|
|
elf_adjust_symtab
|
1999-05-03 15:29:11 +08:00
|
|
|
};
|