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]

Re: DT_TEXTREL


Here's one way to fix the problem.  If no one can think of anything
better, I'll commit it tomorrow.

bfd/ChangeLog
	* section.c (asection): Add linker_has_input field.
	(STD_SECTION): Adjust initialization to suit.
	* ecoff.c (bfd_debug_section): Likewise.
	* bfd-in2.h: Regenerate.

ld/ChangeLog
	* ldlang.c (wild_doit): Use linker_has_input to reliably determine
	whether an input section is the first one assigned to an output
	section.
	Assorted formatting fixes.

-- 
Alan Modra

Index: bfd/section.c
===================================================================
RCS file: /cvs/src/src/bfd/section.c,v
retrieving revision 1.31
diff -u -p -r1.31 section.c
--- section.c	2001/04/14 14:23:31	1.31
+++ section.c	2001/05/16 11:59:41
@@ -372,6 +372,10 @@ CODE_FRAGMENT
 .  {* A mark flag used by some of the linker backends.  *}
 .  unsigned int linker_mark : 1;
 .
+.  {* Anpther mark flag used by some of the linker backends.  Set for
+.     output sections that have a input section.  *}
+.  unsigned int linker_has_input : 1;
+.
 .  {* A mark flag used by some linker backends for garbage collection.  *}
 .  unsigned int gc_mark : 1;
 .
@@ -577,12 +581,15 @@ static const asymbol global_syms[] =
   const asection SEC = 							\
     /* name, id,  index, next, flags, user_set_vma, reloc_done,      */	\
     { NAME,  IDX, 0,     NULL, FLAGS, 0,            0,			\
+									\
+    /* linker_mark, linker_has_input, gc_mark, segment_mark,         */	\
+       0,           0,                1,       0,			\
 									\
-    /* linker_mark, gc_mark, segment_mark, vma, lma, _cooked_size,   */	\
-       0,           1,       0,            0,   0,   0,            	\
+    /* vma, lma, _cooked_size, _raw_size,                            */	\
+       0,   0,   0,            0,					\
 									\
-    /* _raw_size, output_offset, output_section,    alignment_power, */ \
-       0,         0,           (struct sec *) &SEC, 0,			\
+    /* output_offset, output_section,      alignment_power,          */	\
+       0,             (struct sec *) &SEC, 0,				\
 									\
     /* relocation, orelocation, reloc_count, filepos, rel_filepos,   */	\
        NULL,       NULL,        0,           0,       0,		\
Index: bfd/ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.8
diff -u -p -r1.8 ecoff.c
--- ecoff.c	2001/05/07 09:15:25	1.8
+++ ecoff.c	2001/05/16 11:59:55
@@ -74,12 +74,14 @@ static unsigned int ecoff_armap_hash PAR
 
 static asection bfd_debug_section =
 {
-  /* name,   id,  index, next, flags, user_set_vma, reloc_done,    */ 
-  "*DEBUG*", 0,   0,     NULL, 0,     0,            0,        
-  /* linker_mark, gc_mark, segment_mark, vma, lma, _cooked_size,   */ 
-     0,           0,       0,            0,   0,   0,
-  /* _raw_size, output_offset, output_section, alignment_power,    */
-     0,         0,             NULL,           0,
+  /* name,   id,  index, next, flags, user_set_vma, reloc_done,    */
+  "*DEBUG*", 0,   0,     NULL, 0,     0,            0,
+  /* linker_mark, linker_has_input, gc_mark, segment_mark,         */
+     0,           0,                0,       0,
+  /* vma, lma, _cooked_size, _raw_size,                            */ 
+     0,   0,   0,            0,
+  /* output_offset, output_section, alignment_power,               */
+     0,             NULL,           0,
   /* relocation, orelocation, reloc_count, filepos, rel_filepos,   */
      NULL,       NULL,        0,           0,       0,
   /* line_filepos, userdata, contents, lineno, lineno_count,       */
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.46
diff -u -p -r1.46 ldlang.c
--- ldlang.c	2001/05/11 12:23:48	1.46
+++ ldlang.c	2001/05/16 12:00:31
@@ -1136,12 +1136,10 @@ wild_doit (ptr, section, output, file)
       flagword flags;
 
       if (output->bfd_section == NULL)
-	{
-	  init_os (output);
-	  first = true;
-	}
-      else
-	first = false;
+	init_os (output);
+
+      first = output->bfd_section->linker_has_input == 0;
+      output->bfd_section->linker_has_input = 1;
 
       /* Add a section reference to the list.  */
       new = new_stat (lang_input_section, ptr);
@@ -1924,7 +1922,7 @@ open_input_bfds (s, force)
 				       bfd_archive))
 		s->input_statement.loaded = false;
 
-	      lang_list_init (& add);
+	      lang_list_init (&add);
 
 	      /* We need to know if an error occurs whilst loading the 
 		 symbols, since this means that a valid executable can
@@ -2689,6 +2687,7 @@ size_input_section (this_ptr, output_sec
 #define IGNORE_SECTION(bfd, s) \
   (((bfd_get_section_flags (bfd, s) & (SEC_ALLOC | SEC_LOAD)) != (SEC_ALLOC | SEC_LOAD)) \
    || bfd_section_size (bfd, s) == 0)
+
 /* Check to see if any allocated sections overlap with other allocated
    sections.  This can happen when the linker script specifically specifies
    the output section addresses of the two sections.  */
@@ -2699,7 +2698,6 @@ lang_check_section_addresses ()
   asection *s;
   unsigned opb = bfd_octets_per_byte (output_bfd);
 
-
   /* Scan all sections in the output list.  */
   for (s = output_bfd->sections; s != NULL; s = s->next)
     {
@@ -3458,7 +3456,6 @@ lang_finish ()
     }
 }
 
-
 /* This is the routine to handle BFD error messages.  */
 
 #ifdef ANSI_PROTOTYPES
@@ -3505,6 +3502,7 @@ record_bfd_errors (va_alist)
 }
 
 #endif /* ! defined (ANSI_PROTOTYPES) */
+
 /* This is a small function used when we want to ignore errors from
    BFD.  */
 


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