/* Object file "section" support for the BFD library.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
- 2012
- Free Software Foundation, Inc.
+ Copyright (C) 1990-2015 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
.#define SEC_INFO_TYPE_MERGE 2
.#define SEC_INFO_TYPE_EH_FRAME 3
.#define SEC_INFO_TYPE_JUST_SYMS 4
+.#define SEC_INFO_TYPE_TARGET 5
.
. {* Nonzero if this section uses RELA relocations, rather than REL. *}
. unsigned int use_rela_p:1;
.} asection;
.
.{* Relax table contains information about instructions which can
-. be removed by relaxation -- replacing a long address with a
+. be removed by relaxation -- replacing a long address with a
. short address. *}
.struct relax_table {
. {* Address where bytes may be deleted. *}
. bfd_vma addr;
-.
+.
. {* Number of bytes to be deleted. *}
. int size;
.};
.
+.{* Note: the following are provided as inline functions rather than macros
+. because not all callers use the return value. A macro implementation
+. would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
+. compilers will complain about comma expressions that have no effect. *}
+.static inline bfd_boolean
+.bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
+.{
+. ptr->userdata = val;
+. return TRUE;
+.}
+.
+.static inline bfd_boolean
+.bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
+.{
+. ptr->vma = ptr->lma = val;
+. ptr->user_set_vma = TRUE;
+. return TRUE;
+.}
+.
+.static inline bfd_boolean
+.bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
+.{
+. ptr->alignment_power = val;
+. return TRUE;
+.}
+.
.{* These sections are global, and are managed by BFD. The application
. and target back end are not permitted to change the values in
. these sections. *}
-.extern asection std_section[4];
+.extern asection _bfd_std_section[4];
.
.#define BFD_ABS_SECTION_NAME "*ABS*"
.#define BFD_UND_SECTION_NAME "*UND*"
.#define BFD_IND_SECTION_NAME "*IND*"
.
.{* Pointer to the common section. *}
-.#define bfd_com_section_ptr (&std_section[0])
+.#define bfd_com_section_ptr (&_bfd_std_section[0])
.{* Pointer to the undefined section. *}
-.#define bfd_und_section_ptr (&std_section[1])
+.#define bfd_und_section_ptr (&_bfd_std_section[1])
.{* Pointer to the absolute section. *}
-.#define bfd_abs_section_ptr (&std_section[2])
+.#define bfd_abs_section_ptr (&_bfd_std_section[2])
.{* Pointer to the indirect section. *}
-.#define bfd_ind_section_ptr (&std_section[3])
+.#define bfd_ind_section_ptr (&_bfd_std_section[3])
.
.#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
.#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
};
#define STD_SECTION(NAME, IDX, FLAGS) \
- BFD_FAKE_SECTION(std_section[IDX], FLAGS, &global_syms[IDX], NAME, IDX)
+ BFD_FAKE_SECTION(_bfd_std_section[IDX], FLAGS, &global_syms[IDX], NAME, IDX)
-asection std_section[] = {
+asection _bfd_std_section[] = {
STD_SECTION (BFD_COM_SECTION_NAME, 0, SEC_IS_COMMON),
STD_SECTION (BFD_UND_SECTION_NAME, 1, 0),
STD_SECTION (BFD_ABS_SECTION_NAME, 2, 0),
abfd->section_count = 0;
memset (abfd->section_htab.table, 0,
abfd->section_htab.size * sizeof (struct bfd_hash_entry *));
+ abfd->section_htab.count = 0;
}
/*
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
}
-
+
memmove (location, section->contents + offset, (size_t) count);
return TRUE;
}