This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

arm and profiling


Programs fail to link for arm-netbsd due to undefined symbols when using
-profile-arcs. The reason for this is that the arm backend sometimes
decorates the symbol names with a '^', and that confuses assemble_label(),
since it expect the '*' to be the first character in the name. The result
is that the names are sometimes output as "LPBX2" and sometimes as "_LPBX2".

The patch below fix this by teaching the ASM_OUTPUT_LABELREF about
the '*' encoding.

Bootstrapped and regtested on arm-unknown-netbsd1.5Y.
Ok to install?

   /Krister


2002-08-27  Krister Walfridsson  <cato@df.lth.se>

	* config/arm/arm.c (arm_asm_output_labelref): New function.
	* config/arm/arm.h (ASM_OUTPUT_LABELREF): Call arm_asm_output_labelref.
	* config/arm/arm-protos.h: Add prototype for arm_asm_output_labelref.


Index: arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.223
diff -c -3 -p -r1.223 arm.c
*** arm.c	21 Aug 2002 02:41:45 -0000	1.223
--- arm.c	27 Aug 2002 21:38:46 -0000
*************** arm_strip_name_encoding (name)
*** 10799,10804 ****
--- 10799,10822 ----
    return name;
  }

+ void
+ arm_asm_output_labelref (FILE *stream, const char *name)
+ {
+   int skip;
+   int verbatim = 0;
+
+   while ((skip = arm_get_strip_length (*name)))
+     {
+       verbatim |= (*name == '*');
+       name += skip;
+     }
+
+   if (verbatim)
+     fputs (name, stream);
+   else
+     asm_fprintf (stream, "%U%s", name);
+ }
+
  rtx aof_pic_label;

  #ifdef AOF_ASSEMBLER
Index: arm.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.h,v
retrieving revision 1.155
diff -c -3 -p -r1.155 arm.h
*** arm.h	8 Aug 2002 11:08:34 -0000	1.155
--- arm.h	27 Aug 2002 21:38:50 -0000
*************** typedef struct
*** 1858,1864 ****
     `assemble_name' uses this.  */
  #undef  ASM_OUTPUT_LABELREF
  #define ASM_OUTPUT_LABELREF(FILE, NAME)		\
!   asm_fprintf (FILE, "%U%s", arm_strip_name_encoding (NAME))

  #define ARM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)	\
    arm_encode_call_attribute (DECL, SHORT_CALL_FLAG_CHAR)
--- 1858,1864 ----
     `assemble_name' uses this.  */
  #undef  ASM_OUTPUT_LABELREF
  #define ASM_OUTPUT_LABELREF(FILE, NAME)		\
!   arm_asm_output_labelref (FILE, NAME)

  #define ARM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)	\
    arm_encode_call_attribute (DECL, SHORT_CALL_FLAG_CHAR)
Index: arm-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm-protos.h,v
retrieving revision 1.29
diff -c -3 -p -r1.29 arm-protos.h
*** arm-protos.h	3 Mar 2002 04:23:02 -0000	1.29
--- arm-protos.h	27 Aug 2002 21:38:51 -0000
*************** extern void   arm_expand_prologue	PARAMS
*** 34,39 ****
--- 34,40 ----
  /* Used in arm.md, but defined in output.c.  */
  extern void   assemble_align		PARAMS ((int));
  extern const char * arm_strip_name_encoding	PARAMS ((const char *));
+ extern void   arm_asm_output_labelref	PARAMS ((FILE *, const char *));
  extern unsigned long arm_current_func_type	PARAMS ((void));
  extern unsigned int  arm_compute_initial_elimination_offset PARAMS ((unsigned int, unsigned int));



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