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]
Other format: [Raw text]

Re: 2.12 branch will be cut on Saturday


On Sat, Feb 09, 2002 at 06:21:45PM -0500, Daniel Jacobowitz wrote:
> 
> From this point on, if you have a patch that you believe should go on
> the branch please say so.

Here's one.  The PowerPC64 ABI says e_entry points to a function
descriptor, not the function code.  If _start is missing, then
pointing at the start of .text results in interesting effects.
Committing to mainline.

ld/ChangeLog
	* ldlang.c (entry_section): New initialised variable.
	(lang_finish): Use it.
	* ldlang.h (entry_section): Declare.
	* emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Set
	entry_section to ".opd".

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: ld/emultempl/ppc64elf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/ppc64elf.em,v
retrieving revision 1.2
diff -u -p -r1.2 ppc64elf.em
--- ppc64elf.em	2002/02/05 07:07:21	1.2
+++ ppc64elf.em	2002/02/10 08:00:29
@@ -47,6 +47,11 @@ gld${EMULATION_NAME}_after_allocation ()
 static void
 gld${EMULATION_NAME}_finish ()
 {
+  /* e_entry on PowerPC64 points to the function descriptor for
+     _start.  If _start is missing, default to the first function
+     descriptor in the .opd section.  */
+  entry_section = ".opd";
+
   /* If generating a relocatable output file, then we don't have any
      stubs.  */
   if (link_info.relocateable)
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.71
diff -u -p -r1.71 ldlang.c
--- ldlang.c	2002/02/05 06:52:15	1.71
+++ ldlang.c	2002/02/10 08:00:28
@@ -178,6 +178,7 @@ lang_statement_list_type lang_output_sec
 lang_statement_list_type *stat_ptr = &statement_list;
 lang_statement_list_type file_chain = { NULL, NULL };
 const char *entry_symbol = NULL;
+const char *entry_section = ".text";
 boolean entry_from_cmdline;
 boolean lang_has_input_file = false;
 boolean had_output_filename = false;
@@ -3465,7 +3466,7 @@ lang_finish ()
 
 	  /* Can't find the entry symbol, and it's not a number.  Use
 	     the first address in the text section.  */
-	  ts = bfd_get_section_by_name (output_bfd, ".text");
+	  ts = bfd_get_section_by_name (output_bfd, entry_section);
 	  if (ts != (asection *) NULL)
 	    {
 	      if (warn)
Index: ld/ldlang.h
===================================================================
RCS file: /cvs/src/src/ld/ldlang.h,v
retrieving revision 1.15
diff -u -p -r1.15 ldlang.h
--- ldlang.h	2002/02/05 06:52:16	1.15
+++ ldlang.h	2002/02/10 08:00:28
@@ -356,6 +356,7 @@ extern lang_statement_list_type *stat_pt
 extern boolean delete_output_file_on_failure;
 
 extern const char *entry_symbol;
+extern const char *entry_section;
 extern boolean entry_from_cmdline;
 extern lang_statement_list_type file_chain;
 


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