Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Made weak_alias create correct labels on sh-elf.



details:   https://anonhg.NetBSD.org/src/rev/80d5c8ca75e6
branches:  trunk
changeset: 500618:80d5c8ca75e6
user:      marcus <marcus%NetBSD.org@localhost>
date:      Thu Dec 14 18:47:30 2000 +0000

description:
Made weak_alias create correct labels on sh-elf.

diffstat:

 sys/arch/sh3/include/asm.h |   6 +++---
 sys/sys/cdefs_elf.h        |  21 ++++++++++++++++++---
 2 files changed, 21 insertions(+), 6 deletions(-)

diffs (77 lines):

diff -r 7de453b46708 -r 80d5c8ca75e6 sys/arch/sh3/include/asm.h
--- a/sys/arch/sh3/include/asm.h        Thu Dec 14 18:44:20 2000 +0000
+++ b/sys/arch/sh3/include/asm.h        Thu Dec 14 18:47:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asm.h,v 1.2 2000/06/23 12:18:49 kleink Exp $   */
+/*     $NetBSD: asm.h,v 1.3 2000/12/14 18:47:31 marcus Exp $   */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -84,8 +84,8 @@
 
 #ifdef __ELF__
 #define        WEAK_ALIAS(alias,sym)                                           \
-       .weak alias;                                                    \
-       alias = sym
+       .weak _C_LABEL(alias);                                          \
+       _C_LABEL(alias) = _C_LABEL(sym)
 #endif
 
 #ifdef __STDC__
diff -r 7de453b46708 -r 80d5c8ca75e6 sys/sys/cdefs_elf.h
--- a/sys/sys/cdefs_elf.h       Thu Dec 14 18:44:20 2000 +0000
+++ b/sys/sys/cdefs_elf.h       Thu Dec 14 18:47:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs_elf.h,v 1.8 2000/08/07 16:35:34 kleink Exp $     */
+/*     $NetBSD: cdefs_elf.h,v 1.9 2000/12/14 18:47:30 marcus Exp $     */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -32,8 +32,10 @@
 
 #if defined(__sh3__)
 #define        _C_LABEL(x)     __CONCAT(_,x)
+#define _C_LABEL_STRING(x)     "_"x
 #else
 #define        _C_LABEL(x)     x
+#define _C_LABEL_STRING(x)     x
 #endif
 
 #if __STDC__
@@ -57,21 +59,34 @@
 
 #ifndef __DO_NOT_DO_WEAK__
 #define        __weak_alias(alias,sym)                                         \
-    __asm__(".weak " #alias " ; " #alias " = " #sym);
+    __asm__(".weak " _C_LABEL_STRING(#alias) " ; "                     \
+           _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
 #endif /* !__DO_NOT_DO_WEAK__ */
 #define        __weak_extern(sym)                                              \
-    __asm__(".weak " #sym);
+    __asm__(".weak " _C_LABEL_STRING(#sym));
 #define        __warn_references(sym,msg)                                      \
     __asm__(".section .gnu.warning." #sym " ; .ascii \"" msg "\" ; .text");
 
 #else /* !__STDC__ */
 
 #ifndef __DO_NOT_DO_WEAK__
+#if defined(__sh3__)
+#define __weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)
+#define        ___weak_alias(alias,sym)                                        \
+    __asm__(".weak alias ; alias = sym");
+#else
 #define        __weak_alias(alias,sym)                                         \
     __asm__(".weak alias ; alias = sym");
+#endif
 #endif /* !__DO_NOT_DO_WEAK__ */
+#if defined(__sh3__)
+#define __weak_extern(sym) ___weak_extern(_/**/sym)
+#define        ___weak_extern(sym)                                             \
+    __asm__(".weak sym");
+#else
 #define        __weak_extern(sym)                                              \
     __asm__(".weak sym");
+#endif
 #define        __warn_references(sym,msg)                                      \
     __asm__(".section .gnu.warning.sym ; .ascii msg ; .text");
 



Home | Main Index | Thread Index | Old Index