Skip to content

Commit

Permalink
For Rubinius build on aarch64-linux-gnu (Raspberry Pi 3). (#3705)
Browse files Browse the repository at this point in the history
  • Loading branch information
medols authored and brixen committed Oct 28, 2016
1 parent fe65fb6 commit 72125ab
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
25 changes: 25 additions & 0 deletions configure
Expand Up @@ -71,6 +71,7 @@ class Configure
# System settings
@libc = nil
@x86_64 = false
@aarch64 = false
@dtrace = false
@dtrace_const = false
@have_lchmod = false
Expand Down Expand Up @@ -995,6 +996,28 @@ return 0;
puts @x86_64 ? "yes" : "no"
end

def detect_aarch64
print "Checking for aarch64: "

status = check_program do |f|
src = <<-EOP
int main() {
#if defined(__ARM_ARCH_ISA_A64)
return 1;
#else
return 0;
#endif
}
EOP

f.puts src
@log.log src
end
@aarch64 = (status == 1)

puts @aarch64 ? "yes" : "no"
end

def detect_curses
@log.print "Checking curses library: "

Expand Down Expand Up @@ -1450,6 +1473,7 @@ int main(int argc, char* argv[]) {
detect_tr1
detect_tr1_hash
detect_x86
detect_aarch64
detect_features
detect_functions
detect_structures
Expand Down Expand Up @@ -1583,6 +1607,7 @@ int main(int argc, char* argv[]) {
:little_endian => @little_endian,
:sizeof_long => sizeof("long"),
:x86_64 => @x86_64,
:aarch64 => @aarch64,
:dtrace => @dtrace,
:dtrace_const => @dtrace_const,
:debug_build => @debug_build,
Expand Down
5 changes: 5 additions & 0 deletions machine/util/atomic.hpp
Expand Up @@ -41,6 +41,9 @@
#elif defined(__APPLE__)
#define APPLE_BARRIER 1

#elif defined(__ARM_ARCH_ISA_A64)
#define AARCH64_BARRIER 1

#endif

#if (defined(_LP64) || defined(__LP64__)) && (defined(__x86_64__) || defined(__amd64__))
Expand All @@ -66,6 +69,8 @@ namespace atomic {
OSMemoryBarrier();
#elif defined(X86_BARRIER)
__asm__ __volatile__ ("mfence" ::: "memory");
#elif defined(AARCH64_BARRIER)
__sync_synchronize();
#else
#error "no memory barrier implementation"
#endif
Expand Down
2 changes: 2 additions & 0 deletions vendor/libffi/src/aarch64/ffitarget.h
Expand Up @@ -50,6 +50,8 @@ typedef enum ffi_abi
#if defined (__APPLE__)
#define FFI_TARGET_SPECIFIC_VARIADIC
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_flags; unsigned aarch64_nfixedargs
#elif defined (__ARM_ARCH_ISA_A64)
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_flags; unsigned aarch64_nfixedargs
#else
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_flags
#endif
Expand Down

0 comments on commit 72125ab

Please sign in to comment.