All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
@ 2006-02-11 11:38 Martin Habets
  2006-02-11 11:51 ` William Lee Irwin III
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Martin Habets @ 2006-02-11 11:38 UTC (permalink / raw)
  To: sparclinux

Rusty,

Thanks for explaining. As far as I remember this all started with
the cleanup of an ugly #define, but I could be wrong there.

Dave,

The following patch changes the use of "_Div" to "div", etc, to resolve
the following kind of warnings from depmod:
WARNING: /lib/modules/2.6.16-rc2-mph2/kernel/crypto/crc32c.ko needs unknown symbol div

The patch eliminates the need for another-special-case in modpost and depmod.
Do you remember why this approach wasn't taken immediately?
Please apply.

On Thu, Feb 09, 2006 at 12:29:48PM +1100, Rusty Russell wrote:
> (1) it's just a warning, and it doesn't actually effect anything.
> (2) Someone decided to be clever in arch/sparc/kernel/sparc_ksyms.c
> between 2.6.13 and 2.6.14.  Rather than mangle ".div" to "div", they
> decided to mangle it to "_Div".  The problem is that depmod knows about
> skipping the ".": it's done for other architectures.  It has no idea
> about this new mangling.
> 
> 2.6.12 did it the obvious way, 2.6.13 used asm, and 2.6.14 the new
> scheme.  One wonders what was wrong with 2.6.12, but I haven't been
> following closely.
> 
> Now, possibly there was a legitimate reason not to pollute the namespace
> with these symbols, but they could probably have been made static
> without great concern.
> 
> Hope that clarifies,
> Rusty.

Best regards,
Martin

	Signed-off-by: Martin Habets <errandir_news@mph.eclipse.co.uk>
---
--- 2.6.15/arch/sparc/kernel/sparc_ksyms.c.orig	2006-02-09 11:06:57.000000000 +0000
+++ 2.6.15/arch/sparc/kernel/sparc_ksyms.c	2006-02-09 22:47:40.000000000 +0000
@@ -94,12 +94,12 @@
 /* Alias functions whose names begin with "." and export the aliases.
  * The module references will be fixed up by module_frob_arch_sections.
  */
-extern int _Div(int, int);
-extern int _Mul(int, int);
-extern int _Rem(int, int);
-extern unsigned _Udiv(unsigned, unsigned);
-extern unsigned _Umul(unsigned, unsigned);
-extern unsigned _Urem(unsigned, unsigned);
+extern int div(int, int);
+extern int mul(int, int);
+extern int rem(int, int);
+extern unsigned udiv(unsigned, unsigned);
+extern unsigned umul(unsigned, unsigned);
+extern unsigned urem(unsigned, unsigned);
 
 /* used by various drivers */
 EXPORT_SYMBOL(sparc_cpu_model);
@@ -309,12 +309,12 @@
 EXPORT_SYMBOL(__muldi3);
 EXPORT_SYMBOL(__divdi3);
 
-EXPORT_SYMBOL(_Rem);
-EXPORT_SYMBOL(_Urem);
-EXPORT_SYMBOL(_Mul);
-EXPORT_SYMBOL(_Umul);
-EXPORT_SYMBOL(_Div);
-EXPORT_SYMBOL(_Udiv);
+EXPORT_SYMBOL(rem);
+EXPORT_SYMBOL(urem);
+EXPORT_SYMBOL(mul);
+EXPORT_SYMBOL(umul);
+EXPORT_SYMBOL(div);
+EXPORT_SYMBOL(udiv);
 
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 EXPORT_SYMBOL(do_BUG);
--- 2.6.15/scripts/mod/modpost.c.orig	2006-02-10 11:09:04.000000000 +0000
+++ 2.6.15/scripts/mod/modpost.c	2006-02-10 11:09:09.000000000 +0000
@@ -370,12 +370,6 @@
 			/* Ignore register directives. */
 			if (ELF_ST_TYPE(sym->st_info) = STT_SPARC_REGISTER)
 				break;
- 			if (symname[0] = '.') {
- 				char *munged = strdup(symname);
- 				munged[0] = '_';
- 				munged[1] = toupper(munged[1]);
- 				symname = munged;
- 			}
 		}
 #endif
 		
--- 2.6.15/arch/sparc/kernel/module.c.orig	2006-02-09 11:35:47.000000000 +0000
+++ 2.6.15/arch/sparc/kernel/module.c	2006-02-09 11:37:00.000000000 +0000
@@ -66,8 +66,7 @@
 			else {
 				char *name = strtab + sym[i].st_name;
 				if (name[0] = '.') {
-					name[0] = '_';
-					name[1] = toupper(name[1]);
+					memmove(name, name+1, strlen(name));
 				}
 			}
 		}
--- 2.6.15/arch/sparc/lib/mul.S.orig	2006-02-09 23:27:32.000000000 +0000
+++ 2.6.15/arch/sparc/lib/mul.S	2006-02-09 23:28:53.000000000 +0000
@@ -16,9 +16,9 @@
  */
 
 	.globl .mul
-	.globl _Mul
+	.globl mul
 .mul:
-_Mul:	/* needed for export */
+mul:	/* needed for export */
 	mov	%o0, %y		! multiplier -> Y
 	andncc	%o0, 0xfff, %g0	! test bits 12..31
 	be	Lmul_shortway	! if zero, can do it the short way
--- 2.6.15/arch/sparc/lib/rem.S.orig	2006-02-09 23:22:37.000000000 +0000
+++ 2.6.15/arch/sparc/lib/rem.S	2006-02-09 23:20:26.000000000 +0000
@@ -43,9 +43,9 @@
 
 
 	.globl .rem
-	.globl _Rem
+	.globl rem
 .rem:
-_Rem:	/* needed for export */
+rem:	/* needed for export */
 	! compute sign of result; if neither is negative, no problem
 	orcc	%o1, %o0, %g0	! either negative?
 	bge	2f			! no, go do the divide
--- 2.6.15/arch/sparc/lib/sdiv.S.orig	2006-02-09 23:28:05.000000000 +0000
+++ 2.6.15/arch/sparc/lib/sdiv.S	2006-02-09 23:29:18.000000000 +0000
@@ -43,9 +43,9 @@
 
 
 	.globl .div
-	.globl _Div
+	.globl div
 .div:
-_Div:	/* needed for export */
+div:	/* needed for export */
 	! compute sign of result; if neither is negative, no problem
 	orcc	%o1, %o0, %g0	! either negative?
 	bge	2f			! no, go do the divide
--- 2.6.15/arch/sparc/lib/udiv.S.orig	2006-02-09 23:28:14.000000000 +0000
+++ 2.6.15/arch/sparc/lib/udiv.S	2006-02-09 23:29:32.000000000 +0000
@@ -43,9 +43,9 @@
 
 
 	.globl .udiv
-	.globl _Udiv
+	.globl udiv
 .udiv:
-_Udiv:	/* needed for export */
+udiv:	/* needed for export */
 
 	! Ready to divide.  Compute size of quotient; scale comparand.
 	orcc	%o1, %g0, %o5
--- 2.6.15/arch/sparc/lib/umul.S.orig	2006-02-09 23:27:40.000000000 +0000
+++ 2.6.15/arch/sparc/lib/umul.S	2006-02-09 23:29:06.000000000 +0000
@@ -21,9 +21,9 @@
  */
 
 	.globl .umul
-	.globl _Umul
+	.globl umul
 .umul:
-_Umul:	/* needed for export */
+umul:	/* needed for export */
 	or	%o0, %o1, %o4
 	mov	%o0, %y		! multiplier -> Y
 
--- 2.6.15/arch/sparc/lib/urem.S.orig	2006-02-09 23:26:50.000000000 +0000
+++ 2.6.15/arch/sparc/lib/urem.S	2006-02-09 23:37:55.000000000 +0000
@@ -41,9 +41,9 @@
  */
 
 	.globl .urem
-	.globl _Urem
+	.globl urem
 .urem:
-_Urem:	/* needed for export */
+urem:	/* needed for export */
 
 	! Ready to divide.  Compute size of quotient; scale comparand.
 	orcc	%o1, %g0, %o5

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
  2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
@ 2006-02-11 11:51 ` William Lee Irwin III
  2006-02-11 12:15 ` Al Viro
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: William Lee Irwin III @ 2006-02-11 11:51 UTC (permalink / raw)
  To: sparclinux

On Sat, Feb 11, 2006 at 11:38:17AM +0000, Martin Habets wrote:
> Thanks for explaining. As far as I remember this all started with
> the cleanup of an ugly #define, but I could be wrong there.

Acked-by: William Irwin <wli@holomorphy.com>


-- wli

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
  2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
  2006-02-11 11:51 ` William Lee Irwin III
