Skip to content

Commit 6876abd

Browse files
jbmstru
authored andcommitted
[Support/BLAKE3] Rename blake3_* -> llvm_blake3_* to avoid symbol collisions
While some blake3 symbols are already prefixed, a number of symbols with hidden visibility have been left without an `llvm_` prefix. This results in symbol collisions when statically linking llvm into a binary that also uses the external blake3 library. Reviewed By: akyrtzi, MaskRay Differential Revision: https://reviews.llvm.org/D143981 (cherry picked from commit 26662ac)
1 parent 3aa210b commit 6876abd

14 files changed

+118
-69
lines changed

llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#if defined(__x86_64__)
22

3+
#include "llvm_blake3_prefix.h"
4+
35
#if defined(__ELF__) && defined(__linux__)
46
.section .note.GNU-stack,"",%progbits
57
#endif

llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_gnu.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "llvm_blake3_prefix.h"
2+
13
.intel_syntax noprefix
24
.global _blake3_hash_many_avx2
35
.global blake3_hash_many_avx2

llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_windows_msvc.asm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
public _blake3_hash_many_avx2
2-
public blake3_hash_many_avx2
1+
public _llvm_blake3_hash_many_avx2
2+
public llvm_blake3_hash_many_avx2
33

44
_TEXT SEGMENT ALIGN(16) 'CODE'
55

66
ALIGN 16
7-
blake3_hash_many_avx2 PROC
8-
_blake3_hash_many_avx2 PROC
7+
llvm_blake3_hash_many_avx2 PROC
8+
_llvm_blake3_hash_many_avx2 PROC
99
push r15
1010
push r14
1111
push r13
@@ -1785,8 +1785,8 @@ endroundloop1:
17851785
vmovdqu xmmword ptr [rbx+10H], xmm1
17861786
jmp unwind
17871787

1788-
_blake3_hash_many_avx2 ENDP
1789-
blake3_hash_many_avx2 ENDP
1788+
_llvm_blake3_hash_many_avx2 ENDP
1789+
llvm_blake3_hash_many_avx2 ENDP
17901790
_TEXT ENDS
17911791

17921792
_RDATA SEGMENT READONLY PAGE ALIAS(".rdata") 'CONST'

llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#if defined(__x86_64__)
22

3+
#include "llvm_blake3_prefix.h"
4+
35
#if defined(__ELF__) && defined(__linux__)
46
.section .note.GNU-stack,"",%progbits
57
#endif

llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_gnu.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "llvm_blake3_prefix.h"
2+
13
.intel_syntax noprefix
24

35
.global _blake3_hash_many_avx512

llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_windows_msvc.asm

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
public _blake3_hash_many_avx512
2-
public blake3_hash_many_avx512
3-
public blake3_compress_in_place_avx512
4-
public _blake3_compress_in_place_avx512
5-
public blake3_compress_xof_avx512
6-
public _blake3_compress_xof_avx512
1+
public _llvm_blake3_hash_many_avx512
2+
public llvm_blake3_hash_many_avx512
3+
public llvm_blake3_compress_in_place_avx512
4+
public _llvm_blake3_compress_in_place_avx512
5+
public llvm_blake3_compress_xof_avx512
6+
public _llvm_blake3_compress_xof_avx512
77

88
_TEXT SEGMENT ALIGN(16) 'CODE'
99

1010
ALIGN 16
11-
blake3_hash_many_avx512 PROC
12-
_blake3_hash_many_avx512 PROC
11+
llvm_blake3_hash_many_avx512 PROC
12+
_llvm_blake3_hash_many_avx512 PROC
1313
push r15
1414
push r14
1515
push r13
@@ -2404,12 +2404,12 @@ endroundloop1:
24042404
vmovdqu xmmword ptr [rbx+10H], xmm1
24052405
jmp unwind
24062406

2407-
_blake3_hash_many_avx512 ENDP
2408-
blake3_hash_many_avx512 ENDP
2407+
_llvm_blake3_hash_many_avx512 ENDP
2408+
llvm_blake3_hash_many_avx512 ENDP
24092409

24102410
ALIGN 16
2411-
blake3_compress_in_place_avx512 PROC
2412-
_blake3_compress_in_place_avx512 PROC
2411+
llvm_blake3_compress_in_place_avx512 PROC
2412+
_llvm_blake3_compress_in_place_avx512 PROC
24132413
sub rsp, 72
24142414
vmovdqa xmmword ptr [rsp], xmm6
24152415
vmovdqa xmmword ptr [rsp+10H], xmm7
@@ -2498,12 +2498,12 @@ _blake3_compress_in_place_avx512 PROC
24982498
vmovdqa xmm9, xmmword ptr [rsp+30H]
24992499
add rsp, 72
25002500
ret
2501-
_blake3_compress_in_place_avx512 ENDP
2502-
blake3_compress_in_place_avx512 ENDP
2501+
_llvm_blake3_compress_in_place_avx512 ENDP
2502+
llvm_blake3_compress_in_place_avx512 ENDP
25032503

25042504
ALIGN 16
2505-
blake3_compress_xof_avx512 PROC
2506-
_blake3_compress_xof_avx512 PROC
2505+
llvm_blake3_compress_xof_avx512 PROC
2506+
_llvm_blake3_compress_xof_avx512 PROC
25072507
sub rsp, 72
25082508
vmovdqa xmmword ptr [rsp], xmm6
25092509
vmovdqa xmmword ptr [rsp+10H], xmm7
@@ -2597,8 +2597,8 @@ _blake3_compress_xof_avx512 PROC
25972597
vmovdqa xmm9, xmmword ptr [rsp+30H]
25982598
add rsp, 72
25992599
ret
2600-
_blake3_compress_xof_avx512 ENDP
2601-
blake3_compress_xof_avx512 ENDP
2600+
_llvm_blake3_compress_xof_avx512 ENDP
2601+
llvm_blake3_compress_xof_avx512 ENDP
26022602

