XCOFF C_HIDEXT and C_AIX_WEAKEXT classification

Alan Modra amodra@gmail.com
Tue Jul 7 08:47:58 GMT 2020


If C_HIDEXT and C_AIX_WEAKEXT symbols aren't handled as globals by
coff_classify_symbol then we run into "warning: .. local symbol `some
garbage name' has no section".  These are of course both global
symbols, but C_HIDEXT is like a local in some respects and returning
COFF_SYMBOL_LOCAL for C_HIDEXT keeps nm output looking the same.
Fixes these fails on rs6000-aix5.1:

-FAIL: weakref tests, relocations
-FAIL: weakref tests, global syms
-FAIL: weakref tests, strong undefined syms
-FAIL: weakref tests, weak undefined syms

	* coffcode.h (coff_classify_symbol): Handle C_HIDEXT and
	C_AIX_WEAKEXT.

diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 9a97ba740f..0910f918d1 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -4904,6 +4904,12 @@ coff_classify_symbol (bfd *abfd,
     case C_THUMBEXT:
     case C_THUMBEXTFUNC:
 #endif
+#ifdef RS6000COFF_C
+    case C_HIDEXT:
+#if ! defined _AIX52 && ! defined AIX_WEAK_SUPPORT
+    case C_AIX_WEAKEXT:
+#endif
+#endif
 #ifdef C_SYSTEM
     case C_SYSTEM:
 #endif
@@ -4917,6 +4923,10 @@ coff_classify_symbol (bfd *abfd,
 	  else
 	    return COFF_SYMBOL_COMMON;
 	}
+#ifdef RS6000COFF_C
+      if (syment->n_sclass == C_HIDEXT)
+	return COFF_SYMBOL_LOCAL;
+#endif
       return COFF_SYMBOL_GLOBAL;
 
     default:

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list