@ 2006-02-11 12:15 ` Al Viro
  2006-02-11 13:04 ` William Lee Irwin III
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Al Viro @ 2006-02-11 12:15 UTC (permalink / raw)
  To: sparclinux

On Sat, Feb 11, 2006 at 03:51:20AM -0800, William Lee Irwin III wrote:
> On Sat, Feb 11, 2006 at 11:38:17AM +0000, Martin Habets wrote:
> > Thanks for explaining. As far as I remember this all started with
> > the cleanup of an ugly #define, but I could be wrong there.
> 
> Acked-by: William Irwin <wli@holomorphy.com>

NAK.

a) namespace pollution()
b) it was a lot more than ugly #define, RTFArchives, please

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
  2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
  2006-02-11 11:51 ` William Lee Irwin III
  2006-02-11 12:15 ` Al Viro
@ 2006-02-11 13:04 ` William Lee Irwin III
  2006-02-11 23:54 ` Rusty Russell
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: William Lee Irwin III @ 2006-02-11 13:04 UTC (permalink / raw)
  To: sparclinux

On Sat, Feb 11, 2006 at 03:51:20AM -0800, William Lee Irwin III wrote:
> > Acked-by: William Irwin <wli@holomorphy.com>

On Sat, Feb 11, 2006 at 12:15:47PM +0000, Al Viro wrote:
> NAK.
> a) namespace pollution()
> b) it was a lot more than ugly #define, RTFArchives, please

