[oe] [meta-java][PATCH 1/2] binaries run by qemu: link with -static, force ld.bfd

Max Krummenacher max.oss.09 at gmail.com
Tue Jan 20 15:14:23 UTC 2015


For machines using DEFAULTTUNE = "armv7ahf" or DEFAULTTUNE = "armv7athf" a build
of openjdk-7 fails with segmentation faults during the qemu-arm runs.

e.g.
Segmentation fault (core dumped) | qemu-arm -cpu cortex-a8 -s 2097152
  -L .../sysroots/colibri-t20 \
  -E LD_LIBRARY_PATH=.../sysroots/colibri-t20/lib ./mkbc - bytecodes_arm.s

I found that qemu-arm can not execute any binary which is compiled with the
resulting compiler and is linked with the gold linker and the -static flag.
Even a simple hello world program does not work. When executing that
hello world on the real hardware it also generates a segmentation fault.

Removing the -static flag or forcing the bfd linker fixed this.

Note that other machines, colibri-t30 or i.mx6 based ones with neon but
otherwise identical setup do not suffer from the issue.
DEFAULTTUNE = "armv7athf-neon" works.

While at it convert the sizer call for openjdk-7 used when building xawt
also to use -static even though the code is currently disabled.

Further details:
http://lists.openembedded.org/pipermail/openembedded-devel/2015-January/099795.html

Signed-off-by: Max Krummenacher <max.oss.09 at gmail.com>
---
 recipes-core/openjdk/openjdk-6-6b24/icedtea-zero-hotspotfix.patch  | 2 +-
 recipes-core/openjdk/openjdk-6-6b27/icedtea-crosscompile-fix.patch | 2 +-
 recipes-core/openjdk/openjdk-6-6b32/icedtea-crosscompile-fix.patch | 2 +-
 recipes-core/openjdk/openjdk-6-6b32/icedtea-zero-hotspotfix.patch  | 2 +-
 recipes-core/openjdk/openjdk-6/fix_hotspot_crosscompile.patch      | 2 +-
 .../openjdk/openjdk-7-25b30/icedtea-crosscompile-fix.patch         | 7 ++++++-
 recipes-core/openjdk/openjdk-7-25b30/icedtea-zero-hotspotfix.patch | 4 ++--
 7 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/recipes-core/openjdk/openjdk-6-6b24/icedtea-zero-hotspotfix.patch b/recipes-core/openjdk/openjdk-6-6b24/icedtea-zero-hotspotfix.patch
index ec10e69..ba738d6 100644
--- a/recipes-core/openjdk/openjdk-6-6b24/icedtea-zero-hotspotfix.patch
+++ b/recipes-core/openjdk/openjdk-6-6b24/icedtea-zero-hotspotfix.patch
@@ -35,7 +35,7 @@ Index: openjdk/hotspot/make/linux/makefiles/zeroshark.make
  	@echo Compiling offset generator
  	$(QUIETLY) $(REMOVE_TARGET)
 -	$(CC_COMPILE) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) -static -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) -static -fuse-ld=bfd -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
  
  endif
  
diff --git a/recipes-core/openjdk/openjdk-6-6b27/icedtea-crosscompile-fix.patch b/recipes-core/openjdk/openjdk-6-6b27/icedtea-crosscompile-fix.patch
index 9a60bd6..0723954 100644
--- a/recipes-core/openjdk/openjdk-6-6b27/icedtea-crosscompile-fix.patch
+++ b/recipes-core/openjdk/openjdk-6-6b27/icedtea-crosscompile-fix.patch
@@ -463,7 +463,7 @@ index 1fa311d..f3d06ad 100644
  $(SIZERS): $(SIZERS_C) 
  	$(prep-target)
 -	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
-+	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -static -o $@ $(SIZER)$(suffix $@).c
++	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -static -fuse-ld=bfd -o $@ $(SIZER)$(suffix $@).c
  
  $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
  	$(prep-target)
diff --git a/recipes-core/openjdk/openjdk-6-6b32/icedtea-crosscompile-fix.patch b/recipes-core/openjdk/openjdk-6-6b32/icedtea-crosscompile-fix.patch
index 3b34160..067b356 100644
--- a/recipes-core/openjdk/openjdk-6-6b32/icedtea-crosscompile-fix.patch
+++ b/recipes-core/openjdk/openjdk-6-6b32/icedtea-crosscompile-fix.patch
@@ -247,7 +247,7 @@ index 1fa311d..f3d06ad 100644
  $(SIZERS): $(SIZERS_C) 
  	$(prep-target)
 -	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
-+	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -static -o $@ $(SIZER)$(suffix $@).c
++	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -static -fuse-ld=bfd -o $@ $(SIZER)$(suffix $@).c
  
  $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
  	$(prep-target)
