From d27e6fd532200873fe8cc23a155360114fe26110 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 25 Aug 2009 11:54:15 -0400 Subject: PR4186 cont'd: option #2: standardize on kernel ARCH/SUBARCH throughout * main.cxx (main): Perform equivalent sed by hand on uname()->machine. * stap.1.in: Clarify -a ARCH slightly. * tapsets.cxx (validate_module_elf): Accept "arm*"for EM_ARM. * tapset/**, testsuite/**: Removed/collapsed "i386"/"i686" branches, renamed "ppc64"->"powerpc" and "s390x"->"s390". --- main.cxx | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index 6c7dc315..9887f2b7 100644 --- a/main.cxx +++ b/main.cxx @@ -462,12 +462,25 @@ main (int argc, char * const argv []) s.kernel_release = string (buf.release); s.kernel_build_tree = "/lib/modules/" + s.kernel_release + "/build"; - // Copy logic from coreutils uname (uname -i) to squash i?86 -> i386 - if (strlen(buf.machine)==4 && buf.machine[0] == 'i' && - buf.machine[2] == '8' && buf.machine[3] == '6') - buf.machine[1] = '3'; - - s.architecture = string (buf.machine); + // PR4186: Copy logic from coreutils uname (uname -i) to squash + // i?86->i386. Actually, copy logic from linux top-level Makefile + // to squash uname -m -> $(SUBARCH). + + string machine = buf.machine; + if (machine == "i486") machine = "i386"; + else if (machine == "i586") machine = "i386"; + else if (machine == "i686") machine = "i386"; + else if (machine == "sun4u") machine = "sparc64"; + else if (machine.substr(0,3) == "arm") machine = "arm"; + else if (machine == "sa110") machine = "arm"; + else if (machine == "s390x") machine = "s390"; + else if (machine.substr(0,3) == "ppc") machine = "powerpc"; + else if (machine.substr(0,4) == "mips") machine = "mips"; + else if (machine.substr(0,3) == "sh2") machine = "sh"; + else if (machine.substr(0,3) == "sh3") machine = "sh"; + else if (machine.substr(0,3) == "sh4") machine = "sh"; + + s.architecture = machine; for (unsigned i=0; i<5; i++) s.perpass_verbose[i]=0; s.timing = false; s.guru_mode = false; @@ -875,7 +888,7 @@ main (int argc, char * const argv []) // Warn in case the target kernel release doesn't match the running one. if (s.last_pass > 4 && (string(buf.release) != s.kernel_release || - string(buf.machine) != s.architecture)) + machine != s.architecture)) // NB: squashed ARCH by PR4186 logic { if(! s.suppress_warnings) cerr << "WARNING: kernel release/architecture mismatch with host forces last-pass 4." << endl; -- cgit