Retracted, then. Sorry for the noise.


-- wli

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
  2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
                   ` (2 preceding siblings ...)
  2006-02-11 13:04 ` William Lee Irwin III
@ 2006-02-11 23:54 ` Rusty Russell
  2006-02-12  0:21 ` Al Viro
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Rusty Russell @ 2006-02-11 23:54 UTC (permalink / raw)
  To: sparclinux

On Sat, 2006-02-11 at 11:38 +0000, Martin Habets wrote:
> Rusty,
> 
> Thanks for explaining. As far as I remember this all started with
> the cleanup of an ugly #define, but I could be wrong there.

It seems so, as Al so comprehensively explained.  It was binutils
breakage.  You might find something like this (note: untested!)
preferable.  Other archs may well want EXPORT_SYMBOL_AS for special
effects anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Make sparc use the same "remove the dot" mangling as other archs, which
depmod already understands.  Avoid namespace pollution (not really a
problem, but ugly) by using an __export_ alias: it needs to be a global
symbol as attempts to craft an alias in the sparc_ksyms.c was rejected
by various recent binutils versions:

 http://marc.theaimsgroup.com/?l=linux-sparc&m\x112102634105866&w=2
 http://marc.theaimsgroup.com/?l=linux-sparc&m\x112630905813914&w=2

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.16-rc2-git6/arch/sparc/kernel/module.c working-2.6.16-rc2-git6-sparcsyms/arch/sparc/kernel/module.c
--- linux-2.6.16-rc2-git6/arch/sparc/kernel/module.c	2005-10-31 12:20:31.000000000 +1100
+++ working-2.6.16-rc2-git6-sparcsyms/arch/sparc/kernel/module.c	2006-02-12 10:31:08.000000000 +1100
@@ -65,10 +65,8 @@ int module_frob_arch_sections(Elf_Ehdr *
 				sym[i].st_shndx = SHN_ABS;
 			else {
 				char *name = strtab + sym[i].st_name;
-				if (name[0] = '.') {
-					name[0] = '_';
-					name[1] = toupper(name[1]);
-				}
+				if (name[0] = '.')
+					memmove(name, name+1, strlen(name));
 			}
 		}
 	}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.16-rc2-git6/arch/sparc/kernel/sparc_ksyms.c working-2.6.16-rc2-git6-sparcsyms/arch/sparc/kernel/sparc_ksyms.c
