Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7caaeabb authored by Al Viro's avatar Al Viro Committed by David S. Miller
Browse files

[SPARC]: Fix dot-symbol exporting for good.



From: Al Viro <viro@ZenIV.linux.org.uk>

Instead of playing all of these hand-coded assembler aliasing games,
just translate symbol names in the name space ".sym" to "_Sym" at
module load time.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 357d596b
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -10,6 +10,7 @@
#include <linux/vmalloc.h>
#include <linux/vmalloc.h>
#include <linux/fs.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/string.h>
#include <linux/ctype.h>


void *module_alloc(unsigned long size)
void *module_alloc(unsigned long size)
{
{
@@ -37,7 +38,7 @@ void module_free(struct module *mod, void *module_region)
}
}


/* Make generic code ignore STT_REGISTER dummy undefined symbols,
/* Make generic code ignore STT_REGISTER dummy undefined symbols,
 * and replace references to .func with func as in ppc64's dedotify.
 * and replace references to .func with _Func
 */
 */
int module_frob_arch_sections(Elf_Ehdr *hdr,
int module_frob_arch_sections(Elf_Ehdr *hdr,
			      Elf_Shdr *sechdrs,
			      Elf_Shdr *sechdrs,
@@ -64,8 +65,10 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
				sym[i].st_shndx = SHN_ABS;
				sym[i].st_shndx = SHN_ABS;
			else {
			else {
				char *name = strtab + sym[i].st_name;
				char *name = strtab + sym[i].st_name;
				if (name[0] == '.')
				if (name[0] == '.') {
					memmove(name, name+1, strlen(name));
					name[0] = '_';
					name[1] = toupper(name[1]);
				}
			}
			}
		}
		}
	}
	}
+12 −19
Original line number Original line Diff line number Diff line
@@ -97,19 +97,12 @@ extern void ___rw_write_enter(void);
/* Alias functions whose names begin with "." and export the aliases.
/* Alias functions whose names begin with "." and export the aliases.
 * The module references will be fixed up by module_frob_arch_sections.
 * The module references will be fixed up by module_frob_arch_sections.
 */
 */
#define DOT_ALIAS2(__ret, __x, __arg1, __arg2) \
extern int _Div(int, int);
	extern __ret __x(__arg1, __arg2); \
extern int _Mul(int, int);
	asm(".weak " #__x);\
extern int _Rem(int, int);
	asm(#__x "=." #__x);
extern unsigned _Udiv(unsigned, unsigned);

extern unsigned _Umul(unsigned, unsigned);
DOT_ALIAS2(int, div, int, int)
extern unsigned _Urem(unsigned, unsigned);
DOT_ALIAS2(int, mul, int, int)
DOT_ALIAS2(int, rem, int, int)
DOT_ALIAS2(unsigned, udiv, unsigned, unsigned)
DOT_ALIAS2(unsigned, umul, unsigned, unsigned)
DOT_ALIAS2(unsigned, urem, unsigned, unsigned)

#undef DOT_ALIAS2


/* used by various drivers */
/* used by various drivers */
EXPORT_SYMBOL(sparc_cpu_model);
EXPORT_SYMBOL(sparc_cpu_model);
@@ -320,12 +313,12 @@ EXPORT_SYMBOL(__lshrdi3);
EXPORT_SYMBOL(__muldi3);
EXPORT_SYMBOL(__muldi3);
EXPORT_SYMBOL(__divdi3);
EXPORT_SYMBOL(__divdi3);


EXPORT_SYMBOL(rem);
EXPORT_SYMBOL(_Rem);
EXPORT_SYMBOL(urem);
EXPORT_SYMBOL(_Urem);
EXPORT_SYMBOL(mul);
EXPORT_SYMBOL(_Mul);
EXPORT_SYMBOL(umul);
EXPORT_SYMBOL(_Umul);
EXPORT_SYMBOL(div);
EXPORT_SYMBOL(_Div);
EXPORT_SYMBOL(udiv);
EXPORT_SYMBOL(_Udiv);


#ifdef CONFIG_DEBUG_BUGVERBOSE
#ifdef CONFIG_DEBUG_BUGVERBOSE
EXPORT_SYMBOL(do_BUG);
EXPORT_SYMBOL(do_BUG);
+2 −0
Original line number Original line Diff line number Diff line
@@ -16,7 +16,9 @@
 */
 */


	.globl .mul
	.globl .mul
	.globl _Mul
.mul:
.mul:
_Mul:	/* needed for export */
	mov	%o0, %y		! multiplier -> Y
	mov	%o0, %y		! multiplier -> Y
	andncc	%o0, 0xfff, %g0	! test bits 12..31
	andncc	%o0, 0xfff, %g0	! test bits 12..31
	be	Lmul_shortway	! if zero, can do it the short way
	be	Lmul_shortway	! if zero, can do it the short way
+2 −0
Original line number Original line Diff line number Diff line
@@ -43,7 +43,9 @@




	.globl .rem
	.globl .rem
	.globl _Rem
.rem:
.rem:
_Rem:	/* needed for export */
	! compute sign of result; if neither is negative, no problem
	! compute sign of result; if neither is negative, no problem
	orcc	%o1, %o0, %g0	! either negative?
	orcc	%o1, %o0, %g0	! either negative?
	bge	2f			! no, go do the divide
	bge	2f			! no, go do the divide
+2 −0
Original line number Original line Diff line number Diff line
@@ -43,7 +43,9 @@




	.globl .div
	.globl .div
	.globl _Div
.div:
.div:
_Div:	/* needed for export */
	! compute sign of result; if neither is negative, no problem
	! compute sign of result; if neither is negative, no problem
	orcc	%o1, %o0, %g0	! either negative?
	orcc	%o1, %o0, %g0	! either negative?
	bge	2f			! no, go do the divide
	bge	2f			! no, go do the divide
Loading