From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Lance Taylor To: khan@xraylith.wisc.edu Cc: gas2@cygnus.com Subject: Re: i386-pe named linkonce section switching problem Date: Sat, 05 Sep 1998 16:02:00 -0000 Message-id: <199809052302.TAA24819@subrogation.cygnus.com> References: <9809021556.AA06709@modi.xraylith.wisc.edu> X-SW-Source: 1998/msg00216.html Date: Wed, 02 Sep 1998 10:56:13 -0500 From: Mumit Khan 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),