--- linux-2.6.16-rc2-git6/arch/sparc/kernel/sparc_ksyms.c	2006-02-09 12:14:34.000000000 +1100
+++ working-2.6.16-rc2-git6-sparcsyms/arch/sparc/kernel/sparc_ksyms.c	2006-02-12 10:43:52.000000000 +1100
@@ -91,15 +91,23 @@ extern void ___rw_read_enter(void);
 extern void ___rw_read_exit(void);
 extern void ___rw_write_enter(void);
 
-/* Alias functions whose names begin with "." and export the aliases.
- * The module references will be fixed up by module_frob_arch_sections.
- */
-extern int _Div(int, int);
-extern int _Mul(int, int);
-extern int _Rem(int, int);
-extern unsigned _Udiv(unsigned, unsigned);
-extern unsigned _Umul(unsigned, unsigned);
-extern unsigned _Urem(unsigned, unsigned);
+/* depmod already trims "." from names to do name matches (for PPC
+ * etc), so we want to use the same scheme.  But simply aliasing div
+ * to .div here breaks on some binutils versions (eg. 2.16.91.0.3).
+ * Putting a global "div" in the asm files works, but we don't want to
+ * pollute the namespace.  So we export "div" via "__export_div". */
+extern int __export_div(int, int);
+extern int __export_mul(int, int);
+extern int __export_rem(int, int);
+extern unsigned __export_udiv(unsigned, unsigned);
+extern unsigned __export_umul(unsigned, unsigned);
+extern unsigned __export_urem(unsigned, unsigned);
+__EXPORT_SYMBOL_AS(__export_div, "div", "");
+__EXPORT_SYMBOL_AS(__export_mul, "mul", "");
+__EXPORT_SYMBOL_AS(__export_rem, "rem", "");
+__EXPORT_SYMBOL_AS(__export_udiv, "udiv", "");
+__EXPORT_SYMBOL_AS(__export_umul, "umul", "");
+__EXPORT_SYMBOL_AS(__export_urem, "urem", "");
 
 /* used by various drivers */
 EXPORT_SYMBOL(sparc_cpu_model);
@@ -309,13 +317,6 @@ EXPORT_SYMBOL(__lshrdi3);
 EXPORT_SYMBOL(__muldi3);
 EXPORT_SYMBOL(__divdi3);
 
-EXPORT_SYMBOL(_Rem);
-EXPORT_SYMBOL(_Urem);
-EXPORT_SYMBOL(_Mul);
-EXPORT_SYMBOL(_Umul);
-EXPORT_SYMBOL(_Div);
-EXPORT_SYMBOL(_Udiv);
-
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 EXPORT_SYMBOL(do_BUG);
 #endif
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.16-rc2-git6/arch/sparc/lib/mul.S working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/mul.S
--- linux-2.6.16-rc2-git6/arch/sparc/lib/mul.S	2005-10-31 12:20:31.000000000 +1100
+++ working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/mul.S	2006-02-12 10:33:52.000000000 +1100
@@ -16,9 +16,9 @@
  */
 
 	.globl .mul
-	.globl _Mul
+	.globl __export_mul
 .mul:
