This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Copy thumb-ness in .symver


This patch is necessary to build libstdc++ with the relatively recent
.symver hacks in compatibility.cc as a GNU/Linux Thumb shared library.
Because .symver wasn't paying attention to the target-specific flags,
it never set the high bit on the versioned symbols it created.

I suspect this affects .set also.  When I asked Paul about it, he felt
that was fine.  The current behavior of .set is a bit illogical in
that regard.

Does anyone see a reason not to do it this way?

Tested arm-none-linux-gnueabi by running the binutils testsuite, and
some hand testing on a rebuilt uClibc and libstdc++.  I'm running some
more exhaustive tests now.

-- 
Daniel Jacobowitz
CodeSourcery

2007-03-13  Daniel Jacobowitz  <dan@codesourcery.com>

	gas/
	* config/tc-arm.c (arm_copy_symbol_attributes): New.
	* config/tc-arm.h (arm_copy_symbol_attributes): Declare.
	(TC_COPY_SYMBOL_ATTRIBUTES): Define.
	* gas/symbols.c (copy_symbol_attributes): Use
	TC_COPY_SYMBOL_ATTRIBUTES.

	gas/testsuite/
	* gas/arm/thumbver.d, gas/arm/thumbver.s: New test.

---
 gas/config/tc-arm.c |    6 ++++++
 gas/config/tc-arm.h |    6 ++++++
 gas/symbols.c       |    4 ++++
 3 files changed, 16 insertions(+)

Index: binutils-2.17.50/gas/config/tc-arm.c
===================================================================
--- binutils-2.17.50.orig/gas/config/tc-arm.c	2007-03-12 11:11:20.000000000 -0700
+++ binutils-2.17.50/gas/config/tc-arm.c	2007-03-12 14:56:51.000000000 -0700
@@ -20499,3 +20499,9 @@ s_arm_fpu (int ignored ATTRIBUTE_UNUSED)
   ignore_rest_of_line ();
 }
 
+/* Copy symbol information.  */
+void
+arm_copy_symbol_attributes (symbolS *dest, symbolS *src)
+{
+  ARM_GET_FLAG (dest) = ARM_GET_FLAG (src);
+}
Index: binutils-2.17.50/gas/config/tc-arm.h
===================================================================
--- binutils-2.17.50.orig/gas/config/tc-arm.h	2007-01-17 05:47:20.000000000 -0800
+++ binutils-2.17.50/gas/config/tc-arm.h	2007-03-12 14:55:22.000000000 -0700
@@ -141,6 +141,12 @@ bfd_boolean arm_is_eabi (void);
 #define ARM_SET_INTERWORK(s,t)  ((t) ? ARM_SET_FLAG (s, ARM_FLAG_INTERWORK) : ARM_RESET_FLAG (s, ARM_FLAG_INTERWORK))
 #define THUMB_SET_FUNC(s,t)     ((t) ? ARM_SET_FLAG (s, THUMB_FLAG_FUNC)    : ARM_RESET_FLAG (s, THUMB_FLAG_FUNC))
 
+void arm_copy_symbol_attributes (symbolS *, symbolS *);
+#ifndef TC_COPY_SYMBOL_ATTRIBUTES
+#define TC_COPY_SYMBOL_ATTRIBUTES(DEST, SRC) \
+  (arm_copy_symbol_attributes (DEST, SRC))
+#endif
+
 #define TC_START_LABEL(C,STR)            (c == ':' || (c == '/' && arm_data_in_code ()))
 #define tc_canonicalize_symbol_name(str) arm_canonicalize_symbol_name (str);
 #define obj_adjust_symtab() 		 arm_adjust_symtab ()
Index: binutils-2.17.50/gas/symbols.c
===================================================================
--- binutils-2.17.50.orig/gas/symbols.c	2007-01-17 05:45:18.000000000 -0800
+++ binutils-2.17.50/gas/symbols.c	2007-03-12 14:54:43.000000000 -0700
@@ -1837,6 +1837,10 @@ copy_symbol_attributes (symbolS *dest, s
 #ifdef OBJ_COPY_SYMBOL_ATTRIBUTES
   OBJ_COPY_SYMBOL_ATTRIBUTES (dest, src);
 #endif
+
+#ifdef TC_COPY_SYMBOL_ATTRIBUTES
+  TC_COPY_SYMBOL_ATTRIBUTES (dest, src);
+#endif
 }
 
 int
Index: binutils-2.17.50/gas/testsuite/gas/arm/thumbver.d
===================================================================
--- binutils-2.17.50/gas/testsuite/gas/arm/thumbver.d	1969-12-31 16:00:00.000000000 -0800
+++ binutils-src-4.2.0-1/gas/testsuite/gas/arm/thumbver.d	2007-03-13 06:52:05.000000000 -0700
@@ -0,0 +1,15 @@
+# as: -meabi=4
+# readelf: -s
+# This test is only valid on ELF based ports.
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+Symbol table '\.symtab' contains .* entries:
+   Num:    Value  Size Type    Bind   Vis      Ndx Name
+     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
+     1: 00000000     0 SECTION LOCAL  DEFAULT    1 
+#...
+     .*: 00000001     0 FUNC    LOCAL  DEFAULT    1 a_alias
+     .*: 00000001     0 FUNC    LOCAL  DEFAULT    1 a_body
+     .*: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 \$t
+     .*: 00000001     0 FUNC    LOCAL  DEFAULT    1 a_export@VERSION
+#...
Index: binutils-2.17.50/gas/testsuite/gas/arm/thumbver.s
===================================================================
--- binutils-2.17.50/gas/testsuite/gas/arm/thumbver.s	1969-12-31 16:00:00.000000000 -0800
+++ binutils-src-4.2.0-1/gas/testsuite/gas/arm/thumbver.s	2007-03-13 06:47:39.000000000 -0700
@@ -0,0 +1,9 @@
+@ Check that symbols created by .symver are marked as Thumb.
+
+	.thumb_set a_alias, a_body
+	.symver a_alias, a_export@VERSION
+	.type a_body, %function
+	.code 16
+	.thumb_func
+a_body:
+	nop


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