summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFupan Li <fupan.li@windriver.com>2017-09-29 19:24:55 -0700
committerMaxin B. John <maxin.john@intel.com>2017-10-02 17:10:07 +0300
commit6801f6d4e19c88dabd5a02dfbbf69a2dcc8e079c (patch)
tree9d408e4c3228cc698d6979e07a8e19c438e94885
parent60a3b62bddf69ec114f0ffdb5ca8ac7b5b37716e (diff)
downloadmeta-java-6801f6d4e19c88dabd5a02dfbbf69a2dcc8e079c.tar.gz
openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6
The patch recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-adlc-flags.patch had tried to fix this issue, and it tried to filter out the TARGET_FLAGS/TARGET_ CXXFLGAS, but for the flags such as "-fno-lifetime-dse" was added to CFLAGS/CXXFLAGS, directly, thus that patch failed to filter it out. To fix this issue, it's better to add those GCC version specific flags to BUILD_CFLAGS/ BUILD_CXXFLAGS and TARGET_CFLAGS/TARGET_CXXFLAGS separatedly, thus that patch can work as expected. Signed-off-by: Fupan Li <fupan.li@windriver.com> Signed-off-by: Maxin B. John <maxin.john@intel.com>
-rw-r--r--recipes-core/openjdk/openjdk-8-common.inc36
1 files changed, 24 insertions, 12 deletions
diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
index 83828e1..c609232 100644
--- a/recipes-core/openjdk/openjdk-8-common.inc
+++ b/recipes-core/openjdk/openjdk-8-common.inc
@@ -231,27 +231,39 @@ FLAGS_GCC7 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
231# version is and only add the flags that are appropriate for that GCC 231# version is and only add the flags that are appropriate for that GCC
232# version. 232# version.
233 233
234def version_specific_cflags(d): 234def version_specific_cflags(d, toolchain):
235 extraflags = None 235 extraflags = None
236 version = None 236 version = None
237 237
238 if bb.data.inherits_class('native', d): 238 from subprocess import Popen, PIPE
239 from subprocess import Popen, PIPE 239 cmd = d.expand('%s -dumpversion' % toolchain ).split()
240 cc = Popen(cmd, stdout=PIPE, stderr=PIPE)
241 version = cc.communicate()[0].decode('utf-8')[0]
240 242
241 cmd = d.expand('${CC} -dumpversion').split() 243 if version.isdigit():
242 cc = Popen(cmd, stdout=PIPE, stderr=PIPE) 244 extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or ''
243 version = cc.communicate()[0].decode('utf-8')[0] 245 return extraflags
246 return ''
247
248python __anonymous() {
249 if bb.data.inherits_class('native', d):
250 toolchain = d.getVar('CC', True)
251 extraflags = version_specific_cflags(d, toolchain)
252 d.appendVar("CFLAGS", ' ' + extraflags)
253 d.appendVar("CXXFLAGS", ' ' + extraflags)
244 else: 254 else:
245 # in the cross case, trust that GCCVERSION is correct. This won't 255 # in the cross case, trust that GCCVERSION is correct. This won't
246 # work if the native toolchain is Clang, but as of this writing that 256 # work if the native toolchain is Clang, but as of this writing that
247 # doesn't work anyway. 257 # doesn't work anyway.
248 version = d.getVar('GCCVERSION', expand=True)[0] 258 version = d.getVar('GCCVERSION', expand=True)[0]
249
250 if version.isdigit():
251 extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' 259 extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or ''
252 return extraflags 260 d.appendVar("TARGET_CFLAGS", ' ' + extraflags)
253 return '' 261 d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags)
262
263 toolchain = d.getVar('BUILD_CC', True)
264 extraflags = version_specific_cflags(d, toolchain)
265 d.appendVar("BUILD_CFLAGS", ' ' + extraflags)
266 d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags)
267}
254 268
255CFLAGS_append = " ${@version_specific_cflags(d)}"
256CXXFLAGS_append = " ${@version_specific_cflags(d)}"
257CXX_append = " -std=gnu++98" 269CXX_append = " -std=gnu++98"