summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:35 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:35 -0500
commit4731979ab092e6324e563d5738387e6ce21c3812 (patch)
tree1b289df0060aacb8eed4d533d54979e3b57b8985
parentb7827a5aaaf501f494947e2307ced9a78e2bc220 (diff)
downloadgem5-4731979ab092e6324e563d5738387e6ce21c3812.tar.xz
scons: Fix libelf linking errors when using clang/llvm
This patch fixes a linking error that occurs when using clang/llvm in combination with older versions of glibc. The fix involves adding -std=gnu89 to the command line when compiling libelf as clang defaults to c99, causing issues with the symbols in sysmacros.h being defined multiple times.
-rw-r--r--ext/libelf/SConscript5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/libelf/SConscript b/ext/libelf/SConscript
index 56983d12f..ac91a3025 100644
--- a/ext/libelf/SConscript
+++ b/ext/libelf/SConscript
@@ -100,6 +100,11 @@ if m4env['GCC']:
'-Wno-implicit-function-declaration'])
if m4env['CLANG']:
m4env.Append(CCFLAGS=['-Wno-initializer-overrides', '-Wno-pointer-sign'])
+ # clang defaults to c99 (while gcc defaults to gnu89) and there is a
+ # difference in the handling of inlining functions which causes
+ # linking problems with multiple definitions of the symbols in
+ # sysmacros.h for older versions of glibc
+ m4env.Append(CCFLAGS=['-std=gnu89'])
m4env.Append(CCFLAGS=['-Wno-implicit'])
del m4env['CPPPATH']