summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2013-11-04 16:28:06 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-01-16 10:17:47 +0000
commitea75a720d1263666c9316902127a844a1b23092f (patch)
tree3a4d7dc816ece89814e500c980a3a227a37fe271
parent6a1d074bfd30d5d24faf02725542ec87509c310a (diff)
downloadmorph-richardipsum/s9461/detect_armhf.tar.gz
-rw-r--r--morphlib/util.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/morphlib/util.py b/morphlib/util.py
index 04df0633..6748fc47 100644
--- a/morphlib/util.py
+++ b/morphlib/util.py
@@ -388,6 +388,23 @@ def parse_environment_pairs(env, pairs):
return dict(env.items() + extra_env.items())
+def has_hardware_fp(): # pragma: no cover
+ '''
+ This function returns whether the binary /proc/self/exe is compiled
+ with hardfp _not_ whether the platform is hardfp.
+
+ We expect the binaries on our build platform to be compiled with
+ hardfp.
+
+ This is not ideal but at the time of writing this is the only
+ reliable way to decide whether our architecture is a hardfp
+ architecture.
+ '''
+
+ output = subprocess.check_output(['readelf', '-A', '/proc/self/exe'])
+ return 'Tag_ABI_VFP_args: VFP registers' in output
+
+
def get_host_architecture(): # pragma: no cover
'''Get the canonical Morph name for the host's architecture.'''
@@ -406,6 +423,9 @@ def get_host_architecture(): # pragma: no cover
if machine not in table:
raise morphlib.Error('Unknown host architecture %s' % machine)
+ if machine == 'armv7l' and has_hardware_fp():
+ return 'armv7lhf'
+
return table[machine]