weak support for SOM

Jeffrey A Law law@cygnus.com
Wed Mar 15 17:56:00 GMT 2000


We recently added weak support to the assembler for PA32 native toolchains
using the SOM object format; we also added similar support into GCC for
weak symbols on that toolchain.

However, we can not depend on the user actually having the latest binutils
snapshot installed, so we have to make that support conditional on what
assembler is installed.

This patch makes weak support for the PA32 ports using SOM conditional
on whether or not the assembler actually supports .weak.

	* acconfig.h (HAVE_GAS_WEAK): New define.
	* configure.in (assembler weak support): Check for .weak support.
	* config.in, configure: Rebuilt.
	* pa/som.h (MAKE_DECL_ONE_ONLY, ASM_WEAKEN_LABEL): Only define if
	HAVE_GAS_WEAK is defined.
Index: acconfig.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/acconfig.h,v
retrieving revision 1.42
diff -c -3 -p -r1.42 acconfig.h
*** acconfig.h	2000/02/27 00:10:13	1.42
--- acconfig.h	2000/03/15 22:44:59
***************
*** 69,74 ****
--- 69,77 ----
     emitting at the beginning of your section */
  #undef HAVE_GAS_SUBSECTION_ORDERING
  
+ /* Define if your assembler supports .weak.  */
+ #undef HAVE_GAS_WEAK
+ 
  /* Define if your assembler uses the old HImode fild and fist notation.  */
  #undef HAVE_GAS_FILDS_FISTS
  
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.344
diff -c -3 -p -r1.344 configure.in
*** configure.in	2000/03/14 15:47:23	1.344
--- configure.in	2000/03/15 22:45:13
*************** EOF
*** 4427,4432 ****
--- 4427,4445 ----
  fi
  AC_MSG_RESULT($gcc_cv_as_subsections)
  
+ AC_MSG_CHECKING(assembler weak support)
+ gcc_cv_as_weak=
+ if test x$gcc_cv_as != x; then
+ 	# Check if we have .weak
+ 	echo "	.weak foobar" > conftest.s
+ 	if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
+ 		AC_DEFINE(HAVE_GAS_WEAK)
+ 		gcc_cv_as_weak="yes"
+ 	fi
+ 	rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
+ fi
+ AC_MSG_RESULT($gcc_cv_as_weak)
+ 
  case "$target" in 
    sparc*-*-*)
      AC_CACHE_CHECK([assembler .register pseudo-op support],
Index: config/pa/som.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/pa/som.h,v
retrieving revision 1.9
diff -c -3 -p -r1.9 som.h
*** som.h	2000/02/28 20:27:43	1.9
--- som.h	2000/03/15 22:45:13
*************** do {						\
*** 378,383 ****
--- 378,384 ----
  /* The .align directive in the HP assembler allows up to a 32 alignment.  */
  #define MAX_OFILE_ALIGNMENT 32768
  
+ #ifdef HAVE_GAS_WEAK
  #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
  
  /* This is how we tell the assembler that a symbol is weak.  */
*************** do {						\
*** 385,387 ****
--- 386,389 ----
  #define ASM_WEAKEN_LABEL(FILE,NAME) \
    do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
         fputc ('\n', FILE); } while (0)
+ #endif





More information about the Gcc-patches mailing list