Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Mar 2020 00:47:58 +0000 (UTC)
From:      Diane Bruce <db@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r528752 - head/emulators/qemu-user-static-devel/files
Message-ID:  <202003200047.02K0lw4i013528@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: db
Date: Fri Mar 20 00:47:58 2020
New Revision: 528752
URL: https://svnweb.freebsd.org/changeset/ports/528752

Log:
  Fix emulators/qemu-sbruno build with lld 10.0.0
  
  As reported in bug 244251, with clang and lld 10.0.0 the emulators/qemu-sbruno port fails in the configure stage:
  
  ===>  Configuring for qemu-user-static-2.11.50.g20191211_3
  
  ERROR: We need to link the QEMU user mode binaries at a
         specific text address. Unfortunately your linker
         doesn't support either the -Ttext-segment option or
         printing the default linker script with --verbose.
         If you don't want the user mode binaries, pass the
         --disable-user option to configure.
  
  ===>  Script "configure" failed unexpectedly.
  Please report the problem to emulation@FreeBSD.org [maintainer] and attach
  the
  "/wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-d587db6/config.log"
  including the output of the failure of your make command. Also, it might be
  a good idea to provide an overview of all packages installed on your system
  (e.g. a /usr/local/sbin/pkg-static info -g -Ea).
  *** Error code 1
  
  This is because lld 10.0.0 no longer supports the -Ttext-segment option, and uses --image-base for similar functionality.
  
  I am proposing a patch that makes the configure script check for the --image-base option first, then the -Ttext-segment option.
  
  PR:		ports/244772
  Submitted by:	dim@FreeBSD.org
  Approved by:	Maintainer

Added:
  head/emulators/qemu-user-static-devel/files/patch-configure   (contents, props changed)

Added: head/emulators/qemu-user-static-devel/files/patch-configure
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu-user-static-devel/files/patch-configure	Fri Mar 20 00:47:58 2020	(r528752)
@@ -0,0 +1,52 @@
+--- configure.orig	2019-12-12 02:59:17 UTC
++++ configure
+@@ -5954,27 +5954,30 @@ if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] 
+     cat > $TMPC <<EOF
+     int main(void) { return 0; }
+ EOF
+-    textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
++    textseg_ldflags="-Wl,--image-base=$textseg_addr"
+     if ! compile_prog "" "$textseg_ldflags"; then
+-      # In case ld does not support -Ttext-segment, edit the default linker
+-      # script via sed to set the .text start addr.  This is needed on FreeBSD
+-      # at least.
+-      if ! $ld --verbose >/dev/null 2>&1; then
+-        error_exit \
+-            "We need to link the QEMU user mode binaries at a" \
+-            "specific text address. Unfortunately your linker" \
+-            "doesn't support either the -Ttext-segment option or" \
+-            "printing the default linker script with --verbose." \
+-            "If you don't want the user mode binaries, pass the" \
+-            "--disable-user option to configure."
+-      fi
++      textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
++      if ! compile_prog "" "$textseg_ldflags"; then
++        # In case ld does not support -Ttext-segment, edit the default linker
++        # script via sed to set the .text start addr.  This is needed on FreeBSD
++        # at least.
++        if ! $ld --verbose >/dev/null 2>&1; then
++          error_exit \
++              "We need to link the QEMU user mode binaries at a" \
++              "specific text address. Unfortunately your linker" \
++              "doesn't support either the -Ttext-segment option or" \
++              "printing the default linker script with --verbose." \
++              "If you don't want the user mode binaries, pass the" \
++              "--disable-user option to configure."
++        fi
+ 
+-      $ld --verbose | sed \
+-        -e '1,/==================================================/d' \
+-        -e '/==================================================/,$d' \
+-        -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
+-        -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
+-      textseg_ldflags="-Wl,-T../config-host.ld"
++        $ld --verbose | sed \
++          -e '1,/==================================================/d' \
++          -e '/==================================================/,$d' \
++          -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
++          -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
++        textseg_ldflags="-Wl,-T../config-host.ld"
++      fi
+     fi
+   fi
+ fi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003200047.02K0lw4i013528>