aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/scripts')
-rwxr-xr-xwinsup/cygwin/scripts/gendef42
-rwxr-xr-xwinsup/cygwin/scripts/gentls_offsets4
-rwxr-xr-xwinsup/cygwin/scripts/mkimport14
3 files changed, 57 insertions, 3 deletions
diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index 861a240..d60d454 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -21,6 +21,7 @@ if (!defined($cpu) || !defined($output_def)) {
die "$0: missing required option\n";
}
+my $is_aarch64 = $cpu eq 'aarch64';
my $is_x86_64 = $cpu eq 'x86_64';
# FIXME? Do other (non-32 bit) arches on Windows still use symbol prefixes?
my $sym_prefix = '';
@@ -89,7 +90,7 @@ sub fefunc {
my $func = $sym_prefix . shift;
my $fe = $sym_prefix . shift;
my $sigfe_func;
- if ($is_x86_64) {
+ if ($is_x86_64 || $is_aarch64) {
$sigfe_func = ($fe =~ /^(.*)_${func}$/)[0];
}
my $extra;
@@ -109,6 +110,15 @@ $fe:
EOF
}
+ # TODO: This is only a stub, it needs to be implemented properly for AArch64.
+ if ($is_aarch64) {
+ $res = <<EOF;
+ .extern $func
+ .global $fe
+$fe:
+EOF
+ }
+
if (!$main::first++) {
if ($is_x86_64) {
$res = <<EOF . longjmp () . $res;
@@ -340,6 +350,23 @@ stabilize_sig_stack:
.seh_endproc
EOF
}
+ # TODO: These are only stubs, they need to be implemented properly for AArch64.
+ if ($is_aarch64) {
+ $res = <<EOF . longjmp () . $res;
+ .include "tlsoffsets"
+ .text
+
+_sigfe_maybe:
+ .global _sigbe
+_sigfe:
+_sigbe:
+ .global sigdelayed
+sigdelayed:
+_sigdelayed_end:
+ .global _sigdelayed_end
+stabilize_sig_stack:
+EOF
+ }
}
return $res;
}
@@ -476,6 +503,19 @@ longjmp:
.seh_endproc
EOF
}
+ if ($is_aarch64) {
+ # TODO: These are only stubs, they need to be implemented properly for AArch64.
+ return <<EOF;
+ .globl sigsetjmp
+sigsetjmp:
+ .globl setjmp
+setjmp:
+ .globl siglongjmp
+siglongjmp:
+ .globl longjmp
+longjmp:
+EOF
+ }
}
sub cleanup(@) {
diff --git a/winsup/cygwin/scripts/gentls_offsets b/winsup/cygwin/scripts/gentls_offsets
index 040b5de..c375a61 100755
--- a/winsup/cygwin/scripts/gentls_offsets
+++ b/winsup/cygwin/scripts/gentls_offsets
@@ -62,7 +62,7 @@ start_offset=$(gawk '\
/^__CYGTLS__/ {
varname = gensub (/__CYGTLS__(\w+):/, "\\1", "g");
}
- /\s*\.long\s+/ {
+ /\s*\.(word|long)\s+/ {
if (length (varname) > 0) {
if (varname == "start_offset") {
print $2;
@@ -85,7 +85,7 @@ gawk -v start_offset="$start_offset" '\
varname = "";
}
}
- /\s*\.long\s+/ {
+ /\s*\.(word|long)\s+/ {
if (length (varname) > 0) {
if (varname == "start_offset") {
printf (".equ _cygtls.%s, -%u\n", varname, start_offset);
diff --git a/winsup/cygwin/scripts/mkimport b/winsup/cygwin/scripts/mkimport
index 9517c4e..5583099 100755
--- a/winsup/cygwin/scripts/mkimport
+++ b/winsup/cygwin/scripts/mkimport
@@ -24,6 +24,7 @@ my %import = ();
my %symfile = ();
my $is_x86_64 = ($cpu eq 'x86_64' ? 1 : 0);
+my $is_aarch64 = ($cpu eq 'aarch64' ? 1 : 0);
# FIXME? Do other (non-32 bit) arches on Windows still use symbol prefixes?
my $sym_prefix = '';
@@ -66,6 +67,19 @@ for my $f (keys %text) {
$glob_sym:
jmp *$imp_sym(%rip)
EOF
+ } elsif ($is_aarch64) {
+ print $as_fd <<EOF;
+ .text
+ .extern $imp_sym
+ .global $glob_sym
+$glob_sym:
+ # NOTE: Using instructions that are used by MSVC and LLVM. Binutils are
+ # using adrp/add/ldr-0-offset though. Please, keep it in sync with
+ # import_address implementation in winsup/cygwin/mm/malloc_wrapper.cc.
+ adrp x16, $imp_sym
+ ldr x16, [x16, #:lo12:$imp_sym]
+ br x16
+EOF
} else {
print $as_fd <<EOF;
.text