Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
v1
  • Loading branch information
zhengyu123 committed Jul 15, 2025
commit 35576dc5711efb6dd614f3c7a71d24b966a32d94
18 changes: 17 additions & 1 deletion ddprof-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'java'
id 'maven-publish'
id 'signing'
id 'assembler'

id 'com.github.ben-manes.versions' version '0.27.0'
id 'de.undercouch.download' version '4.1.1'
Expand Down Expand Up @@ -606,7 +607,22 @@ tasks.register('javadocJar', Jar) {
}

tasks.register('asmTask', Exec) {
commandLine 'clang', '-D__aarch64__', 'src/main/asm/safefetch.S', '-o', 'build/obj/safefetch.o'
String reportedArch = System.getProperty('os.arch')
String arch
if (reportedArch == 'x86_64') {
arch = '-D__x86_64__'
} else {
arch = '-D__aarch64__'
}

String os
if (osIdentifier() == 'macos') {
os = '-D__APPLE__'
} else {
os = '-D__LINUX__'
}

commandLine 'gcc', arch, os, 'src/main/assembler/safefetch.S', '-c', 'build/obj/safefetch.o'
}

tasks.register('scanBuild', Exec) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
#ifdef __APPLE__
# macOS prefixes symbols with _
#define SYMBOL(s) _ ## s

#define DECLARE_FUNC(func) \
.globl SYMBOL(func) %% \
.private_extern SYMBOL(func) %% \
SYMBOL(func)
#else
#define SYMBOL(s) s

#define DECLARE_FUNC(func) \
.globl func %% \
.hidden func %% \
.type func, %function %% \
#define DECLARE_FUNC(func) \
.globl func ; \
.hidden func ; \
.type func, %function ; \
func
#endif // __APPLE__

#if defined(__x86_64__)
.text
Expand Down
Loading