diff --git a/Golang-ppc64x-asm-Reference.md b/Golang-ppc64x-asm-Reference.md index 1f97e01..9f50573 100644 --- a/Golang-ppc64x-asm-Reference.md +++ b/Golang-ppc64x-asm-Reference.md @@ -141,3 +141,20 @@ The typical CPUs for ppc64 (PowerPC 64-bit Big Endian) and ppc64le (PowerPC 64-b For **ppc64**, the IBM POWER5, POWER6, POWER7, and POWER8 processors are commonly used. These processors are often found in high-performance computing environments, enterprise servers, and similar applications. For **ppc64le**, the IBM POWER8 and POWER9 processors are typically used. The switch to little-endian mode in these processors was made to improve compatibility with software written for x86_64, which also uses little-endian byte order. These processors are used in a variety of applications, from supercomputers to servers for cloud and data analytics workloads. + +# what's the difference between function definition in golang asm with funcname<>(SB), funcname(SB) and ·funcname(SB)? +In Go assembly, the naming conventions for function definitions are as follows: + +1. funcname(SB): This is a global function named funcname. The (SB) suffix refers to the static base pointer, which is used to reference global symbols. This function can be called from anywhere in the program. + +1. funcname<>(SB): This is a file-local function named funcname. The <> makes the function local to the file it's defined in. Other files in the same package cannot call this function directly. + +1. ·funcname(SB): This is a special notation used in the Plan 9 assembly syntax that Go uses. The · prefix denotes a global symbol. This function can be called from anywhere in the program. It's essentially the same as funcname(SB). + +我感觉AI回答的不是十分正确,·funcname(SB)是最常用到的,感觉更应该是package level function。 + +In Go assembly, the · symbol is used to denote a global symbol. When you define a global symbol like ·mask, it's expected to be unique in the entire program. If you try to define ·mask more than once, you'll get a duplicate symbol definition error. + +On the other hand, mask<> is a local symbol. Local symbols are only visible within the file they are defined in. You can have a mask<> symbol in each assembly file in your program, and they won't conflict with each other because they are not visible outside their own files. + +So, the difference comes from the scope of the symbols. Global symbols like ·mask are visible throughout the entire program and must be unique. Local symbols like mask<> are only visible within their own file and can be defined in each file without causing conflicts.