diff --git a/recipes-core/openjdk/openjdk-6-6b32/icedtea-zero-hotspotfix.patch b/recipes-core/openjdk/openjdk-6-6b32/icedtea-zero-hotspotfix.patch
index 91ace0e..f14deaf 100644
--- a/recipes-core/openjdk/openjdk-6-6b32/icedtea-zero-hotspotfix.patch
+++ b/recipes-core/openjdk/openjdk-6-6b32/icedtea-zero-hotspotfix.patch
@@ -35,7 +35,7 @@ index c2a1484..f460d85 100644
  	@echo Compiling offset generator
  	$(QUIETLY) $(REMOVE_TARGET)
 -	$(CC_COMPILE) $(CFLAGS) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) $(CFLAGS) -static -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) $(CFLAGS) -static -fuse-ld=bfd -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
  
  endif
  
diff --git a/recipes-core/openjdk/openjdk-6/fix_hotspot_crosscompile.patch b/recipes-core/openjdk/openjdk-6/fix_hotspot_crosscompile.patch
index 38fb191..3d4a68c 100644
--- a/recipes-core/openjdk/openjdk-6/fix_hotspot_crosscompile.patch
+++ b/recipes-core/openjdk/openjdk-6/fix_hotspot_crosscompile.patch
@@ -88,7 +88,7 @@ Index: icedtea6-1.8/ports/hotspot/make/linux/makefiles/zeroshark.make
  	@echo Compiling offset generator
  	$(QUIETLY) $(REMOVE_TARGET)
 -	$(CC_COMPILE) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) -static -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) -static -fuse-ld=bfd -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
  
  endif
  
diff --git a/recipes-core/openjdk/openjdk-7-25b30/icedtea-crosscompile-fix.patch b/recipes-core/openjdk/openjdk-7-25b30/icedtea-crosscompile-fix.patch
index 39436a5..0c6aac4 100644
--- a/recipes-core/openjdk/openjdk-7-25b30/icedtea-crosscompile-fix.patch
+++ b/recipes-core/openjdk/openjdk-7-25b30/icedtea-crosscompile-fix.patch
@@ -319,7 +319,7 @@ index 53d31f3..183c063 100644
  endif # 32
  endif # !macosx
  endif # solaris
-@@ -337,11 +317,7 @@ WRAPPER_GENERATOR_TEMPDIR=$(TEMPDIR)/sun/awt/X11/generator
+@@ -337,15 +321,11 @@ WRAPPER_GENERATOR_TEMPDIR=$(TEMPDIR)/sun/awt/X11/generator
  WRAPPER_GENERATOR_CLASS=$(WRAPPER_GENERATOR_TEMPDIR)/WrapperGenerator.class 
  XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt
  
@@ -331,6 +331,11 @@ index 53d31f3..183c063 100644
  
  $(SIZERS): $(SIZERS_C) 
  	$(prep-target)
+-	$(SIZERS_CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
++	$(SIZERS_CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -static -fuse-ld=bfd -o $@ $(SIZER)$(suffix $@).c
+ 
+ $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
+ 	$(prep-target)
 @@ -358,6 +334,16 @@ $(SIZERS_C): $(WRAPPER_GENERATOR_CLASS) $(XLIBTYPES)
  	    $(SIZER_DIR) $(XLIBTYPES) "sizer" $(subst .,,$(suffix $(basename $@)))
  
diff --git a/recipes-core/openjdk/openjdk-7-25b30/icedtea-zero-hotspotfix.patch b/recipes-core/openjdk/openjdk-7-25b30/icedtea-zero-hotspotfix.patch
index 83dba2b..784f2de 100644
--- a/recipes-core/openjdk/openjdk-7-25b30/icedtea-zero-hotspotfix.patch
+++ b/recipes-core/openjdk/openjdk-7-25b30/icedtea-zero-hotspotfix.patch
@@ -25,13 +25,13 @@ index c2a1484..156bdd0 100644
  mkbc:	$(GAMMADIR)/tools/mkbc.c
  	@echo Compiling mkbc tool
 -	$(CC_COMPILE) -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) -static -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) -static -fuse-ld=bfd -o $@ $< $(COMPILE_DONE)
  
  mkoffsets:	asm_helper.cpp
  	@echo Compiling offset generator
  	$(QUIETLY) $(REMOVE_TARGET)
 -	$(CC_COMPILE) $(CFLAGS) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) $(CFLAGS) -DSTATIC_OFFSETS -static -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) $(CFLAGS) -static -fuse-ld=bfd -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
  
  endif
  
-- 
1.9.3




More information about the Openembedded-devel mailing list