binaries run by qemu: link with -static, force ld.bfd
PATCH 1/2 binaries run by qemu: link with -static, force ld.bfd
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
--- 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(-)
recipes-core/openjdk/openjdk-6-6b24/icedtea-zero-hotspotfix.patch +1 -1
@@ -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
recipes-core/openjdk/openjdk-6-6b27/icedtea-crosscompile-fix.patch +1 -1
@@ -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)
recipes-core/openjdk/openjdk-6-6b32/icedtea-crosscompile-fix.patch +1 -1
@@ -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)
recipes-core/openjdk/openjdk-6-6b32/icedtea-zero-hotspotfix.patch +1 -1
@@ -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
recipes-core/openjdk/openjdk-6/fix_hotspot_crosscompile.patch +1 -1
@@ -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
recipes-core/openjdk/openjdk-7-25b30/icedtea-crosscompile-fix.patch +6 -1
@@ -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 $@)))
recipes-core/openjdk/openjdk-7-25b30/icedtea-zero-hotspotfix.patch +2 -2
@@ -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
Signature · 1 line
1.9.3
PATCH 2/2 Revert "openjdk: Fix QEMU call to use sysroot for libs"
This reverts commit ab51e51d9a9a51bedd19de09bcba4ce830dfc5e7.
Using an oe setup with ptest enabled makes qemu never to return due to testfiles staged by udev in the sysroot
See also:
http://lists.openembedded.org/pipermail/openembedded-core/2014-September/097098.html
All binaries compiled for qemu are now linked with -static. The -L, -E parameters pointing to the sysroot and dynamic linker are not needed anymore and removel works around the issue.
Further details:
http://lists.openembedded.org/pipermail/openembedded-devel/2015-January/099795.html
--- recipes-core/openjdk/openjdk-common.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-core/openjdk/openjdk-common.inc +1 -1
@@ -72,6 +72,6 @@ export WANT_LLVM_RELEASE = "2.8" export LLVM_CONFIGURE_ARCH="${@get_llvm_configure_arch(d)}" # Large stack is required at least on x86_64 host, otherwise random segfaults appear: -QEMU = "${@qemu_target_binary(d)} ${QEMU_OPTIONS} -s 2097152 -L ${STAGING_DIR_TARGET} -E LD_LIBRARY_PATH=${STAGING_BASELIBDIR}" +QEMU = "${@qemu_target_binary(d)} ${QEMU_OPTIONS} -s 2097152" EXTRA_OEMAKE += 'QEMU="${QEMU}"'
Signature · 1 line
1.9.3