26032603
_TEXT ENDS
26042604

llvm/lib/Support/BLAKE3/blake3_impl.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,7 @@
1111
// For \p LLVM_LIBRARY_VISIBILITY
1212
#include "llvm/Support/Compiler.h"
1313

14-
// Remove the 'llvm_' prefix for the rest of the internal implementation.
15-
#define BLAKE3_VERSION_STRING LLVM_BLAKE3_VERSION_STRING
16-
#define BLAKE3_KEY_LEN LLVM_BLAKE3_KEY_LEN
17-
#define BLAKE3_OUT_LEN LLVM_BLAKE3_OUT_LEN
18-
#define BLAKE3_BLOCK_LEN LLVM_BLAKE3_BLOCK_LEN
19-
#define BLAKE3_CHUNK_LEN LLVM_BLAKE3_CHUNK_LEN
20-
#define BLAKE3_MAX_DEPTH LLVM_BLAKE3_MAX_DEPTH
21-
#define blake3_hasher llvm_blake3_hasher
22-
#define blake3_chunk_state llvm_blake3_chunk_state
14+
#include "llvm_blake3_prefix.h"
2315

2416
// internal flags
2517
enum blake3_flags {

llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#if defined(__x86_64__)
22

3+
#include "llvm_blake3_prefix.h"
4+
35
#if defined(__ELF__) && defined(__linux__)
46
.section .note.GNU-stack,"",%progbits
57
#endif

llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_gnu.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "llvm_blake3_prefix.h"
2+
13
.intel_syntax noprefix
24
.global blake3_hash_many_sse2
35
.global _blake3_hash_many_sse2

llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_msvc.asm

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
public _blake3_hash_many_sse2
2-
public blake3_hash_many_sse2
3-
public blake3_compress_in_place_sse2
4-
public _blake3_compress_in_place_sse2
5-
public blake3_compress_xof_sse2
6-
public _blake3_compress_xof_sse2
1+
public _llvm_blake3_hash_many_sse2
2+
public llvm_blake3_hash_many_sse2
3+
public llvm_blake3_compress_in_place_sse2
4+
public _llvm_blake3_compress_in_place_sse2
5+
public llvm_blake3_compress_xof_sse2
6+
public _llvm_blake3_compress_xof_sse2
77

88
_TEXT SEGMENT ALIGN(16) 'CODE'
99

1010
ALIGN 16
11-
blake3_hash_many_sse2 PROC
12-
_blake3_hash_many_sse2 PROC
11+
llvm_blake3_hash_many_sse2 PROC
12+
_llvm_blake3_hash_many_sse2 PROC
1313
push r15
1414
push r14
1515
push r13
@@ -2034,11 +2034,11 @@ endroundloop1:
20342034
movups xmmword ptr [rbx], xmm0
20352035
movups xmmword ptr [rbx+10H], xmm1
20362036
jmp unwind
2037-
_blake3_hash_many_sse2 ENDP
2038-
blake3_hash_many_sse2 ENDP
2037+
_llvm_blake3_hash_many_sse2 ENDP
2038+
llvm_blake3_hash_many_sse2 ENDP
20392039

2040-
blake3_compress_in_place_sse2 PROC
2041-
_blake3_compress_in_place_sse2 PROC
2040+
llvm_blake3_compress_in_place_sse2 PROC
2041+
_llvm_blake3_compress_in_place_sse2 PROC
20422042
sub rsp, 120
20432043
movdqa xmmword ptr [rsp], xmm6
20442044
movdqa xmmword ptr [rsp+10H], xmm7
@@ -2164,12 +2164,12 @@ _blake3_compress_in_place_sse2 PROC
21642164
movdqa xmm15, xmmword ptr [rsp+60H]
21652165
add rsp, 120
21662166
ret
2167-
_blake3_compress_in_place_sse2 ENDP
2168-
blake3_compress_in_place_sse2 ENDP
2167+
_llvm_blake3_compress_in_place_sse2 ENDP
2168+
llvm_blake3_compress_in_place_sse2 ENDP
21692169

21702170
ALIGN 16
2171-
blake3_compress_xof_sse2 PROC
2172-
_blake3_compress_xof_sse2 PROC
2171+
llvm_blake3_compress_xof_sse2 PROC
2172+
_llvm_blake3_compress_xof_sse2 PROC
21732173
sub rsp, 120
21742174
movdqa xmmword ptr [rsp], xmm6
21752175
movdqa xmmword ptr [rsp+10H], xmm7
@@ -2302,8 +2302,8 @@ _blake3_compress_xof_sse2 PROC
23022302
movdqa xmm15, xmmword ptr [rsp+60H]
23032303
add rsp, 120
23042304
ret
2305-
_blake3_compress_xof_sse2 ENDP
2306-
blake3_compress_xof_sse2 ENDP
2305+
_llvm_blake3_compress_xof_sse2 ENDP
2306+
llvm_blake3_compress_xof_sse2 ENDP
23072307

23082308
_TEXT ENDS
23092309

0 commit comments

Comments
 (0)