PR gas/16858
	* config/tc-i386.c (md_apply_fix): Improve the detection of code
	symbols for 32-bit PE targets.
+2014-05-19  Nick Clifton  <nickc@redhat.com>
+
+       PR gas/16858
+       * config/tc-i386.c (md_apply_fix): Improve the detection of code
+       symbols for 32-bit PE targets.
+
 2014-05-18  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * config/tc-mips.c (md_obj_begin): Delete.
 
       /* PR 16858: Do not modify weak function references.  */
       && ! fixP->fx_pcrel)
     {
+#if !defined (TE_PEP)
+      /* For x86 PE weak function symbols are neither PC-relative
+        nor do they set S_IS_FUNCTION.  So the only reliable way
+        to detect them is to check the flags of their containing
+        section.  */
+      if (S_GET_SEGMENT (fixP->fx_addsy) != NULL
+         && S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_CODE)
+       ;
+      else
+#endif
       value -= S_GET_VALUE (fixP->fx_addsy);
     }
 #endif