This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.


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

Re: i386-pe named linkonce section switching problem


   Date: Wed, 02 Sep 1998 10:56:13 -0500
   From: Mumit Khan <khan@xraylith.wisc.edu>

   Platform : i386-pe (mingw32, cygwin32, etc)
   binutils : everything upto and including 980830
   compiler : egcs-1.1

   The following C++ code shows an odd problem with switching named linkonce
   sections within the same object file, and such code shows up in C++ with 
   jump tables. Essentially, we lose the linkonce directive after the switch.

The appended patch appears to fix this problems.

   If I add a ``.linkonce discard'' to the second .section .text$func__Fc
   when it switches back, the linkonce is preserved, but the final executable 
   crashes.

I doubt the patch would fix this problem.

Ian

Index: config/obj-coff.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/config/obj-coff.c,v
retrieving revision 1.155
diff -u -r1.155 obj-coff.c
--- obj-coff.c	1998/07/13 20:00:37	1.155
+++ obj-coff.c	1998/09/05 23:01:11
@@ -1214,6 +1214,12 @@
 
   if (flags != SEC_NO_FLAGS)
     {
+      flagword oldflags;
+
+      oldflags = bfd_get_section_flags (stdoutput, sec);
+      oldflags &= SEC_LINK_ONCE | SEC_LINK_DUPLICATES;
+      flags |= oldflags;
+
       if (! bfd_set_section_flags (stdoutput, sec, flags))
 	as_warn (_("error setting flags for \"%s\": %s"),
 		 bfd_section_name (stdoutput, sec),