-_Mul:	/* needed for export */
+__export_mul:
 	mov	%o0, %y		! multiplier -> Y
 	andncc	%o0, 0xfff, %g0	! test bits 12..31
 	be	Lmul_shortway	! if zero, can do it the short way
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.16-rc2-git6/arch/sparc/lib/rem.S working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/rem.S
--- linux-2.6.16-rc2-git6/arch/sparc/lib/rem.S	2005-10-31 12:20:31.000000000 +1100
+++ working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/rem.S	2006-02-12 10:34:06.000000000 +1100
@@ -43,9 +43,9 @@
 
 
 	.globl .rem
-	.globl _Rem
+	.globl __export_rem
 .rem:
-_Rem:	/* needed for export */
+__export_rem:
 	! compute sign of result; if neither is negative, no problem
 	orcc	%o1, %o0, %g0	! either negative?
 	bge	2f			! no, go do the divide
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.16-rc2-git6/arch/sparc/lib/sdiv.S working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/sdiv.S
--- linux-2.6.16-rc2-git6/arch/sparc/lib/sdiv.S	2005-10-31 12:20:31.000000000 +1100
+++ working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/sdiv.S	2006-02-12 10:34:13.000000000 +1100
@@ -43,9 +43,9 @@
 
 
 	.globl .div
-	.globl _Div
+	.globl __export_div
 .div:
-_Div:	/* needed for export */
+__export_div:
 	! compute sign of result; if neither is negative, no problem
 	orcc	%o1, %o0, %g0	! either negative?
 	bge	2f			! no, go do the divide
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.16-rc2-git6/arch/sparc/lib/umul.S working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/umul.S
--- linux-2.6.16-rc2-git6/arch/sparc/lib/umul.S	2005-10-31 12:20:31.000000000 +1100
+++ working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/umul.S	2006-02-12 10:34:32.000000000 +1100
@@ -21,9 +21,9 @@
  */
 
 	.globl .umul
-	.globl _Umul
+	.globl __export_umul
 .umul:
-_Umul:	/* needed for export */
+__export_umul:
 	or	%o0, %o1, %o4
 	mov	%o0, %y		! multiplier -> Y
 
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.16-rc2-git6/arch/sparc/lib/urem.S working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/urem.S
--- linux-2.6.16-rc2-git6/arch/sparc/lib/urem.S	2005-10-31 12:20:31.000000000 +1100
+++ working-2.6.16-rc2-git6-sparcsyms/arch/sparc/lib/urem.S	2006-02-12 10:34:43.000000000 +1100
@@ -41,9 +41,9 @@
  */
 
 	.globl .urem
-	.globl _Urem
+	.globl __export_urem
 .urem:
