This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

powerpc64-linux infrastructure 1 of 6


This is the first of a number of infrastructure changes needed to
support powerpc64-linux.  Makes it possible to omit
_GLOBAL_OFFSET_TABLE_ if the backend doesn't need the symbol.

bfd/ChangeLog
	1999-10-19  Linus Nordberg  <linus@swox.se>
	* elf-bfd.h (struct elf_backend_data): Add want_got_sym.
	* elfxx-target.h (elf_backend_want_got_sym): Define.
	(elfNN_bed): Add elf_backend_want_got_sym.
	* elflink.c (_bfd_elf_create_got_section): Define
	_GLOBAL_OFFSET_TABLE_ only if bed->want_got_sym.

Applying to mainline.

-- 
Alan Modra

Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.37
diff -u -p -r1.37 elf-bfd.h
--- elf-bfd.h	2001/06/30 04:05:12	1.37
+++ elf-bfd.h	2001/08/08 05:16:33
@@ -694,6 +694,7 @@ struct elf_backend_data
   unsigned plt_not_loaded : 1;
   unsigned plt_alignment : 4;
   unsigned can_gc_sections : 1;
+  unsigned want_got_sym : 1;
   unsigned want_dynbss : 1;
 };
 
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.18
diff -u -p -r1.18 elflink.c
--- elflink.c	2001/05/07 09:15:26	1.18
+++ elflink.c	2001/08/08 05:16:33
@@ -73,24 +73,27 @@ _bfd_elf_create_got_section (abfd, info)
 	return false;
     }
 
-  /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
-     (or .got.plt) section.  We don't do this in the linker script
-     because we don't want to define the symbol if we are not creating
-     a global offset table.  */
-  h = NULL;
-  if (!(_bfd_generic_link_add_one_symbol
-	(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
-	 bed->got_symbol_offset, (const char *) NULL, false,
-	 bed->collect, (struct bfd_link_hash_entry **) &h)))
-    return false;
-  h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
-  h->type = STT_OBJECT;
+  if (bed->want_got_sym)
+    {
+      /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
+	 (or .got.plt) section.  We don't do this in the linker script
+	 because we don't want to define the symbol if we are not creating
+	 a global offset table.  */
+      h = NULL;
+      if (!(_bfd_generic_link_add_one_symbol
+	    (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
+	     bed->got_symbol_offset, (const char *) NULL, false,
+	     bed->collect, (struct bfd_link_hash_entry **) &h)))
+	return false;
+      h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+      h->type = STT_OBJECT;
 
-  if (info->shared
-      && ! _bfd_elf_link_record_dynamic_symbol (info, h))
-    return false;
+      if (info->shared
+	  && ! _bfd_elf_link_record_dynamic_symbol (info, h))
+	return false;
 
-  elf_hash_table (info)->hgot = h;
+      elf_hash_table (info)->hgot = h;
+    }
 
   /* The first bit of the global offset table is the header.  */
   s->_raw_size += bed->got_header_size + bed->got_symbol_offset;
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.23
diff -u -p -r1.23 elfxx-target.h
--- elfxx-target.h	2001/06/30 03:15:46	1.23
+++ elfxx-target.h	2001/08/08 05:16:38
@@ -101,6 +101,9 @@ Foundation, Inc., 59 Temple Place - Suit
 #ifndef elf_backend_can_gc_sections
 #define elf_backend_can_gc_sections 0
 #endif
+#ifndef elf_backend_want_got_sym
+#define elf_backend_want_got_sym 1
+#endif
 #ifndef elf_backend_gc_mark_hook
 #define elf_backend_gc_mark_hook	NULL
 #endif
@@ -439,7 +442,8 @@ static CONST struct elf_backend_data elf
   elf_backend_plt_not_loaded,
   elf_backend_plt_alignment,
   elf_backend_can_gc_sections,
-  elf_backend_want_dynbss
+  elf_backend_want_dynbss,
+  elf_backend_want_got_sym
 };
 #endif
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]