aboutsummaryrefslogtreecommitdiff
path: root/winsup/utils
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/dumper.cc4
-rw-r--r--winsup/utils/kill.cc4
-rw-r--r--winsup/utils/mingw/cygcheck.cc14
-rw-r--r--winsup/utils/profiler.cc11
4 files changed, 22 insertions, 11 deletions
diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc
index 994f9b6..b3151e6 100644
--- a/winsup/utils/dumper.cc
+++ b/winsup/utils/dumper.cc
@@ -700,8 +700,10 @@ dumper::init_core_dump ()
{
bfd_init ();
-#ifdef __x86_64__
+#if defined(__x86_64__)
const char *target = "elf64-x86-64";
+#elif defined(__aarch64__)
+ const char *target = "elf64-aarch64";
#else
#error unimplemented for this target
#endif
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
index bcabcd4..1e6ab5c 100644
--- a/winsup/utils/kill.cc
+++ b/winsup/utils/kill.cc
@@ -372,7 +372,9 @@ main (int argc, char **argv)
case '?':
if (gotasig) /* this is a negative pid, go ahead */
{
- --optind;
+ /* Reset optind because it points to the next argument if and
+ only if the pid has one digit. */
+ optind = av - argv;
goto out;
}
optreset = 1;
diff --git a/winsup/utils/mingw/cygcheck.cc b/winsup/utils/mingw/cygcheck.cc
index 89a08e5..d17909b 100644
--- a/winsup/utils/mingw/cygcheck.cc
+++ b/winsup/utils/mingw/cygcheck.cc
@@ -654,16 +654,22 @@ dll_info (const char *path, HANDLE fh, int lvl, int recurse)
WORD arch = get_word (fh, pe_header_offset + 4);
if (GetLastError () != NO_ERROR)
display_error ("get_word");
-#ifdef __x86_64__
+#if defined(__x86_64__)
if (arch != IMAGE_FILE_MACHINE_AMD64)
{
puts (verbose ? " (not x86_64 dll)" : "\n");
return;
}
- int base_off = 108;
+#elif defined (__aarch64__)
+ if (arch != IMAGE_FILE_MACHINE_ARM64)
+ {
+ puts (verbose ? " (not aarch64 dll)" : "\n");
+ return;
+ }
#else
#error unimplemented for this target
#endif
+ int base_off = 108;
int opthdr_ofs = pe_header_offset + 4 + 20;
unsigned short v[6];
@@ -2108,8 +2114,10 @@ static const char safe_chars[] = "$-_.!*'(),";
static const char grep_base_url[] =
"http://cygwin.com/cgi-bin2/package-grep.cgi?text=1&grep=";
-#ifdef __x86_64__
+#if defined(__x86_64__)
#define ARCH_STR "&arch=x86_64"
+#elif defined(__aarch64__)
+#define ARCH_STR "&arch=aarch64"
#else
#error unimplemented for this target
#endif
diff --git a/winsup/utils/profiler.cc b/winsup/utils/profiler.cc
index b5ce16c..04c6b3e 100644
--- a/winsup/utils/profiler.cc
+++ b/winsup/utils/profiler.cc
@@ -33,6 +33,7 @@ typedef uint16_t u_int16_t; // Non-standard sized type needed by ancient gmon.h
#define NO_GLOBALS_H
#include "gmon.h"
#include "path.h"
+#include "register.h"
/* Undo this #define from winsup.h. */
#ifdef ExitThread
@@ -193,11 +194,7 @@ sample (CONTEXT *context, HANDLE h)
return 0ULL;
}
else
-#ifdef __x86_64__
- return context->Rip;
-#else
-#error unimplemented for this target
-#endif
+ return context->_CX_instPtr;
}
void
@@ -503,8 +500,10 @@ find_text_section (LPVOID base, HANDLE h)
read_child ((void *) &machine, sizeof (machine),
&inth->FileHeader.Machine, h);
-#ifdef __x86_64__
+#if defined(__x86_64__)
if (machine != IMAGE_FILE_MACHINE_AMD64)
+#elif defined(__aarch64__)
+ if (machine != IMAGE_FILE_MACHINE_ARM64)
#else
#error unimplemented for this target
#endif