summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2004-06-15 01:24:22 +0000
committerAlan Modra <amodra@gmail.com>2004-06-15 01:24:22 +0000
commit911d08a746f9e05c389a7a5044870cd9aae06a5d (patch)
tree0dc27207e9f40ba07e654cbf5b7833d883378519 /bfd
parent135dfb4a65d79b85be0c7d869fd131ee45203192 (diff)
downloadbinutils-gdb-911d08a746f9e05c389a7a5044870cd9aae06a5d.tar.gz
* section.c (struct sec): Remove usused flags. Reorganize a little.
(bfd_get_section_size_before_reloc): Delete. (bfd_get_section_size_after_reloc): Delete. (STD_SECTION): Update. (bfd_get_section_size_now): Delete. (bfd_set_section_contents): Don't referece reloc_done. (bfd_get_section_contents): Remove reloc_done comment. * bout.c (b_out_bfd_get_relocated_section_contents): Don't set reloc_done. * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Likewise. * ecoff.c (bfd_debug_section): Update initializer. * elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents): Ditto. * reloc.c (bfd_generic_get_relocated_section_contents): Likewise. * bfd-in.h (bfd_section_size): Expand. (bfd_get_section_size): New macro. * bfd-in2.h: Regenerate. * coff64-rs6000.c (xcoff64_write_object_contents): Replace bfd_get_section_size_before_reloc with bfd_get_section_size. * coffcode.h (coff_write_object_contents): Likewise. * coffgen.c (build_debug_section): Likewise. * dwarf1.c (parse_line_table): Likewise. (_bfd_dwarf1_find_nearest_line): Likewise. * ecoff.c (_bfd_ecoff_write_object_contents): Likewise. * i386msdos.c (msdos_write_object_contents): Likewise. * pdp11.c (squirt_out_relocs): Likewise. * elf32-sh64.c (sh64_find_section_for_address): Remove comment. * elf64-mmix.c (mmix_elf_final_link): Update comment.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog30
-rw-r--r--bfd/bfd-in.h3
-rw-r--r--bfd/bfd-in2.h28
-rw-r--r--bfd/bout.c2
-rw-r--r--bfd/coff-alpha.c1
-rw-r--r--bfd/coff64-rs6000.c6
-rw-r--r--bfd/coffcode.h6
-rw-r--r--bfd/coffgen.c4
-rw-r--r--bfd/dwarf1.c6
-rw-r--r--bfd/ecoff.c22
-rw-r--r--bfd/elf32-sh64.c2
-rw-r--r--bfd/elf64-mmix.c11
-rw-r--r--bfd/elfxx-mips.c1
-rw-r--r--bfd/i386msdos.c12
-rw-r--r--bfd/pdp11.c4
-rw-r--r--bfd/reloc.c2
-rw-r--r--bfd/section.c47
17 files changed, 88 insertions, 99 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8ef353efe30..a70d480b742 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,33 @@
+2004-06-15 Alan Modra <amodra@bigpond.net.au>
+
+ * section.c (struct sec): Remove usused flags. Reorganize a little.
+ (bfd_get_section_size_before_reloc): Delete.
+ (bfd_get_section_size_after_reloc): Delete.
+ (STD_SECTION): Update.
+ (bfd_get_section_size_now): Delete.
+ (bfd_set_section_contents): Don't referece reloc_done.
+ (bfd_get_section_contents): Remove reloc_done comment.
+ * bout.c (b_out_bfd_get_relocated_section_contents): Don't set
+ reloc_done.
+ * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Likewise.
+ * ecoff.c (bfd_debug_section): Update initializer.
+ * elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents): Ditto.
+ * reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
+ * bfd-in.h (bfd_section_size): Expand.
+ (bfd_get_section_size): New macro.
+ * bfd-in2.h: Regenerate.
+ * coff64-rs6000.c (xcoff64_write_object_contents): Replace
+ bfd_get_section_size_before_reloc with bfd_get_section_size.
+ * coffcode.h (coff_write_object_contents): Likewise.
+ * coffgen.c (build_debug_section): Likewise.
+ * dwarf1.c (parse_line_table): Likewise.
+ (_bfd_dwarf1_find_nearest_line): Likewise.
+ * ecoff.c (_bfd_ecoff_write_object_contents): Likewise.
+ * i386msdos.c (msdos_write_object_contents): Likewise.
+ * pdp11.c (squirt_out_relocs): Likewise.
+ * elf32-sh64.c (sh64_find_section_for_address): Remove comment.
+ * elf64-mmix.c (mmix_elf_final_link): Update comment.
+
2004-06-14 Chris Demetriou <cgd@broadcom.com>
* elf32-mips.c (elf_mips_gnu_pcrel32): Add (undoing 2004-04-24
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index e7ed04afa7f..cbf7e931ed2 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -308,7 +308,8 @@ typedef struct bfd_section *sec_ptr;
#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
#define bfd_section_name(bfd, ptr) ((ptr)->name)
-#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
+#define bfd_section_size(bfd, ptr) ((ptr)->_raw_size)
+#define bfd_get_section_size(ptr) ((ptr)->_raw_size)
#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index c5dd5f2c256..851fe4738ed 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -315,7 +315,8 @@ typedef struct bfd_section *sec_ptr;
#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
#define bfd_section_name(bfd, ptr) ((ptr)->name)
-#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
+#define bfd_section_size(bfd, ptr) ((ptr)->_raw_size)
+#define bfd_get_section_size(ptr) ((ptr)->_raw_size)
#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
@@ -1210,9 +1211,6 @@ typedef struct bfd_section
/* See the vma field. */
unsigned int user_set_vma : 1;
- /* Whether relocations have been processed. */
- unsigned int reloc_done : 1;
-
/* A mark flag used by some of the linker backends. */
unsigned int linker_mark : 1;
@@ -1240,21 +1238,18 @@ typedef struct bfd_section
unsigned int use_rela_p:1;
/* Bits used by various backends. */
- unsigned int has_tls_reloc:1;
- /* Nonzero if this section needs the relax finalize pass. */
- unsigned int need_finalize_relax:1;
+ /* Nonzero if this section has TLS related relocations. */
+ unsigned int has_tls_reloc:1;
/* Nonzero if this section has a gp reloc. */
unsigned int has_gp_reloc:1;
- /* Unused bits. */
- unsigned int flag13:1;
- unsigned int flag14:1;
- unsigned int flag15:1;
- unsigned int flag16:4;
- unsigned int flag20:4;
- unsigned int flag24:8;
+ /* Nonzero if this section needs the relax finalize pass. */
+ unsigned int need_finalize_relax:1;
+
+ /* Whether relocations have been processed. */
+ unsigned int reloc_done : 1;
/* End of internal packed boolean fields. */
@@ -1403,11 +1398,6 @@ extern const struct bfd_symbol * const bfd_abs_symbol;
extern const struct bfd_symbol * const bfd_com_symbol;
extern const struct bfd_symbol * const bfd_und_symbol;
extern const struct bfd_symbol * const bfd_ind_symbol;
-#define bfd_get_section_size_before_reloc(section) \
- ((section)->_raw_size)
-#define bfd_get_section_size_after_reloc(section) \
- ((section)->reloc_done ? (section)->_cooked_size \
- : (abort (), (bfd_size_type) 1))
/* Macros to handle insertion and deletion of a bfd's sections. These
only handle the list pointers, ie. do not adjust section_count,
diff --git a/bfd/bout.c b/bfd/bout.c
index 0c6c808de79..f0281923519 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -1328,8 +1328,6 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
- input_section->reloc_done = 1;
-
/* Read in the section. */
BFD_ASSERT (bfd_get_section_contents (input_bfd,
input_section,
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 3ea63330200..1f928d84b64 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -784,7 +784,6 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
/* The section size is not going to change. */
input_section->_cooked_size = input_section->_raw_size;
- input_section->reloc_done = TRUE;
reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
reloc_vector, symbols);
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 678ba9380b3..41459b5c5a6 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -965,19 +965,19 @@ xcoff64_write_object_contents (abfd)
if (text_sec)
{
- internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
+ internal_a.tsize = bfd_get_section_size (text_sec);
internal_a.text_start = internal_a.tsize ? text_sec->vma : 0;
}
if (data_sec)
{
- internal_a.dsize = bfd_get_section_size_before_reloc (data_sec);
+ internal_a.dsize = bfd_get_section_size (data_sec);
internal_a.data_start = internal_a.dsize ? data_sec->vma : 0;
}
if (bss_sec)
{
- internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec);
+ internal_a.bsize = bfd_get_section_size (bss_sec);
if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
internal_a.data_start = bss_sec->vma;
}
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index d50744695fd..d58d8b001f2 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -4132,17 +4132,17 @@ coff_write_object_contents (abfd)
if (text_sec)
{
- internal_a.tsize = bfd_get_section_size_before_reloc (text_sec);
+ internal_a.tsize = bfd_get_section_size (text_sec);
internal_a.text_start = internal_a.tsize ? text_sec->vma : 0;
}
if (data_sec)
{
- internal_a.dsize = bfd_get_section_size_before_reloc (data_sec);
+ internal_a.dsize = bfd_get_section_size (data_sec);
internal_a.data_start = internal_a.dsize ? data_sec->vma : 0;
}
if (bss_sec)
{
- internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec);
+ internal_a.bsize = bfd_get_section_size (bss_sec);
if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
internal_a.data_start = bss_sec->vma;
}
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index a712b4b36e3..acb78b3cc11 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1,6 +1,6 @@
/* Support for the generic parts of COFF, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -1537,7 +1537,7 @@ build_debug_section (abfd)
return NULL;
}
- sec_size = bfd_get_section_size_before_reloc (sect);
+ sec_size = bfd_get_section_size (sect);
debug_section = (PTR) bfd_alloc (abfd, sec_size);
if (debug_section == NULL)
return NULL;
diff --git a/bfd/dwarf1.c b/bfd/dwarf1.c
index 1047ebfc2e9..6c3f4139079 100644
--- a/bfd/dwarf1.c
+++ b/bfd/dwarf1.c
@@ -1,5 +1,5 @@
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
@@ -285,7 +285,7 @@ parse_line_table (stash, aUnit)
if (! msec)
return FALSE;
- size = bfd_get_section_size_before_reloc (msec);
+ size = bfd_get_section_size (msec);
stash->line_section = (char *) bfd_alloc (stash->abfd, size);
if (! stash->line_section)
@@ -502,7 +502,7 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
return FALSE;
}
- size = bfd_get_section_size_before_reloc (msec);
+ size = bfd_get_section_size (msec);
stash->debug_section = (char *) bfd_alloc (abfd, size);
if (! stash->debug_section)
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 5991fddb787..576045f674a 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -1,6 +1,6 @@
/* Generic ECOFF (Extended-COFF) routines.
Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003 Free Software Foundation, Inc.
+ 2002, 2003, 2004 Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -77,16 +77,14 @@ static unsigned int ecoff_armap_hash
static asection bfd_debug_section =
{
- /* name, id, index, next, flags, user_set_vma, reloc_done, */
- "*DEBUG*", 0, 0, NULL, 0, 0, 0,
+ /* name, id, index, next, flags, user_set_vma, */
+ "*DEBUG*", 0, 0, NULL, 0, 0,
/* linker_mark, linker_has_input, gc_mark, segment_mark, */
0, 0, 0, 0,
- /* sec_info_type, use_rela_p, has_tls_reloc, */
- 0, 0, 0,
- /* need_finalize_relax, has_gp_reloc, */
+ /* sec_info_type, use_rela_p, has_tls_reloc, has_gp_reloc, */
+ 0, 0, 0, 0,
+ /* need_finalize_relax, reloc_done, */
0, 0,
- /* flag13, flag14, flag15, flag16, flag20, flag24, */
- 0, 0, 0, 0, 0, 0,
/* vma, lma, _cooked_size, _raw_size, */
0, 0, 0, 0,
/* output_offset, output_section, alignment_power, */
@@ -2550,7 +2548,7 @@ _bfd_ecoff_write_object_contents (abfd)
section.s_vaddr = vma;
section.s_paddr = current->lma;
- section.s_size = bfd_get_section_size_before_reloc (current);
+ section.s_size = bfd_get_section_size (current);
/* If this section is unloadable then the scnptr will be 0. */
if ((current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
@@ -2601,7 +2599,7 @@ _bfd_ecoff_write_object_contents (abfd)
|| (section.s_flags & STYP_ECOFF_FINI) != 0
|| section.s_flags == STYP_RCONST)
{
- text_size += bfd_get_section_size_before_reloc (current);
+ text_size += bfd_get_section_size (current);
if (! set_text_start || text_start > vma)
{
text_start = vma;
@@ -2617,7 +2615,7 @@ _bfd_ecoff_write_object_contents (abfd)
|| section.s_flags == STYP_XDATA
|| (section.s_flags & STYP_GOT) != 0)
{
- data_size += bfd_get_section_size_before_reloc (current);
+ data_size += bfd_get_section_size (current);
if (! set_data_start || data_start > vma)
{
data_start = vma;
@@ -2626,7 +2624,7 @@ _bfd_ecoff_write_object_contents (abfd)
}
else if ((section.s_flags & STYP_BSS) != 0
|| (section.s_flags & STYP_SBSS) != 0)
- bss_size += bfd_get_section_size_before_reloc (current);
+ bss_size += bfd_get_section_size (current);
else if (section.s_flags == 0
|| (section.s_flags & STYP_ECOFF_LIB) != 0
|| section.s_flags == STYP_COMMENT)
diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c
index 62cf2e61a8d..8d7bd14e810 100644
--- a/bfd/elf32-sh64.c
+++ b/bfd/elf32-sh64.c
@@ -620,8 +620,6 @@ sh64_find_section_for_address (bfd *abfd ATTRIBUTE_UNUSED,
if (fsec_datap->addr < vma)
return;
- /* FIXME: section->reloc_done isn't set properly; a generic buglet
- preventing us from using bfd_get_section_size_after_reloc. */
size
= section->_cooked_size ? section->_cooked_size : section->_raw_size;
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 4b78681faec..bb3ac17d94e 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -2296,12 +2296,11 @@ mmix_elf_final_link (abfd, info)
/* We need to include the maximum size of PUSHJ-stubs in the initial
section size. This is expected to shrink during linker relaxation.
- You might think that we should set *only* _cooked_size, but that won't
- work: section contents allocation will be using _raw_size in mixed
- format linking and not enough storage will be allocated. FIXME: That's
- a major bug, including the name bfd_get_section_size_before_reloc; it
- should be bfd_get_section_size_before_relax. The relaxation functions
- set _cooked size. Relaxation happens before relocation. All functions
+ You might think that we should set *only* _cooked_size, but that
+ won't work: section contents allocation will be using _raw_size in
+ mixed format linking and not enough storage will be allocated.
+ FIXME: That's a major bug. The relaxation functions set _cooked
+ size. Relaxation happens before relocation. All functions
*after relaxation* should be using _cooked size. */
static void
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index cbacd4e24c4..cd43f8b555f 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -7919,7 +7919,6 @@ _bfd_elf_mips_get_relocated_section_contents
/* We're not relaxing the section, so just copy the size info */
input_section->_cooked_size = input_section->_raw_size;
- input_section->reloc_done = TRUE;
reloc_count = bfd_canonicalize_reloc (input_bfd,
input_section,
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index 2dbd8df4db8..cd41d0b049f 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -83,20 +83,20 @@ msdos_write_object_contents (abfd)
/* Find the total size of the program on disk and in memory. */
for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next)
{
- if (bfd_get_section_size_before_reloc (sec) == 0)
+ if (bfd_get_section_size (sec) == 0)
continue;
if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
{
- bfd_vma sec_vma = bfd_get_section_vma (abfd, sec)
- + bfd_get_section_size_before_reloc (sec);
+ bfd_vma sec_vma = (bfd_get_section_vma (abfd, sec)
+ + bfd_get_section_size (sec));
if (sec_vma > high_vma)
high_vma = sec_vma;
}
if (bfd_get_section_flags (abfd, sec) & SEC_LOAD)
{
- file_ptr sec_end = sizeof(hdr)
- + bfd_get_section_vma (abfd, sec)
- + bfd_get_section_size_before_reloc (sec);
+ file_ptr sec_end = (sizeof (hdr)
+ + bfd_get_section_vma (abfd, sec)
+ + bfd_get_section_size (sec));
if (sec_end > outfile_size)
outfile_size = sec_end;
}
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index 95d2ccd30be..db5b267270c 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -1,5 +1,5 @@
/* BFD back-end for PDP-11 a.out binaries.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -2314,7 +2314,7 @@ NAME(aout,squirt_out_relocs) (abfd, section)
return TRUE;
#endif
- natsize = bfd_get_section_size_before_reloc (section);
+ natsize = bfd_get_section_size (section);
native = (unsigned char *) bfd_zalloc (abfd, natsize);
if (!native)
return FALSE;
diff --git a/bfd/reloc.c b/bfd/reloc.c
index bc8d13bd7ed..8300915b141 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -4292,8 +4292,6 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
this function is called. We do not want to clobber the _cooked_size
they computed. */
- input_section->reloc_done = TRUE;
-
reloc_count = bfd_canonicalize_reloc (input_bfd,
input_section,
reloc_vector,
diff --git a/bfd/section.c b/bfd/section.c
index 7f5365b9dbb..666f06d4f8c 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -364,9 +364,6 @@ CODE_FRAGMENT
. {* See the vma field. *}
. unsigned int user_set_vma : 1;
.
-. {* Whether relocations have been processed. *}
-. unsigned int reloc_done : 1;
-.
. {* A mark flag used by some of the linker backends. *}
. unsigned int linker_mark : 1;
.
@@ -394,21 +391,18 @@ CODE_FRAGMENT
. unsigned int use_rela_p:1;
.
. {* Bits used by various backends. *}
-. unsigned int has_tls_reloc:1;
.
-. {* Nonzero if this section needs the relax finalize pass. *}
-. unsigned int need_finalize_relax:1;
+. {* Nonzero if this section has TLS related relocations. *}
+. unsigned int has_tls_reloc:1;
.
. {* Nonzero if this section has a gp reloc. *}
. unsigned int has_gp_reloc:1;
.
-. {* Unused bits. *}
-. unsigned int flag13:1;
-. unsigned int flag14:1;
-. unsigned int flag15:1;
-. unsigned int flag16:4;
-. unsigned int flag20:4;
-. unsigned int flag24:8;
+. {* Nonzero if this section needs the relax finalize pass. *}
+. unsigned int need_finalize_relax:1;
+.
+. {* Whether relocations have been processed. *}
+. unsigned int reloc_done : 1;
.
. {* End of internal packed boolean fields. *}
.
@@ -557,11 +551,6 @@ CODE_FRAGMENT
.extern const struct bfd_symbol * const bfd_com_symbol;
.extern const struct bfd_symbol * const bfd_und_symbol;
.extern const struct bfd_symbol * const bfd_ind_symbol;
-.#define bfd_get_section_size_before_reloc(section) \
-. ((section)->_raw_size)
-.#define bfd_get_section_size_after_reloc(section) \
-. ((section)->reloc_done ? (section)->_cooked_size \
-. : (abort (), (bfd_size_type) 1))
.
.{* Macros to handle insertion and deletion of a bfd's sections. These
. only handle the list pointers, ie. do not adjust section_count,
@@ -616,21 +605,18 @@ static const asymbol global_syms[] =
#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
asection SEC = \
- /* name, id, index, next, flags, user_set_vma, reloc_done, */ \
- { NAME, IDX, 0, NULL, FLAGS, 0, 0, \
+ /* name, id, index, next, flags, user_set_vma, */ \
+ { NAME, IDX, 0, NULL, FLAGS, 0, \
\
/* linker_mark, linker_has_input, gc_mark, segment_mark, */ \
0, 0, 1, 0, \
\
- /* sec_info_type, use_rela_p, has_tls_reloc, */ \
- 0, 0, 0, \
+ /* sec_info_type, use_rela_p, has_tls_reloc, has_gp_reloc, */ \
+ 0, 0, 0, 0, \
\
- /* need_finalize_relax, has_gp_reloc, */ \
+ /* need_finalize_relax, reloc_done, */ \
0, 0, \
\
- /* flag13, flag14, flag15, flag16, flag20, flag24, */ \
- 0, 0, 0, 0, 0, 0, \
- \
/* vma, lma, _cooked_size, _raw_size, */ \
0, 0, 0, 0, \
\
@@ -1243,11 +1229,6 @@ DESCRIPTION
*/
-#define bfd_get_section_size_now(abfd, sec) \
- (sec->reloc_done \
- ? bfd_get_section_size_after_reloc (sec) \
- : bfd_get_section_size_before_reloc (sec))
-
bfd_boolean
bfd_set_section_contents (bfd *abfd,
sec_ptr section,
@@ -1263,7 +1244,7 @@ bfd_set_section_contents (bfd *abfd,
return FALSE;
}
- sz = bfd_get_section_size_now (abfd, section);
+ sz = section->_cooked_size != 0 ? section->_cooked_size : section->_raw_size;
if ((bfd_size_type) offset > sz
|| count > sz
|| offset + count > sz
@@ -1343,8 +1324,6 @@ bfd_get_section_contents (bfd *abfd,
return TRUE;
}
- /* Even if reloc_done is TRUE, this function reads unrelocated
- contents, so we want the raw size. */
sz = section->_raw_size;
if ((bfd_size_type) offset > sz
|| count > sz