-_Urem:	/* needed for export */
+__export_urem:
 
 	! Ready to divide.  Compute size of quotient; scale comparand.
 	orcc	%o1, %g0, %o5
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.16-rc2-git6/include/linux/module.h working-2.6.16-rc2-git6-sparcsyms/include/linux/module.h
--- linux-2.6.16-rc2-git6/include/linux/module.h	2006-01-10 15:19:50.000000000 +1100
+++ working-2.6.16-rc2-git6-sparcsyms/include/linux/module.h	2006-02-12 10:32:40.000000000 +1100
@@ -182,21 +182,21 @@ void *__symbol_get_gpl(const char *symbo
 #endif
 
 /* For every exported symbol, place a struct in the __ksymtab section */
-#define __EXPORT_SYMBOL(sym, sec)				\
+#define __EXPORT_SYMBOL_AS(sym, name, sec)			\
 	__CRC_SYMBOL(sym, sec)					\
 	static const char __kstrtab_##sym[]			\
 	__attribute__((section("__ksymtab_strings")))		\
-	= MODULE_SYMBOL_PREFIX #sym;                    	\
+	= MODULE_SYMBOL_PREFIX name;                    	\
 	static const struct kernel_symbol __ksymtab_##sym	\
 	__attribute_used__					\
 	__attribute__((section("__ksymtab" sec), unused))	\
 	= { (unsigned long)&sym, __kstrtab_##sym }
 
 #define EXPORT_SYMBOL(sym)					\
-	__EXPORT_SYMBOL(sym, "")
+	__EXPORT_SYMBOL_AS(sym, __stringify(sym), "")
 
 #define EXPORT_SYMBOL_GPL(sym)					\
-	__EXPORT_SYMBOL(sym, "_gpl")
+	__EXPORT_SYMBOL_AS(sym, __stringify(sym), "_gpl")
 
 #endif
 

-- 
 ccontrol: http://ozlabs.org/~rusty/ccontrol


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
  2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
                   ` (3 preceding siblings ...)
  2006-02-11 23:54 ` Rusty Russell
@ 2006-02-12  0:21 ` Al Viro
  2006-02-12  1:07 ` Rusty Russell
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Al Viro @ 2006-02-12  0:21 UTC (permalink / raw)
  To: sparclinux

On Sun, Feb 12, 2006 at 10:54:37AM +1100, Rusty Russell wrote:
> It seems so, as Al so comprehensively explained.  It was binutils
> breakage.  You might find something like this (note: untested!)
> preferable.  Other archs may well want EXPORT_SYMBOL_AS for special
> effects anyway.
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> 
> Make sparc use the same "remove the dot" mangling as other archs, which
> depmod already understands.  Avoid namespace pollution (not really a
> problem, but ugly) by using an __export_ alias: it needs to be a global
> symbol as attempts to craft an alias in the sparc_ksyms.c was rejected
> by various recent binutils versions:

ewww...

You do realize that your "remove the dot" is ppc-only?  I.e. just as much
of a special case as sparc-only mapping.

Seriously, fix in depmod is considerably smaller that what you've just
posted, not to mention being conceptually simpler.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
  2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
                   ` (4 preceding siblings ...)
  2006-02-12  0:21 ` Al Viro
@ 2006-02-12  1:07 ` Rusty Russell
  2006-02-12  3:14 ` Al Viro
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Rusty Russell @ 2006-02-12  1:07 UTC (permalink / raw)
  To: sparclinux

On Sun, 2006-02-12 at 00:21 +0000, Al Viro wrote:
> On Sun, Feb 12, 2006 at 10:54:37AM +1100, Rusty Russell wrote:
> > It seems so, as Al so comprehensively explained.  It was binutils
> > breakage.  You might find something like this (note: untested!)
> > preferable.  Other archs may well want EXPORT_SYMBOL_AS for special
> > effects anyway.
> > 
> > Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> > 
> > Make sparc use the same "remove the dot" mangling as other archs, which
> > depmod already understands.  Avoid namespace pollution (not really a
> > problem, but ugly) by using an __export_ alias: it needs to be a global
> > symbol as attempts to craft an alias in the sparc_ksyms.c was rejected
> > by various recent binutils versions:
> 
> ewww...
> 
> You do realize that your "remove the dot" is ppc-only?  I.e. just as much
> of a special case as sparc-only mapping.

No Al.  Since day 1 we've had this in module-init-tools.  It was used by
both PPC and Sparc.

Sparc stopped using it to work around sparc-specific binutils bugs.  I'm
naturally resistent to (more) arch-specific hacks in depmod.  In the
kernel, arch-specifics get testing, in module-init-tools they don't.

> Seriously, fix in depmod is considerably smaller that what you've just
> posted, not to mention being conceptually simpler.

You're exactly right.  By this logic, I look forward to you fixing
binutils.

Glad we resolved that!
Rusty.
-- 
 ccontrol: http://ozlabs.org/~rusty/ccontrol


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
  2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
                   ` (5 preceding siblings ...)
  2006-02-12  1:07 ` Rusty Russell
@ 2006-02-12  3:14 ` Al Viro
  2006-02-12 10:39 ` Rusty Russell
  2006-02-15 11:56 ` Martin Habets
  8 siblings, 0 replies; 10+ messages in thread
From: Al Viro @ 2006-02-12  3:14 UTC (permalink / raw)
  To: sparclinux

On Sun, Feb 12, 2006 at 12:07:44PM +1100, Rusty Russell wrote:
> > You do realize that your "remove the dot" is ppc-only?  I.e. just as much
> > of a special case as sparc-only mapping.
> 
> No Al.  Since day 1 we've had this in module-init-tools.  It was used by
> both PPC and Sparc.

... by PPC to deal with odd mangling of everything, in sparc - as a kludge
for several libgcc symbols.
 
> Sparc stopped using it to work around sparc-specific binutils bugs.  I'm
> naturally resistent to (more) arch-specific hacks in depmod.  In the
> kernel, arch-specifics get testing, in module-init-tools they don't.

It's not about sparc-specific binutils bug.  At all.  The thing responsible
for that is gcc, not binutils.

> > Seriously, fix in depmod is considerably smaller that what you've just
> > posted, not to mention being conceptually simpler.
> 
> You're exactly right.  By this logic, I look forward to you fixing
> binutils.

What the hell does it have to do with binutils?  There are two unrelated
things:
	* on ppc, gcc -S prepends . to public symbols - i.e. if foo.c
defines bar(), you'll get .bar in foo.s.
	* on sparc, names used for primitives implemented in libgcc (and
emitted by gcc when generating a call of such primitive) start with .

Both sit in gcc; the only place where binutils had ever entered the picture
was stricter handling of weak aliases.  That broke original kludges in
sparc_ksyms, but it's completely unrelated to problem with mangling on
sparc.

If you are suggesting to rename symbols in sparc libgcc - sorry, can't do.
They are part of ABI, for all practical purposes.

What I really don't get is why do we want to bother with mangling at all.
I.e. why not define MODULE_SYMBOL_PREFIX to "." on ppc and be done with
that?  And do an equivalent of EXPORT_SYMBOL() for use in .s, which would
be very useful thing in its own right...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
  2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
                   ` (6 preceding siblings ...)
  2006-02-12  3:14 ` Al Viro
@ 2006-02-12 10:39 ` Rusty Russell
  2006-02-15 11:56 ` Martin Habets
  8 siblings, 0 replies; 10+ messages in thread
From: Rusty Russell @ 2006-02-12 10:39 UTC (permalink / raw)
  To: sparclinux

On Sun, 2006-02-12 at 03:14 +0000, Al Viro wrote:
[snip condescending rant]

> And do an equivalent of EXPORT_SYMBOL() for use in .s, which would
> be very useful thing in its own right...

So you're going to do this and fix binutils?  Great!  Send me the patch
when you're done.

Rusty.
-- 
 ccontrol: http://ozlabs.org/~rusty/ccontrol


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage
  2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
                   ` (7 preceding siblings ...)
  2006-02-12 10:39 ` Rusty Russell
@ 2006-02-15 11:56 ` Martin Habets
  8 siblings, 0 replies; 10+ messages in thread
From: Martin Habets @ 2006-02-15 11:56 UTC (permalink / raw)
  To: sparclinux

So is anyone coming up with other patches regarding this?
I like the idea of having an asm equivalent of EXPORT_SYMBOL().

If no other fixes are forthcoming, please apply either Rusty's
patch or mine. I'd still prefer mine because it's simpler, which
for me outweighs the namespace pollution issue.

Martin

On Sun, Feb 12, 2006 at 09:39:59PM +1100, Rusty Russell wrote:
> On Sun, 2006-02-12 at 03:14 +0000, Al Viro wrote:
> [snip condescending rant]
> 
> > And do an equivalent of EXPORT_SYMBOL() for use in .s, which would
> > be very useful thing in its own right...
> 
> So you're going to do this and fix binutils?  Great!  Send me the patch
> when you're done.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-02-15 11:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-11 11:38 [PATCH] sparc32: Fix div, udiv, mul, umul, rem, urem breakage Martin Habets
2006-02-11 11:51 ` William Lee Irwin III
2006-02-11 12:15 ` Al Viro
2006-02-11 13:04 ` William Lee Irwin III
2006-02-11 23:54 ` Rusty Russell
2006-02-12  0:21 ` Al Viro
2006-02-12  1:07 ` Rusty Russell
2006-02-12  3:14 ` Al Viro
2006-02-12 10:39 ` Rusty Russell
2006-02-15 11:56 ` Martin Habets

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.