This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Get rid of more bfd bloat
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Stephen Clarke <stephen dot clarke at earthling dot net>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 17 Oct 2002 12:26:29 +0930
- Subject: Re: Get rid of more bfd bloat
- References: <004401c2757e$a3944ed0$6301a8c0@wren>
On Wed, Oct 16, 2002 at 06:43:48PM -0700, Stephen Clarke wrote:
> It looks rather like the ifndef USE_REL etc. in elfxx-target.h
> doesn't do the right thing if you include that file more than once.
Huh!
bfd/ChangeLog
* elfxx-target.h (USE_REL): Don't define as 1.
* elf32-arm.h (USE_REL): Provide a default define of 0.
Use #if rather than #ifdef when testing USE_REL.
* elf32-m32r.c: Likewise.
* elf32-arc.c (USE_REL): Define as 1.
* elf32-d10v.c (USE_REL): Likewise.
* elf32-m32r.c (USE_REL): Likewise.
* elf32-m68hc11.c (USE_REL): Likewise.
* elf32-m68hc12.c (USE_REL): Likewise.
* elf32-or32.c (USE_REL): Likewise.
* elfarm-nabi.c (USE_REL): Likewise.
Index: bfd/elf32-arc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arc.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf32-arc.c
--- bfd/elf32-arc.c 3 Jun 2002 01:57:09 -0000 1.11
+++ bfd/elf32-arc.c 17 Oct 2002 02:43:09 -0000
@@ -39,7 +39,7 @@ static bfd_reloc_status_type arc_elf_b22
/* Try to minimize the amount of space occupied by relocation tables
on the ROM (not that the ROM won't be swamped by other ELF overhead). */
-#define USE_REL
+#define USE_REL 1
static reloc_howto_type elf_arc_howto_table[] =
{
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.95
diff -u -p -r1.95 elf32-arm.h
--- bfd/elf32-arm.h 16 Oct 2002 08:39:37 -0000 1.95
+++ bfd/elf32-arm.h 17 Oct 2002 02:43:12 -0000
@@ -17,6 +17,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+#ifndef USE_REL
+#define USE_REL 0
+#endif
+
typedef unsigned long int insn32;
typedef unsigned short int insn16;
@@ -76,7 +80,7 @@ static boolean elf32_arm_finish_dynamic_
PARAMS ((bfd *, struct bfd_link_info *));
static struct bfd_hash_entry * elf32_arm_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-#ifdef USE_REL
+#if USE_REL
static void arm_add_to_rel
PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma));
#endif
@@ -1094,7 +1098,7 @@ elf32_arm_final_link_relocate (howto, in
local_got_offsets = elf_local_got_offsets (input_bfd);
r_symndx = ELF32_R_SYM (rel->r_info);
-#ifdef USE_REL
+#if USE_REL
addend = bfd_get_32 (input_bfd, hit_data) & howto->src_mask;
if (addend & ((howto->src_mask + 1) >> 1))
@@ -1370,7 +1374,7 @@ elf32_arm_final_link_relocate (howto, in
case R_ARM_THM_ABS5:
/* Support ldr and str instructions for the thumb. */
-#ifdef USE_REL
+#if USE_REL
/* Need to refetch addend. */
addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask;
/* ??? Need to determine shift amount from operand size. */
@@ -1402,7 +1406,7 @@ elf32_arm_final_link_relocate (howto, in
bfd_vma check;
bfd_signed_vma signed_check;
-#ifdef USE_REL
+#if USE_REL
/* Need to refetch the addend and squish the two 11 bit pieces
together. */
{
@@ -1507,7 +1511,7 @@ elf32_arm_final_link_relocate (howto, in
bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
bfd_signed_vma signed_check;
-#ifdef USE_REL
+#if USE_REL
/* Need to refetch addend. */
addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask;
if (addend & ((howto->src_mask + 1) >> 1))
@@ -1745,7 +1749,7 @@ elf32_arm_final_link_relocate (howto, in
}
}
-#ifdef USE_REL
+#if USE_REL
/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */
static void
arm_add_to_rel (abfd, address, howto, increment)
@@ -1837,7 +1841,7 @@ elf32_arm_relocate_section (output_bfd,
Elf_Internal_Rela * relend;
const char * name;
-#ifndef USE_REL
+#if !USE_REL
if (info->relocateable)
return true;
#endif
@@ -1866,7 +1870,7 @@ elf32_arm_relocate_section (output_bfd,
|| r_type == R_ARM_GNU_VTINHERIT)
continue;
-#ifdef USE_REL
+#if USE_REL
elf32_arm_info_to_howto (input_bfd, & bfd_reloc,
(Elf_Internal_Rel *) rel);
#else
@@ -1874,7 +1878,7 @@ elf32_arm_relocate_section (output_bfd,
#endif
howto = bfd_reloc.howto;
-#ifdef USE_REL
+#if USE_REL
if (info->relocateable)
{
/* This is a relocateable link. We don't have to change
@@ -1907,7 +1911,7 @@ elf32_arm_relocate_section (output_bfd,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
-#ifdef USE_REL
+#if USE_REL
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
@@ -3676,7 +3680,7 @@ elf32_arm_reloc_type_class (rela)
#define elf_backend_plt_readonly 1
#define elf_backend_want_got_plt 1
#define elf_backend_want_plt_sym 0
-#ifndef USE_REL
+#if !USE_REL
#define elf_backend_rela_normal 1
#endif
Index: bfd/elf32-d10v.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-d10v.c,v
retrieving revision 1.16
diff -u -p -r1.16 elf32-d10v.c
--- bfd/elf32-d10v.c 1 Jul 2002 08:06:43 -0000 1.16
+++ bfd/elf32-d10v.c 17 Oct 2002 02:43:12 -0000
@@ -43,7 +43,7 @@ static boolean elf32_d10v_relocate_secti
asection **));
/* Use REL instead of RELA to save space. */
-#define USE_REL
+#define USE_REL 1
static reloc_howto_type elf_d10v_howto_table[] =
{
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.27
diff -u -p -r1.27 elf32-m32r.c
--- bfd/elf32-m32r.c 11 Oct 2002 08:33:11 -0000 1.27
+++ bfd/elf32-m32r.c 17 Oct 2002 02:43:13 -0000
@@ -88,7 +88,11 @@ asection * m32r_elf_gc_mark_hook
This only saves space in libraries and object files, but perhaps
relocs will be put in ROM? All in all though, REL relocs are a pain
to work with. */
-#define USE_REL
+#define USE_REL 1
+
+#ifndef USE_REL
+#define USE_REL 0
+#endif
static reloc_howto_type m32r_elf_howto_table[] =
{
@@ -982,7 +986,7 @@ m32r_elf_relocate_section (output_bfd, i
/* Assume success. */
boolean ret = true;
-#ifndef USE_REL
+#if !USE_REL
if (info->relocateable)
return true;
#endif
@@ -1026,7 +1030,7 @@ m32r_elf_relocate_section (output_bfd, i
howto = m32r_elf_howto_table + r_type;
r_symndx = ELF32_R_SYM (rel->r_info);
-#ifdef USE_REL
+#if USE_REL
if (info->relocateable)
{
/* This is a relocateable link. We don't have to change
@@ -1102,7 +1106,7 @@ m32r_elf_relocate_section (output_bfd, i
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
sym_name = "<local symbol>";
-#ifndef USE_REL
+#if !USE_REL
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
addend = rel->r_addend;
#else
@@ -1507,7 +1511,7 @@ m32r_elf_relax_section (abfd, sec, link_
will be at least 4 bytes closer if we can relax. It'll actually
be 4 or 8 bytes closer, but we don't know which just yet and
the difference isn't significant enough to worry about. */
-#ifndef USE_REL /* put in for learning purposes */
+#if !USE_REL /* put in for learning purposes */
pcrel_value += irel->r_addend;
#else
addend = bfd_get_signed_16 (abfd, contents + irel->r_offset + 2);
@@ -1536,7 +1540,7 @@ m32r_elf_relax_section (abfd, sec, link_
We OR in CODE just in case it's not a nop (technically,
CODE currently must be a nop, but for cleanness we
allow it to be anything). */
-#ifndef USE_REL /* put in for learning purposes */
+#if !USE_REL /* put in for learning purposes */
code = 0x7e000000 | MAKE_PARALLEL (code);
#else
code = (0x7e000000 + (((addend >> 2) & 0xff) << 16)) | MAKE_PARALLEL (code);
@@ -1546,7 +1550,7 @@ m32r_elf_relax_section (abfd, sec, link_
else
{
/* Change the seth rN,foo to a bl24 foo. */
-#ifndef USE_REL /* put in for learning purposes */
+#if !USE_REL /* put in for learning purposes */
code = 0xfe000000;
#else
code = 0xfe000000 + ((addend >> 2) & 0xffffff);
@@ -2107,7 +2111,7 @@ m32r_elf_check_relocs (abfd, info, sec,
#define elf_backend_check_relocs m32r_elf_check_relocs
#define elf_backend_can_gc_sections 1
-#ifndef USE_REL
+#if !USE_REL
#define elf_backend_rela_normal 1
#endif
#if 0 /* not yet */
Index: bfd/elf32-m68hc11.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc11.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf32-m68hc11.c
--- bfd/elf32-m68hc11.c 12 Oct 2002 14:00:55 -0000 1.11
+++ bfd/elf32-m68hc11.c 17 Oct 2002 02:43:15 -0000
@@ -62,7 +62,7 @@ boolean _bfd_m68hc11_elf_set_private_fla
boolean _bfd_m68hc11_elf_print_private_bfd_data PARAMS ((bfd *, PTR));
/* Use REL instead of RELA to save space */
-#define USE_REL
+#define USE_REL 1
/* The Motorola 68HC11 microcontroler only addresses 64Kb.
We must handle 8 and 16-bit relocations. The 32-bit relocation
Index: bfd/elf32-m68hc12.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc12.c,v
retrieving revision 1.8
diff -u -p -r1.8 elf32-m68hc12.c
--- bfd/elf32-m68hc12.c 22 Aug 2002 05:41:53 -0000 1.8
+++ bfd/elf32-m68hc12.c 17 Oct 2002 02:43:16 -0000
@@ -54,7 +54,7 @@ boolean _bfd_m68hc12_elf_print_private_b
/* Use REL instead of RELA to save space */
-#define USE_REL
+#define USE_REL 1
/* The Motorola 68HC11 microcontroler only addresses 64Kb.
We must handle 8 and 16-bit relocations. The 32-bit relocation
Index: bfd/elf32-or32.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-or32.c,v
retrieving revision 1.2
diff -u -p -r1.2 elf32-or32.c
--- bfd/elf32-or32.c 3 Jun 2002 01:57:09 -0000 1.2
+++ bfd/elf32-or32.c 17 Oct 2002 02:50:06 -0000
@@ -38,7 +38,7 @@ static bfd_reloc_status_type or32_elf_j
/* Try to minimize the amount of space occupied by relocation tables
on the ROM (not that the ROM won't be swamped by other ELF overhead). */
-#define USE_REL
+#define USE_REL 1
static reloc_howto_type elf_or32_howto_table[] =
{
Index: bfd/elfarm-nabi.c
===================================================================
RCS file: /cvs/src/src/bfd/elfarm-nabi.c,v
retrieving revision 1.13
diff -u -p -r1.13 elfarm-nabi.c
--- bfd/elfarm-nabi.c 16 Oct 2002 08:39:37 -0000 1.13
+++ bfd/elfarm-nabi.c 17 Oct 2002 02:43:16 -0000
@@ -27,7 +27,7 @@
#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
#endif
-#define USE_REL
+#define USE_REL 1
#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec
#define TARGET_LITTLE_NAME "elf32-littlearm"
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.45
diff -u -p -r1.45 elfxx-target.h
--- bfd/elfxx-target.h 23 Jul 2002 11:15:06 -0000 1.45
+++ bfd/elfxx-target.h 17 Oct 2002 02:43:16 -0000
@@ -407,9 +407,6 @@
For backwards compatibility, we still support this usage. */
#ifndef USE_REL
#define USE_REL 0
-#else
-#undef USE_REL
-#define USE_REL 1
#endif
/* Use these in new code. */
--
Alan Modra
IBM OzLabs - Linux Technology Centre