aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/sync
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-10-25 22:18:08 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-10-25 22:18:08 +0000
commit34489eb2af3bbb7be101bc838615cf4a4dc6828d (patch)
tree0dbda78980d4553fdaeee92ca666d72a2ab95213 /libgo/go/sync
parentfc756f9f460d5f0ec73a72128645fdb39fec77a0 (diff)
downloadgcc-34489eb2af3bbb7be101bc838615cf4a4dc6828d.zip
gcc-34489eb2af3bbb7be101bc838615cf4a4dc6828d.tar.gz
gcc-34489eb2af3bbb7be101bc838615cf4a4dc6828d.tar.bz2
compiler: improve name mangling for packpaths
The current implementation of Gogo::pkgpath_for_symbol was written in a way that allowed two distinct package paths to map to the same symbol, which could cause collisions at link- time or compile-time. Switch to a better mangling scheme to insure that we get a unique packagepath symbol for each package. In the new scheme instead of having separate mangling schemes for identifiers and package paths, the main identifier mangler ("go_encode_id") now handles mangling of both packagepath characters and identifier characters. The new mangling scheme is more intrusive: "foo/bar.Baz" is mangled as "foo..z2fbar.Baz" instead of "foo_bar.Baz". To mitigate this, this patch also adds a demangling capability so that function names returned from runtime.CallersFrames are converted back to their original unmangled form. Changing the pkgpath_for_symbol scheme requires updating a number of //go:linkname directives and C "__asm__" directives to match the new scheme, as well as updating the 'gotest' driver (which makes assumptions about the correct mapping from pkgpath symbol to package name). Fixes golang/go#27534. Reviewed-on: https://go-review.googlesource.com/c/135455 From-SVN: r265510
Diffstat (limited to 'libgo/go/sync')
-rw-r--r--libgo/go/sync/atomic/atomic.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/libgo/go/sync/atomic/atomic.c b/libgo/go/sync/atomic/atomic.c
index 07a4306..6cc730f 100644
--- a/libgo/go/sync/atomic/atomic.c
+++ b/libgo/go/sync/atomic/atomic.c
@@ -9,7 +9,7 @@
#include "runtime.h"
int32_t SwapInt32 (int32_t *, int32_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.SwapInt32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.SwapInt32")
__attribute__ ((no_split_stack));
int32_t
@@ -19,7 +19,7 @@ SwapInt32 (int32_t *addr, int32_t new)
}
int64_t SwapInt64 (int64_t *, int64_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.SwapInt64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.SwapInt64")
__attribute__ ((no_split_stack));
int64_t
@@ -31,7 +31,7 @@ SwapInt64 (int64_t *addr, int64_t new)
}
uint32_t SwapUint32 (uint32_t *, uint32_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.SwapUint32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.SwapUint32")
__attribute__ ((no_split_stack));
uint32_t
@@ -41,7 +41,7 @@ SwapUint32 (uint32_t *addr, uint32_t new)
}
uint64_t SwapUint64 (uint64_t *, uint64_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.SwapUint64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.SwapUint64")
__attribute__ ((no_split_stack));
uint64_t
@@ -53,7 +53,7 @@ SwapUint64 (uint64_t *addr, uint64_t new)
}
uintptr_t SwapUintptr (uintptr_t *, uintptr_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.SwapUintptr")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.SwapUintptr")
__attribute__ ((no_split_stack));
uintptr_t
@@ -63,7 +63,7 @@ SwapUintptr (uintptr_t *addr, uintptr_t new)
}
_Bool CompareAndSwapInt32 (int32_t *, int32_t, int32_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapInt32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.CompareAndSwapInt32")
__attribute__ ((no_split_stack));
_Bool
@@ -73,7 +73,7 @@ CompareAndSwapInt32 (int32_t *val, int32_t old, int32_t new)
}
_Bool CompareAndSwapInt64 (int64_t *, int64_t, int64_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapInt64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.CompareAndSwapInt64")
__attribute__ ((no_split_stack));
_Bool
@@ -85,7 +85,7 @@ CompareAndSwapInt64 (int64_t *val, int64_t old, int64_t new)
}
_Bool CompareAndSwapUint32 (uint32_t *, uint32_t, uint32_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapUint32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.CompareAndSwapUint32")
__attribute__ ((no_split_stack));
_Bool
@@ -95,7 +95,7 @@ CompareAndSwapUint32 (uint32_t *val, uint32_t old, uint32_t new)
}
_Bool CompareAndSwapUint64 (uint64_t *, uint64_t, uint64_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapUint64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.CompareAndSwapUint64")
__attribute__ ((no_split_stack));
_Bool
@@ -107,7 +107,7 @@ CompareAndSwapUint64 (uint64_t *val, uint64_t old, uint64_t new)
}
_Bool CompareAndSwapUintptr (uintptr_t *, uintptr_t, uintptr_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapUintptr")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.CompareAndSwapUintptr")
__attribute__ ((no_split_stack));
_Bool
@@ -117,7 +117,7 @@ CompareAndSwapUintptr (uintptr_t *val, uintptr_t old, uintptr_t new)
}
int32_t AddInt32 (int32_t *, int32_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.AddInt32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.AddInt32")
__attribute__ ((no_split_stack));
int32_t
@@ -127,7 +127,7 @@ AddInt32 (int32_t *val, int32_t delta)
}
uint32_t AddUint32 (uint32_t *, uint32_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.AddUint32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.AddUint32")
__attribute__ ((no_split_stack));
uint32_t
@@ -137,7 +137,7 @@ AddUint32 (uint32_t *val, uint32_t delta)
}
int64_t AddInt64 (int64_t *, int64_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.AddInt64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.AddInt64")
__attribute__ ((no_split_stack));
int64_t
@@ -149,7 +149,7 @@ AddInt64 (int64_t *val, int64_t delta)
}
uint64_t AddUint64 (uint64_t *, uint64_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.AddUint64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.AddUint64")
__attribute__ ((no_split_stack));
uint64_t
@@ -161,7 +161,7 @@ AddUint64 (uint64_t *val, uint64_t delta)
}
uintptr_t AddUintptr (uintptr_t *, uintptr_t)
- __asm__ (GOSYM_PREFIX "sync_atomic.AddUintptr")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.AddUintptr")
__attribute__ ((no_split_stack));
uintptr_t
@@ -171,7 +171,7 @@ AddUintptr (uintptr_t *val, uintptr_t delta)
}
int32_t LoadInt32 (int32_t *addr)
- __asm__ (GOSYM_PREFIX "sync_atomic.LoadInt32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.LoadInt32")
__attribute__ ((no_split_stack));
int32_t
@@ -186,7 +186,7 @@ LoadInt32 (int32_t *addr)
}
int64_t LoadInt64 (int64_t *addr)
- __asm__ (GOSYM_PREFIX "sync_atomic.LoadInt64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.LoadInt64")
__attribute__ ((no_split_stack));
int64_t
@@ -203,7 +203,7 @@ LoadInt64 (int64_t *addr)
}
uint32_t LoadUint32 (uint32_t *addr)
- __asm__ (GOSYM_PREFIX "sync_atomic.LoadUint32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.LoadUint32")
__attribute__ ((no_split_stack));
uint32_t
@@ -218,7 +218,7 @@ LoadUint32 (uint32_t *addr)
}
uint64_t LoadUint64 (uint64_t *addr)
- __asm__ (GOSYM_PREFIX "sync_atomic.LoadUint64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.LoadUint64")
__attribute__ ((no_split_stack));
uint64_t
@@ -235,7 +235,7 @@ LoadUint64 (uint64_t *addr)
}
uintptr_t LoadUintptr (uintptr_t *addr)
- __asm__ (GOSYM_PREFIX "sync_atomic.LoadUintptr")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.LoadUintptr")
__attribute__ ((no_split_stack));
uintptr_t
@@ -250,7 +250,7 @@ LoadUintptr (uintptr_t *addr)
}
void *LoadPointer (void **addr)
- __asm__ (GOSYM_PREFIX "sync_atomic.LoadPointer")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.LoadPointer")
__attribute__ ((no_split_stack));
void *
@@ -265,7 +265,7 @@ LoadPointer (void **addr)
}
void StoreInt32 (int32_t *addr, int32_t val)
- __asm__ (GOSYM_PREFIX "sync_atomic.StoreInt32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.StoreInt32")
__attribute__ ((no_split_stack));
void
@@ -279,7 +279,7 @@ StoreInt32 (int32_t *addr, int32_t val)
}
void StoreInt64 (int64_t *addr, int64_t val)
- __asm__ (GOSYM_PREFIX "sync_atomic.StoreInt64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.StoreInt64")
__attribute__ ((no_split_stack));
void
@@ -295,7 +295,7 @@ StoreInt64 (int64_t *addr, int64_t val)
}
void StoreUint32 (uint32_t *addr, uint32_t val)
- __asm__ (GOSYM_PREFIX "sync_atomic.StoreUint32")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.StoreUint32")
__attribute__ ((no_split_stack));
void
@@ -309,7 +309,7 @@ StoreUint32 (uint32_t *addr, uint32_t val)
}
void StoreUint64 (uint64_t *addr, uint64_t val)
- __asm__ (GOSYM_PREFIX "sync_atomic.StoreUint64")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.StoreUint64")
__attribute__ ((no_split_stack));
void
@@ -325,7 +325,7 @@ StoreUint64 (uint64_t *addr, uint64_t val)
}
void StoreUintptr (uintptr_t *addr, uintptr_t val)
- __asm__ (GOSYM_PREFIX "sync_atomic.StoreUintptr")
+ __asm__ (GOSYM_PREFIX "sync..z2fatomic.StoreUintptr")
__attribute__ ((no_split_stack));
void