All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] Fix support for Icecream
@ 2018-02-06 22:01 Joshua Watt
  2018-02-06 22:01 ` [PATCH 01/14] icecc.bbclass: Move to shared work directory Joshua Watt
                   ` (16 more replies)
  0 siblings, 17 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

Fix up support for using Icecream to do distributed builds, which
appears to have been broken for some time.

In addition, Icecream support can now be enabled in the SDK. When
enabled, the SDK install process will check if the host supports icecc
and if so will construct a proper environment tarball and use it when
compiling.

Most of the changes should be straightforward. icecc-create-env has
been almost completely re-written but the changes were broken up into
hopefully logical chunks.

The following changes since commit 385944254d0ef88bd6450a221a54cbcb40020b42:

  tcmode-default.inc: drop preferred version of gzip-native (2018-01-31 17:01:20 +0000)

are available in the Git repository at:

  git://push.yoctoproject.org/poky-contrib jpew/icecream

Joshua Watt (14):
  icecc.bbclass: Move to shared work directory
  icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage
  icecc.bbclass: Skip canadian-cross compiles
  icecc-create-env: Reformat
  icecc-create-env: Add /bin/true to environment
  icecc-create-env: Use program interpreter for deps
  icecc-create-env: Symlink alternate names
  icecc-create-env: Archive directory
  icecc-create-env: Fix executable rpaths
  icecc-create-env: Add support for nativesdk
  icecc-create-env: Allow multiple tool aliases
  toolchain-shar-extract: Add post-relocate scripts
  icecc-toolchain: Add SDK icecream setup
  icecc.bbclass: Add IceCream support to SDK

 meta/classes/icecc.bbclass                         |  37 ++-
 meta/classes/toolchain-scripts.bbclass             |  15 +
 meta/files/toolchain-shar-extract.sh               |   8 +
 meta/recipes-core/meta/meta-environment.bb         |   2 +
 .../icecc-create-env/icecc-create-env              | 328 ++++++++++++++-------
 ...e-env-native_0.1.bb => icecc-create-env_0.1.bb} |   4 +-
 .../icecc-toolchain/icecc-toolchain/icecc-env.sh   |  37 +++
 .../icecc-toolchain/icecc-toolchain/icecc-setup.sh |  43 +++
 .../nativesdk-icecc-toolchain_0.1.bb               |  38 +++
 9 files changed, 390 insertions(+), 122 deletions(-)
 rename meta/recipes-devtools/icecc-create-env/{icecc-create-env-native_0.1.bb => icecc-create-env_0.1.bb} (98%)
 create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
 create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
 create mode 100644 meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb

-- 
2.14.3



^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 01/14] icecc.bbclass: Move to shared work directory
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 02/14] icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage Joshua Watt
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

Generate the icecc toolchains in a shared work directory. This class was
already setup to correctly synchronize creating the toolchains in a
shared location before the RSS changes, so return to that behavior
instead of generated the toolchains in each recipe's sysroot.
Additionally, it makes no sense for each recipe to generate a toolchain,
only to find it has already generated an uploaded to the compile server
by another recipe.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 1cc1c4ddb0f..e8725b582b3 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -151,6 +151,9 @@ def icecc_is_native(bb, d):
         bb.data.inherits_class("cross", d) or \
         bb.data.inherits_class("native", d);
 
+def icecc_dir(bb, d):
+    return d.expand('${TMPDIR}/work-shared/ice')
+
 # Don't pollute allarch signatures with TARGET_FPU
 icecc_version[vardepsexclude] += "TARGET_FPU"
 def icecc_version(bb, d):
@@ -175,8 +178,8 @@ def icecc_version(bb, d):
             archive_name += "-kernel"
 
     import socket
-    ice_dir = d.expand('${STAGING_DIR_NATIVE}${prefix_native}')
-    tar_file = os.path.join(ice_dir, 'ice', archive_name + "-@VERSION@-" + socket.gethostname() + '.tar.gz')
+    ice_dir = icecc_dir(bb, d)
+    tar_file = os.path.join(ice_dir, archive_name + "-@VERSION@-" + socket.gethostname() + '.tar.gz')
 
     return tar_file
 
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 02/14] icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
  2018-02-06 22:01 ` [PATCH 01/14] icecc.bbclass: Move to shared work directory Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 03/14] icecc.bbclass: Skip canadian-cross compiles Joshua Watt
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

STAGING_BINDIR_TOOLCHAIN is actually a path list, not a single path. Fix
icecc.bbclass to try all the paths in the variable instead of treating
it as a single path.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index e8725b582b3..35a1aaef86f 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -210,15 +210,14 @@ def icecc_get_tool(bb, d, tool):
     else:
         ice_dir = d.expand('${STAGING_BINDIR_TOOLCHAIN}')
         target_sys = d.expand('${TARGET_SYS}')
-        tool_bin = os.path.join(ice_dir, "%s-%s" % (target_sys, tool))
-        if os.path.isfile(tool_bin):
-            return tool_bin
-        else:
-            external_tool_bin = icecc_get_external_tool(bb, d, tool)
-            if os.path.isfile(external_tool_bin):
-                return external_tool_bin
-            else:
-                return ""
+        for p in ice_dir.split(':'):
+            tool_bin = os.path.join(p, "%s-%s" % (target_sys, tool))
+            if os.path.isfile(tool_bin):
+                return tool_bin
+        external_tool_bin = icecc_get_external_tool(bb, d, tool)
+        if os.path.isfile(external_tool_bin):
+            return external_tool_bin
+        return ""
 
 def icecc_get_and_check_tool(bb, d, tool):
     # Check that g++ or gcc is not a symbolic link to icecc binary in
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 03/14] icecc.bbclass: Skip canadian-cross compiles
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
  2018-02-06 22:01 ` [PATCH 01/14] icecc.bbclass: Move to shared work directory Joshua Watt
  2018-02-06 22:01 ` [PATCH 02/14] icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 04/14] icecc-create-env: Reformat Joshua Watt
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

icecc.bbclass will no longer attempt to distribute cross-canadian
compiles. While technically possible to generate a toolchain that runs
on the build system and generates executables for the host system, this
is not the normal way that icecc operates and there are so few of these
recipes that it is probably not worth maintaining.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 35a1aaef86f..9d5eaed57ce 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -101,6 +101,9 @@ def use_icecc(bb,d):
     if icecc_is_allarch(bb, d):
         return "no"
 
+    if icecc_is_cross_canadian(bb, d):
+        return "no"
+
     pn = d.getVar('PN')
 
     system_class_blacklist = []
@@ -151,6 +154,9 @@ def icecc_is_native(bb, d):
         bb.data.inherits_class("cross", d) or \
         bb.data.inherits_class("native", d);
 
+def icecc_is_cross_canadian(bb, d):
+    return bb.data.inherits_class("cross-canadian", d)
+
 def icecc_dir(bb, d):
     return d.expand('${TMPDIR}/work-shared/ice')
 
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 04/14] icecc-create-env: Reformat
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (2 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 03/14] icecc.bbclass: Skip canadian-cross compiles Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 05/14] icecc-create-env: Add /bin/true to environment Joshua Watt
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

The environment script used an annoying mix of tabs and spaces, and no
mapping of tabs to spaces would produce pleasant indentation. Reformat
to eliminate tab characters and settle on 4 spaces for indentation
(which matches the upstream icecream script from which this is derived)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env              | 208 ++++++++++-----------
 1 file changed, 104 insertions(+), 104 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 7e4dbc414e7..723f1f9bd90 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -8,63 +8,63 @@ target_files=
 
 is_contained ()
 {
-  case " $target_files " in
-    *" $1 "* ) return 0 ;;
-    *"=$1 "* ) return 0;;
-    * ) return 1 ;;
-  esac
+    case " $target_files " in
+        *" $1 "* ) return 0 ;;
+        *"=$1 "* ) return 0;;
+        * ) return 1 ;;
+    esac
 }
 
 add_file ()
 {
-  local name="$1"
-  local path="$1";
-  if test -n "$2"; then
-    name="$2"
-  fi
-  test -z "$name" && return
-  # ls -H isn't really the same as readlink, but
-  # readlink is not portable enough.
-  path=`ls -H $path`
-  toadd="$name=$path"
-  is_contained "$toadd" && return
-  if test -z "$silent"; then
-  echo "adding file $toadd"
-  fi
-  target_files="$target_files $toadd"
-  if test -x "$path"; then
-    # Only call ldd when it makes sense
-    if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then
-	if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then
-	   # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc
-		# this regexp parse the outputs like:
-		# ldd /usr/bin/gcc
-		#         linux-gate.so.1 =>  (0xffffe000)
-		#         libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000)
-		#         /lib/ld-linux.so.2 (0xb7fe8000)
-		# covering both situations ( with => and without )
-          for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do
-	    test -f "$lib" || continue
-	    # Check wether the same library also exists in the parent directory,
-	    # and prefer that on the assumption that it is a more generic one.
-	    local baselib=`echo "$lib" | sed 's,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,'`
-	    test -f "$baselib" && lib=$baselib
-	  add_file "$lib"
-        done
-      fi
+    local name="$1"
+    local path="$1";
+    if test -n "$2"; then
+        name="$2"
+    fi
+    test -z "$name" && return
+    # ls -H isn't really the same as readlink, but
+    # readlink is not portable enough.
+    path=`ls -H $path`
+    toadd="$name=$path"
+    is_contained "$toadd" && return
+    if test -z "$silent"; then
+        echo "adding file $toadd"
+    fi
+    target_files="$target_files $toadd"
+    if test -x "$path"; then
+        # Only call ldd when it makes sense
+        if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then
+            if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then
+                # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc
+                # this regexp parse the outputs like:
+                # ldd /usr/bin/gcc
+                #         linux-gate.so.1 =>  (0xffffe000)
+                #         libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000)
+                #         /lib/ld-linux.so.2 (0xb7fe8000)
+                # covering both situations ( with => and without )
+                for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do
+                    test -f "$lib" || continue
+                    # Check wether the same library also exists in the parent directory,
+                    # and prefer that on the assumption that it is a more generic one.
+                    local baselib=`echo "$lib" | sed 's,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,'`
+                    test -f "$baselib" && lib=$baselib
+                    add_file "$lib"
+                done
+            fi
+        fi
     fi
-  fi
 }
 
 # backward compat
 if test "$1" = "--respect-path"; then
-  shift
+    shift
 fi
 
 #add a --silent switch to avoid "broken pipe" errors when calling this scipt from within OE
 if test "$1" = "--silent"; then
- silent=1
- shift
+    silent=1
+    shift
 fi
 
 
@@ -77,18 +77,18 @@ shift
 archive_name=$1
 
 if test -z "$added_gcc" || test -z "$added_gxx" ; then
-	echo "usage: $0 <gcc_path> <g++_path>"
-	exit 1
+    echo "usage: $0 <gcc_path> <g++_path>"
+    exit 1
 fi
 
 if ! test -x "$added_gcc" ; then
-  echo "'$added_gcc' is no executable."
-  exit 1
+    echo "'$added_gcc' is no executable."
+    exit 1
 fi
 
 if ! test -x "$added_gxx" ; then
-  echo "'$added_gcc' is no executable."
-  exit 1
+    echo "'$added_gcc' is no executable."
+    exit 1
 fi
 
 
@@ -97,51 +97,51 @@ add_file $added_gcc /usr/bin/gcc
 add_file $added_gxx /usr/bin/g++
 
 if test -z "$added_as" ; then
- add_file /usr/bin/as /usr/bin/as
+    add_file /usr/bin/as /usr/bin/as
 else
- if ! test -x "$added_as" ; then
-  echo "'$added_as' is no executable."
-  exit 1
- fi
+    if ! test -x "$added_as" ; then
+        echo "'$added_as' is no executable."
+        exit 1
+    fi
 
- add_file $added_as  /usr/bin/as
+    add_file $added_as  /usr/bin/as
 fi
 
 add_file `$added_gcc -print-prog-name=cc1` /usr/bin/cc1
 add_file `$added_gxx -print-prog-name=cc1plus` /usr/bin/cc1plus
 specfile=`$added_gcc -print-file-name=specs`
 if test -n "$specfile" && test -e "$specfile"; then
-  add_file "$specfile"
+    add_file "$specfile"
 fi
 
 ltofile=`$added_gcc -print-prog-name=lto1`
 pluginfile="${ltofile%lto1}liblto_plugin.so"
 if test -r "$pluginfile"
 then
-  add_file $pluginfile  ${pluginfile#*usr}
-  add_file $pluginfile  /usr${pluginfile#*usr}
+    add_file $pluginfile  ${pluginfile#*usr}
+    add_file $pluginfile  /usr${pluginfile#*usr}
 fi
 
 tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
 new_target_files=
 for i in $target_files; do
- case $i in
-   *=/*)
-    target=`echo $i | cut -d= -f1`
-    path=`echo $i | cut -d= -f2`
-    ;;
-   *)
-    path=$i
-    target=$i
-    ;;
-  esac
-  mkdir -p $tempdir/`dirname $target`
-  cp -p $path $tempdir/$target
-  if test -f $tempdir/$target -a -x $tempdir/$target; then
-    strip -s $tempdir/$target 2>/dev/null
-  fi
-  target=`echo $target | cut -b2-`
-  new_target_files="$new_target_files $target"
+    case $i in
+        *=/*)
+            target=`echo $i | cut -d= -f1`
+            path=`echo $i | cut -d= -f2`
+            ;;
+        *)
+            path=$i
+            target=$i
+            ;;
+    esac
+    mkdir -p $tempdir/`dirname $target`
+    cp -p $path $tempdir/$target
+    if test -f $tempdir/$target -a -x $tempdir/$target; then
+        strip -s $tempdir/$target 2>/dev/null
+    fi
+    target=`echo $target | cut -b2-`
+    new_target_files="$new_target_files $target"
 done
 
 #sort the files
@@ -150,43 +150,43 @@ target_files=`for i in $new_target_files; do echo $i; done | sort`
 #test if an archive name was supplied
 #if not use the md5 of all files as the archive name
 if test -z "$archive_name"; then
-  md5sum=NONE
-  for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do
-    if test -x $file; then
-      md5sum=$file
-      break
-    fi
-  done
-
-  #calculate md5 and use it as the archive name
-  archive_name=`for i in $target_files; do test -f $tempdir/$i && $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'`.tar.gz || {
-    if test -z "$silent"; then
-     echo "Couldn't compute MD5 sum."
-    fi
-    exit 2
-  }
-  mydir=`pwd`
+    md5sum=NONE
+    for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do
+        if test -x $file; then
+            md5sum=$file
+            break
+        fi
+    done
+
+    #calculate md5 and use it as the archive name
+    archive_name=`for i in $target_files; do test -f $tempdir/$i && $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'`.tar.gz || {
+        if test -z "$silent"; then
+            echo "Couldn't compute MD5 sum."
+        fi
+        exit 2
+    }
+    mydir=`pwd`
 else
-  mydir="`dirname "$archive_name"`"
+    mydir="`dirname "$archive_name"`"
 
-  #check if we have a full path or only a filename
-  if test "$mydir" = "." ; then
-    mydir=`pwd`
-  else
-    mydir=""
-  fi
+    #check if we have a full path or only a filename
+    if test "$mydir" = "." ; then
+        mydir=`pwd`
+    else
+        mydir=""
+    fi
 fi
 
 if test -z "$silent"; then
-echo "creating $archive_name"
+    echo "creating $archive_name"
 fi
 
 cd $tempdir
 tar -czhf "$mydir/$archive_name" $target_files || {
- if test -z "$silent"; then
-  echo "Couldn't create archive"
- fi
-  exit 3
+    if test -z "$silent"; then
+        echo "Couldn't create archive"
+    fi
+    exit 3
 }
 cd ..
 rm -rf $tempdir
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 05/14] icecc-create-env: Add /bin/true to environment
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (3 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 04/14] icecc-create-env: Reformat Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 06/14] icecc-create-env: Use program interpreter for deps Joshua Watt
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

icecream daemons execute /bin/true from the environment as a check to
determine if the environment is valid at all, so it needs to be
included.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env/icecc-create-env         | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 723f1f9bd90..c838256f748 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -122,6 +122,16 @@ then
     add_file $pluginfile  /usr${pluginfile#*usr}
 fi
 
+# for testing the environment is usable at all
+if test -x /bin/true; then
+    add_file /bin/true
+elif test -x /usr/bin/true; then
+    add_file /usr/bin/true /bin/true
+else
+    echo "'true' not found"
+    exit 1
+fi
+
 tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
 new_target_files=
 for i in $target_files; do
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 06/14] icecc-create-env: Use program interpreter for deps
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (4 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 05/14] icecc-create-env: Add /bin/true to environment Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 07/14] icecc-create-env: Symlink alternate names Joshua Watt
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

ldd cannot always be used to determine a programs dependencies
correctly, particularly when the program specifies an alternate program
interpreter (dynamic loader). This commonly happens when using a
uninative tarball. Instead, determine the program's requested
interpreter, and ask it to list the dependencies.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env                | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index c838256f748..7636d090a48 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -6,6 +6,12 @@
 
 target_files=
 
+is_dynamic_elf ()
+{
+    # Is the file an dynamically linked ELF executable?
+    (file -L "$1" | grep 'ELF' > /dev/null 2>&1) && (! file -L "$1" | grep 'static' > /dev/null 2>&1)
+}
+
 is_contained ()
 {
     case " $target_files " in
@@ -34,8 +40,16 @@ add_file ()
     target_files="$target_files $toadd"
     if test -x "$path"; then
         # Only call ldd when it makes sense
-        if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then
-            if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then
+        if is_dynamic_elf "$path"; then
+            # Request the program interpeter (dynamic loader)
+            interp=`readelf -w -l "$path" | grep "Requesting program interpreter:" | sed "s/\s*\[Requesting program interpreter:\s*\(.*\)\]/\1/g"`
+
+            if test -n "$interp" && test -x "$interp"; then
+                # Use the dynamic loaders --list argument to list the
+                # depenencies. The program may have a a different program
+                # interpeter (typical when using uninative tarballs), which is
+                # why we can't just call ldd.
+                #
                 # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc
                 # this regexp parse the outputs like:
                 # ldd /usr/bin/gcc
@@ -43,7 +57,7 @@ add_file ()
                 #         libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000)
                 #         /lib/ld-linux.so.2 (0xb7fe8000)
                 # covering both situations ( with => and without )
-                for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do
+                for lib in `$interp --list "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do
                     test -f "$lib" || continue
                     # Check wether the same library also exists in the parent directory,
                     # and prefer that on the assumption that it is a more generic one.
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 07/14] icecc-create-env: Symlink alternate names
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (5 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 06/14] icecc-create-env: Use program interpreter for deps Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 08/14] icecc-create-env: Archive directory Joshua Watt
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

Instead of renaming files to a new path in the toolchain archive, keep
the files with their original paths and create a relative symbolic link
from the new path to the original file.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env              | 64 +++++++++++++++++++---
 1 file changed, 57 insertions(+), 7 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 7636d090a48..0791bd54b27 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -21,10 +21,28 @@ is_contained ()
     esac
 }
 
+normalize_path ()
+{
+    # Normalizes the path to a file or directory, removing all "." and ".."
+    # entries. Use pwd -L to explicitly prevent symlink expansion
+    local path=$1
+    if test -f "$path"; then
+        pushd $(dirname $path) > /dev/null 2>&1
+        dir_path=$(pwd -L)
+        path=$dir_path/$(basename $path)
+        popd > /dev/null 2>&1
+    elif test -d "$path"; then
+        pushd $path > /dev/null 2>&1
+        path=$(pwd -L)
+        popd > /dev/null 2>&1
+    fi
+    echo $path
+}
+
 add_file ()
 {
-    local name="$1"
-    local path="$1";
+    local path=`normalize_path $1`
+    local name="$path"
     if test -n "$2"; then
         name="$2"
     fi
@@ -129,7 +147,7 @@ if test -n "$specfile" && test -e "$specfile"; then
 fi
 
 ltofile=`$added_gcc -print-prog-name=lto1`
-pluginfile="${ltofile%lto1}liblto_plugin.so"
+pluginfile=`normalize_path "${ltofile%lto1}liblto_plugin.so"`
 if test -r "$pluginfile"
 then
     add_file $pluginfile  ${pluginfile#*usr}
@@ -146,6 +164,19 @@ else
     exit 1
 fi
 
+link_rel ()
+{
+    local target="$1"
+    local name="$2"
+    local base="$3"
+
+    local prefix=`dirname $name`
+
+    prefix=`echo $prefix | sed 's,[^/]\+,..,g' | sed 's,^/*,,g'`
+
+    ln -s $prefix/$target $base/$name
+}
+
 tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
 new_target_files=
 for i in $target_files; do
@@ -159,11 +190,30 @@ for i in $target_files; do
             target=$i
             ;;
     esac
-    mkdir -p $tempdir/`dirname $target`
-    cp -p $path $tempdir/$target
-    if test -f $tempdir/$target -a -x $tempdir/$target; then
-        strip -s $tempdir/$target 2>/dev/null
+    if test "$target" == "$path"; then
+        mkdir -p $tempdir/`dirname $target`
+        cp -pH $target $tempdir/$target
+
+        if test -f $tempdir/$target -a -x $tempdir/$target; then
+            strip -s $tempdir/$target 2>/dev/null
+        fi
+    else
+        mkdir -p $tempdir/`dirname $path`
+        cp -pH $path $tempdir/$path
+
+        mkdir -p $tempdir/`dirname $target`
+        # Relative links are used because the files are checked for being
+        # executable outside the chroot
+        link_rel $path $target $tempdir
+
+        if test -f $tempdir/$path -a -x $tempdir/$path; then
+            strip -s $tempdir/$path 2>/dev/null
+        fi
+
+        path=`echo $path | cut -b2-`
+        new_target_files="$new_target_files $path"
     fi
+
     target=`echo $target | cut -b2-`
     new_target_files="$new_target_files $target"
 done
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 08/14] icecc-create-env: Archive directory
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (6 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 07/14] icecc-create-env: Symlink alternate names Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 09/14] icecc-create-env: Fix executable rpaths Joshua Watt
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

Taring up the toolchain is now done by adding the entire working
directory, instead of listing all the files individually. This is done
because the list of files may contain ".." entries, which tar does not
like and strips out, resulting in bad archives. This should result in an
identical archive to what was previously generated.

In addition, symbolic links are no longer dereferenced when creating the
archive, as they are purposely included to provide alternate names for
files

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env/icecc-create-env              | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 0791bd54b27..426b093d91c 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -256,7 +256,11 @@ if test -z "$silent"; then
 fi
 
 cd $tempdir
-tar -czhf "$mydir/$archive_name" $target_files || {
+# Add everything in the temp directory. Tar doesn't like to be given files with
+# ".." in them, which frequently happens in $target_files, and will strip off
+# the path prefix past the offending "..". This makes the archive generate
+# incorrectly
+tar -czf "$mydir/$archive_name" . || {
     if test -z "$silent"; then
         echo "Couldn't create archive"
     fi
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 09/14] icecc-create-env: Fix executable rpaths
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (7 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 08/14] icecc-create-env: Archive directory Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 10/14] icecc-create-env: Add support for nativesdk Joshua Watt
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

Executables in the toolchain archive occasionally contain runtime
library search paths (RPATH) that use the $ORIGIN placeholder. However,
in order for that placeholder to work, /proc must be mounted. When
iceccd executes the toolchain in the chroot environment, it doesn't
mount /proc, so it is unable to resolve $ORIGIN resulting in a failure
to find dynamic libraries.

The fix is to replace $ORIGIN in executable RPATH entries with the known
chroot executable path.  In order for this to work, the actual real path
to the executable must be resolved to remove any symlinks, otherwise the
calculate $ORIGIN replacement will be wrong. This is done by using
"readlink -f", which is an acceptable dependency because Yocto already
requires it.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env              | 40 ++++++++++++++++++++--
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 426b093d91c..90d249df9f3 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -12,6 +12,26 @@ is_dynamic_elf ()
     (file -L "$1" | grep 'ELF' > /dev/null 2>&1) && (! file -L "$1" | grep 'static' > /dev/null 2>&1)
 }
 
+fix_rpath ()
+{
+    # Patches the RPATH for a file. When the program is executed in the chroot
+    # be iceccd, /proc is not mounted. As such, $ORIGIN can't be resolved. To
+    # work around this, replace all instances of $ORIGIN in RPATH with the
+    # known chroot path to the executables directory
+    local path="$1"
+    local origin="$2"
+    if ! is_dynamic_elf "$path"; then
+        return
+    fi
+    local new_rpath="`readelf -w -d "$path" | grep RPATH | \
+        sed 's/.*\[\(.*\)\]/\1/g' | \
+        sed "s,\\\$ORIGIN,/$origin,g"`"
+
+    if test -n "$new_rpath"; then
+        $PATCHELF --set-rpath "$new_rpath" "$path"
+    fi
+}
+
 is_contained ()
 {
     case " $target_files " in
@@ -47,9 +67,8 @@ add_file ()
         name="$2"
     fi
     test -z "$name" && return
-    # ls -H isn't really the same as readlink, but
-    # readlink is not portable enough.
-    path=`ls -H $path`
+    # readlink is required for Yocto, so we can use it
+    path=`readlink -f "$path"`
     toadd="$name=$path"
     is_contained "$toadd" && return
     if test -z "$silent"; then
@@ -108,6 +127,17 @@ added_as=$1
 shift
 archive_name=$1
 
+if test -z "$PATCHELF"; then
+    PATCHELF=`which patchelf 2> /dev/null`
+fi
+if test -z "$PATCHELF"; then
+    PATCHELF=`which patchelf-uninative 2> /dev/null`
+fi
+if test -z "$PATCHELF"; then
+    echo "patchelf is required"
+    exit 1
+fi
+
 if test -z "$added_gcc" || test -z "$added_gxx" ; then
     echo "usage: $0 <gcc_path> <g++_path>"
     exit 1
@@ -197,6 +227,8 @@ for i in $target_files; do
         if test -f $tempdir/$target -a -x $tempdir/$target; then
             strip -s $tempdir/$target 2>/dev/null
         fi
+
+        fix_rpath $tempdir/$target `dirname $target`
     else
         mkdir -p $tempdir/`dirname $path`
         cp -pH $path $tempdir/$path
@@ -210,6 +242,8 @@ for i in $target_files; do
             strip -s $tempdir/$path 2>/dev/null
         fi
 
+        fix_rpath $tempdir/$path `dirname $path`
+
         path=`echo $path | cut -b2-`
         new_target_files="$new_target_files $path"
     fi
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 10/14] icecc-create-env: Add support for nativesdk
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (8 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 09/14] icecc-create-env: Fix executable rpaths Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 11/14] icecc-create-env: Allow multiple tool aliases Joshua Watt
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

icecc-create-env can now be built as a nativesdk recipe, allowing the
script to be included as part of an SDK

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../{icecc-create-env-native_0.1.bb => icecc-create-env_0.1.bb}       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename meta/recipes-devtools/icecc-create-env/{icecc-create-env-native_0.1.bb => icecc-create-env_0.1.bb} (98%)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb b/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb
similarity index 98%
rename from meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb
rename to meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb
index f8f4aef3923..053945ebbc6 100644
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb
@@ -12,8 +12,6 @@ PR = "r2"
 DEPENDS = ""
 INHIBIT_DEFAULT_DEPS = "1"
 
-inherit native
-
 # This is needed, because otherwise there is dependency loop from quilt-native
 # Dependency loop #1 found:
 #  Task 10907 (meta/recipes-devtools/quilt/quilt-native_0.60.bb, do_install) (dependent Tasks ['quilt-native, do_compile'])
@@ -34,3 +32,5 @@ do_install() {
     install -d ${D}/${bindir}
     install -m 0755 ${WORKDIR}/icecc-create-env ${D}/${bindir}
 }
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 11/14] icecc-create-env: Allow multiple tool aliases
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (9 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 10/14] icecc-create-env: Add support for nativesdk Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 12/14] toolchain-shar-extract: Add post-relocate scripts Joshua Watt
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

When files are added to the environment, multiple aliases can be given
for the file (by calling add_path multiple times with a second
argument). All of these names will end up with a symlink to the original
file.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env              | 110 ++++++++++-----------
 1 file changed, 54 insertions(+), 56 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 90d249df9f3..537e38a9ba0 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -4,7 +4,8 @@
 # Copyright (C) 2004 by the Icecream Authors
 # GPL
 
-target_files=
+target_paths=
+target_aliases=
 
 is_dynamic_elf ()
 {
@@ -32,15 +33,33 @@ fix_rpath ()
     fi
 }
 
-is_contained ()
+add_path ()
 {
-    case " $target_files " in
-        *" $1 "* ) return 0 ;;
-        *"=$1 "* ) return 0;;
-        * ) return 1 ;;
+    case " $target_paths " in
+        *" $1 "*)
+            return 1
+            ;;
+        *)
+            target_paths="$target_paths $1"
+            return 0
+            ;;
     esac
 }
 
+add_alias ()
+{
+    if test "$1" != "$2"; then
+        local alias="$1=$2"
+        case " $target_aliases " in
+            *" $alias "*)
+                ;;
+            *)
+                target_aliases="$target_aliases $alias"
+                ;;
+        esac
+    fi
+}
+
 normalize_path ()
 {
     # Normalizes the path to a file or directory, removing all "." and ".."
@@ -61,20 +80,17 @@ normalize_path ()
 
 add_file ()
 {
-    local path=`normalize_path $1`
-    local name="$path"
-    if test -n "$2"; then
-        name="$2"
-    fi
-    test -z "$name" && return
+    local p=`normalize_path $1`
     # readlink is required for Yocto, so we can use it
-    path=`readlink -f "$path"`
-    toadd="$name=$path"
-    is_contained "$toadd" && return
-    if test -z "$silent"; then
-        echo "adding file $toadd"
+    local path=`readlink -f "$p"`
+
+    add_alias "$path" "$p"
+    if test -n "$2"; then
+        add_alias "$path" "$2"
     fi
-    target_files="$target_files $toadd"
+
+    add_path "$path" || return
+
     if test -x "$path"; then
         # Only call ldd when it makes sense
         if is_dynamic_elf "$path"; then
@@ -208,52 +224,34 @@ link_rel ()
 }
 
 tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
-new_target_files=
-for i in $target_files; do
-    case $i in
-        *=/*)
-            target=`echo $i | cut -d= -f1`
-            path=`echo $i | cut -d= -f2`
-            ;;
-        *)
-            path=$i
-            target=$i
-            ;;
-    esac
-    if test "$target" == "$path"; then
-        mkdir -p $tempdir/`dirname $target`
-        cp -pH $target $tempdir/$target
-
-        if test -f $tempdir/$target -a -x $tempdir/$target; then
-            strip -s $tempdir/$target 2>/dev/null
-        fi
-
-        fix_rpath $tempdir/$target `dirname $target`
-    else
-        mkdir -p $tempdir/`dirname $path`
-        cp -pH $path $tempdir/$path
+target_files=
+for path in $target_paths; do
+    mkdir -p $tempdir/`dirname $path`
+    cp -pH $path $tempdir/$path
 
-        mkdir -p $tempdir/`dirname $target`
-        # Relative links are used because the files are checked for being
-        # executable outside the chroot
-        link_rel $path $target $tempdir
+    if test -f $tempdir/$path -a -x $tempdir/$path; then
+        strip -s $tempdir/$path 2>/dev/null
+    fi
 
-        if test -f $tempdir/$path -a -x $tempdir/$path; then
-            strip -s $tempdir/$path 2>/dev/null
-        fi
+    fix_rpath $tempdir/$path `dirname $path`
+    target_files="$target_files $path"
+done
 
-        fix_rpath $tempdir/$path `dirname $path`
+for i in $target_aliases; do
+    target=`echo $i | cut -d= -f1`
+    link_name=`echo $i | cut -d= -f2`
 
-        path=`echo $path | cut -b2-`
-        new_target_files="$new_target_files $path"
-    fi
+    mkdir -p $tempdir/`dirname $link_name`
+    # Relative links are used because the files are checked for being
+    # executable outside the chroot
+    link_rel $target $link_name $tempdir
 
-    target=`echo $target | cut -b2-`
-    new_target_files="$new_target_files $target"
+    link_name=`echo $link_name | cut -b2-`
+    target_files="$target_files $link_name"
 done
 
 #sort the files
-target_files=`for i in $new_target_files; do echo $i; done | sort`
+target_files=`for i in $target_files; do echo $i; done | sort`
 
 #test if an archive name was supplied
 #if not use the md5 of all files as the archive name
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 12/14] toolchain-shar-extract: Add post-relocate scripts
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (10 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 11/14] icecc-create-env: Allow multiple tool aliases Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:01 ` [PATCH 13/14] icecc-toolchain: Add SDK icecream setup Joshua Watt
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

Recipes can now install post-relocation scripts which will be run when
the SDK is installed.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/toolchain-scripts.bbclass     | 15 +++++++++++++++
 meta/files/toolchain-shar-extract.sh       |  8 ++++++++
 meta/recipes-core/meta/meta-environment.bb |  2 ++
 3 files changed, 25 insertions(+)

diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass
index 9bcfe708c7c..eeb320d15a8 100644
--- a/meta/classes/toolchain-scripts.bbclass
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -116,6 +116,21 @@ fi
 EOF
 }
 
+toolchain_create_post_relocate_script() {
+	script=$1
+	rm -f $script
+	touch $script
+
+    cat >> $script <<EOF
+if [ -d "${SDKPATHNATIVE}/post-relocate-setup.d/" ]; then
+    for s in ${SDKPATHNATIVE}/post-relocate-setup.d/*.sh; do
+        \$s "\$1"
+    done
+    rm -rf "${SDKPATHNATIVE}/post-relocate-setup.d"
+fi
+EOF
+}
+
 #we get the cached site config in the runtime
 TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d)}"
 TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d"
diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 91804ec2818..f7ab43066fb 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -259,6 +259,14 @@ if [ $savescripts = 0 ] ; then
 	$SUDO_EXEC rm -f ${env_setup_script%/*}/relocate_sdk.py ${env_setup_script%/*}/relocate_sdk.sh
 fi
 
+# Execute post-relocation script
+post_relocate="$target_sdk_dir/post-relocate-setup.sh"
+if [ -e "$post_relocate" ]; then
+	$SUDO_EXEC sed -e "s:@SDKPATH@:$target_sdk_dir:g" -i $post_relocate
+	$SUDO_EXEC /bin/sh $post_relocate "$target_sdk_dir" "@SDKPATH@"
+	$SUDO_EXEC rm -f $post_relocate
+fi
+
 echo "SDK has been successfully set up and is ready to be used."
 echo "Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g."
 for env_setup_script in `ls $target_sdk_dir/environment-setup-*`; do
diff --git a/meta/recipes-core/meta/meta-environment.bb b/meta/recipes-core/meta/meta-environment.bb
index 29da121a3a9..09f757a087c 100644
--- a/meta/recipes-core/meta/meta-environment.bb
+++ b/meta/recipes-core/meta/meta-environment.bb
@@ -55,6 +55,8 @@ create_sdk_files() {
 
 	# Add version information
 	toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS}
+
+	toolchain_create_post_relocate_script ${SDK_OUTPUT}/${SDKPATH}/post-relocate-setup.sh
 }
 
 do_install() {
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 13/14] icecc-toolchain: Add SDK icecream setup
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (11 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 12/14] toolchain-shar-extract: Add post-relocate scripts Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-16 23:43   ` Martin Jansa
  2018-02-06 22:01 ` [PATCH 14/14] icecc.bbclass: Add IceCream support to SDK Joshua Watt
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

IceCream can now be optionally included in the generated SDK by
including nativesdk-icecc-toolchain to TOOLCHAIN_HOST_TASK. When the SDK
is installed, it will check if icecc exists, and if so will generate the
toolchain environment.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-toolchain/icecc-toolchain/icecc-env.sh   | 37 +++++++++++++++++++
 .../icecc-toolchain/icecc-toolchain/icecc-setup.sh | 43 ++++++++++++++++++++++
 .../nativesdk-icecc-toolchain_0.1.bb               | 38 +++++++++++++++++++
 3 files changed, 118 insertions(+)
 create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
 create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
 create mode 100644 meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb

diff --git a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
new file mode 100644
index 00000000000..4c34edbbc5d
--- /dev/null
+++ b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright 2018 Garmin Ltd. or its subsidiaries
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+
+if [ -z "$ICECC_PATH" ]; then
+    ICECC_PATH=$(which icecc 2> /dev/null)
+fi
+
+if [ -n "$ICECC_PATH" ]; then
+    export ICECC_PATH
+    export ICECC_VERSION="$OECORE_NATIVE_SYSROOT/usr/share/icecream/@TOOLCHAIN_ENV@"
+    export ICECC="$(which ${CROSS_COMPILE}gcc)"
+    export ICECXX="$(which ${CROSS_COMPILE}g++)"
+    export ICEAS="$(which ${CROSS_COMPILE}as)"
+    export PATH="$OECORE_NATIVE_SYSROOT/usr/share/icecream/bin:$PATH"
+else
+    echo "Icecc not found. Disabling distributed compiling"
+fi
+
diff --git a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
new file mode 100644
index 00000000000..a433e55b029
--- /dev/null
+++ b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright 2018 Garmin Ltd. or its subsidiaries
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+
+# Setup environment
+for env_setup_script in `ls $1/environment-setup-*`; do
+	. $env_setup_script
+done
+
+# ICECC_PATH will have been found icecc-env.sh
+if [ -z "$ICECC_PATH" ]; then
+    exit 0
+fi
+
+echo "Setting up IceCream distributed compiling..."
+
+# Create the environment
+mkdir -p "`dirname $ICECC_VERSION`"
+icecc-create-env $ICECC $ICECXX $ICEAS $ICECC_VERSION || exit $?
+
+# Create symbolic links
+d="$OECORE_NATIVE_SYSROOT/usr/share/icecream/bin"
+mkdir -p "$d"
+ln -s "$ICECC_PATH" "$d/${CROSS_COMPILE}gcc"
+ln -s "$ICECC_PATH" "$d/${CROSS_COMPILE}g++"
diff --git a/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb
new file mode 100644
index 00000000000..28b2924ebfb
--- /dev/null
+++ b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb
@@ -0,0 +1,38 @@
+# Copyright (C) 2018 Joshua Watt <JPEWhacker@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+DESCRIPTION = "Generates IceCream toolchains for SDKs"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${WORKDIR}/icecc-env.sh;beginline=2;endline=20;md5=aafdb7bc2aa7ac5d039fda0c8733983c"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+SRC_URI = "\
+    file://icecc-env.sh \
+    file://icecc-setup.sh \
+    "
+
+inherit nativesdk
+
+ENV_NAME="${DISTRO}-${TCLIBC}-${SDK_ARCH}-${TUNE_PKGARCH}-${DISTRO_VERSION}.tar.gz"
+
+do_compile() {
+}
+
+do_install() {
+    install -d ${D}${SDKPATHNATIVE}${datadir}/icecream/bin
+
+    install -d ${D}${SDKPATHNATIVE}/environment-setup.d/
+    install -m 0644 ${WORKDIR}/icecc-env.sh ${D}${SDKPATHNATIVE}/environment-setup.d/
+    sed -i ${D}${SDKPATHNATIVE}/environment-setup.d/icecc-env.sh \
+        -e "s,@TOOLCHAIN_ENV@,${ENV_NAME},g"
+
+    install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
+    install -m 0755 ${WORKDIR}/icecc-setup.sh ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
+    sed -i ${D}${SDKPATHNATIVE}/post-relocate-setup.d/icecc-setup.sh \
+        -e "s,@TOOLCHAIN_ENV@,${ENV_NAME},g"
+}
+
+PACKAGES = "${PN}"
+FILES_${PN} = "${SDKPATHNATIVE}"
+RDEPENDS_${PN} += "nativesdk-icecc-create-env"
+
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 14/14] icecc.bbclass: Add IceCream support to SDK
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (12 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 13/14] icecc-toolchain: Add SDK icecream setup Joshua Watt
@ 2018-02-06 22:01 ` Joshua Watt
  2018-02-06 22:32 ` ✗ patchtest: failure for Fix support for Icecream Patchwork
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-06 22:01 UTC (permalink / raw)
  To: OE-core

If icecc is inherited, generated SDKs will automatically have optional
support for compiling using the IceCream distributed compiler

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 9d5eaed57ce..8492ece60c3 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -346,3 +346,10 @@ do_compile_kernelmodules_prepend() {
 do_install_prepend() {
     set_icecc_env
 }
+
+# IceCream is not (currently) supported in the extensible SDK
+ICECC_SDK_HOST_TASK = "nativesdk-icecc-toolchain"
+ICECC_SDK_HOST_TASK_task-populate-sdk-ext = ""
+
+# Add the toolchain scripts to the SDK
+TOOLCHAIN_HOST_TASK_append = " ${ICECC_SDK_HOST_TASK}"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* ✗ patchtest: failure for Fix support for Icecream
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (13 preceding siblings ...)
  2018-02-06 22:01 ` [PATCH 14/14] icecc.bbclass: Add IceCream support to SDK Joshua Watt
@ 2018-02-06 22:32 ` Patchwork
  2018-02-07 20:59 ` [PATCH 00/14] " Tomas Novotny
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
  16 siblings, 0 replies; 40+ messages in thread
From: Patchwork @ 2018-02-06 22:32 UTC (permalink / raw)
  To: Joshua Watt; +Cc: openembedded-core

== Series Details ==

Series: Fix support for Icecream
Revision: 1
URL   : https://patchwork.openembedded.org/series/10867/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             SUMMARY is missing in newly added recipe [test_summary_presence] 
  Suggested fix    Specify the variable SUMMARY in nativesdk-icecc-toolchain



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 00/14] Fix support for Icecream
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (14 preceding siblings ...)
  2018-02-06 22:32 ` ✗ patchtest: failure for Fix support for Icecream Patchwork
@ 2018-02-07 20:59 ` Tomas Novotny
  2018-02-07 21:19   ` Joshua Watt
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
  16 siblings, 1 reply; 40+ messages in thread
From: Tomas Novotny @ 2018-02-07 20:59 UTC (permalink / raw)
  To: Joshua Watt; +Cc: OE-core

Hi Joshua,

On Tue,  6 Feb 2018 16:01:19 -0600
Joshua Watt <jpewhacker@gmail.com> wrote:

> Fix up support for using Icecream to do distributed builds, which
> appears to have been broken for some time.

we were using icecream a year ago and we set ICECC_CARET_WORKAROUND env
variable to 0 (in set_icecc_env() in icecc.bbclass). The default is 1 and it
causes a local rebuild when any warning is emitted.

I don't have exact numbers, but the extreme case was opencv. There was so
many warnings that distributed build on ~10 threads was slower than local
build on 4 threads.

I know that it is some kind of configuration, but I would set the default to
0. Or do it at least configurable.

> In addition, Icecream support can now be enabled in the SDK. When
> enabled, the SDK install process will check if the host supports icecc
> and if so will construct a proper environment tarball and use it when
> compiling.

Thanks for work on that, I'm keen to use it in our environment.

Tomas

> Most of the changes should be straightforward. icecc-create-env has
> been almost completely re-written but the changes were broken up into
> hopefully logical chunks.
> 
> The following changes since commit 385944254d0ef88bd6450a221a54cbcb40020b42:
> 
>   tcmode-default.inc: drop preferred version of gzip-native (2018-01-31 17:01:20 +0000)
> 
> are available in the Git repository at:
> 
>   git://push.yoctoproject.org/poky-contrib jpew/icecream
> 
> Joshua Watt (14):
>   icecc.bbclass: Move to shared work directory
>   icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage
>   icecc.bbclass: Skip canadian-cross compiles
>   icecc-create-env: Reformat
>   icecc-create-env: Add /bin/true to environment
>   icecc-create-env: Use program interpreter for deps
>   icecc-create-env: Symlink alternate names
>   icecc-create-env: Archive directory
>   icecc-create-env: Fix executable rpaths
>   icecc-create-env: Add support for nativesdk
>   icecc-create-env: Allow multiple tool aliases
>   toolchain-shar-extract: Add post-relocate scripts
>   icecc-toolchain: Add SDK icecream setup
>   icecc.bbclass: Add IceCream support to SDK
> 
>  meta/classes/icecc.bbclass                         |  37 ++-
>  meta/classes/toolchain-scripts.bbclass             |  15 +
>  meta/files/toolchain-shar-extract.sh               |   8 +
>  meta/recipes-core/meta/meta-environment.bb         |   2 +
>  .../icecc-create-env/icecc-create-env              | 328 ++++++++++++++-------
>  ...e-env-native_0.1.bb => icecc-create-env_0.1.bb} |   4 +-
>  .../icecc-toolchain/icecc-toolchain/icecc-env.sh   |  37 +++
>  .../icecc-toolchain/icecc-toolchain/icecc-setup.sh |  43 +++
>  .../nativesdk-icecc-toolchain_0.1.bb               |  38 +++
>  9 files changed, 390 insertions(+), 122 deletions(-)
>  rename meta/recipes-devtools/icecc-create-env/{icecc-create-env-native_0.1.bb => icecc-create-env_0.1.bb} (98%)
>  create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
>  create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
>  create mode 100644 meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb
> 


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 00/14] Fix support for Icecream
  2018-02-07 20:59 ` [PATCH 00/14] " Tomas Novotny
@ 2018-02-07 21:19   ` Joshua Watt
  2018-02-08  9:57     ` Tomas Novotny
  0 siblings, 1 reply; 40+ messages in thread
From: Joshua Watt @ 2018-02-07 21:19 UTC (permalink / raw)
  To: Tomas Novotny; +Cc: OE-core

On Wed, 2018-02-07 at 21:59 +0100, Tomas Novotny wrote:
> Hi Joshua,
> 
> On Tue,  6 Feb 2018 16:01:19 -0600
> Joshua Watt <jpewhacker@gmail.com> wrote:
> 
> > Fix up support for using Icecream to do distributed builds, which
> > appears to have been broken for some time.
> 
> we were using icecream a year ago and we set ICECC_CARET_WORKAROUND
> env
> variable to 0 (in set_icecc_env() in icecc.bbclass). The default is 1
> and it
> causes a local rebuild when any warning is emitted.
> 
> I don't have exact numbers, but the extreme case was opencv. There
> was so
> many warnings that distributed build on ~10 threads was slower than
> local
> build on 4 threads.

Ok, that make sense. I'll add a patch to default to
ICECC_CARET_WORKAROUND to my patch series. Thanks for the heads up!

> 
> I know that it is some kind of configuration, but I would set the
> default to
> 0. Or do it at least configurable.
> 
> > In addition, Icecream support can now be enabled in the SDK. When
> > enabled, the SDK install process will check if the host supports
> > icecc
> > and if so will construct a proper environment tarball and use it
> > when
> > compiling.
> 
> Thanks for work on that, I'm keen to use it in our environment.
> 
> Tomas
> 
> > Most of the changes should be straightforward. icecc-create-env has
> > been almost completely re-written but the changes were broken up
> > into
> > hopefully logical chunks.
> > 
> > The following changes since commit
> > 385944254d0ef88bd6450a221a54cbcb40020b42:
> > 
> >   tcmode-default.inc: drop preferred version of gzip-native (2018-
> > 01-31 17:01:20 +0000)
> > 
> > are available in the Git repository at:
> > 
> >   git://push.yoctoproject.org/poky-contrib jpew/icecream
> > 
> > Joshua Watt (14):
> >   icecc.bbclass: Move to shared work directory
> >   icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage
> >   icecc.bbclass: Skip canadian-cross compiles
> >   icecc-create-env: Reformat
> >   icecc-create-env: Add /bin/true to environment
> >   icecc-create-env: Use program interpreter for deps
> >   icecc-create-env: Symlink alternate names
> >   icecc-create-env: Archive directory
> >   icecc-create-env: Fix executable rpaths
> >   icecc-create-env: Add support for nativesdk
> >   icecc-create-env: Allow multiple tool aliases
> >   toolchain-shar-extract: Add post-relocate scripts
> >   icecc-toolchain: Add SDK icecream setup
> >   icecc.bbclass: Add IceCream support to SDK
> > 
> >  meta/classes/icecc.bbclass                         |  37 ++-
> >  meta/classes/toolchain-scripts.bbclass             |  15 +
> >  meta/files/toolchain-shar-extract.sh               |   8 +
> >  meta/recipes-core/meta/meta-environment.bb         |   2 +
> >  .../icecc-create-env/icecc-create-env              | 328
> > ++++++++++++++-------
> >  ...e-env-native_0.1.bb => icecc-create-env_0.1.bb} |   4 +-
> >  .../icecc-toolchain/icecc-toolchain/icecc-env.sh   |  37 +++
> >  .../icecc-toolchain/icecc-toolchain/icecc-setup.sh |  43 +++
> >  .../nativesdk-icecc-toolchain_0.1.bb               |  38 +++
> >  9 files changed, 390 insertions(+), 122 deletions(-)
> >  rename meta/recipes-devtools/icecc-create-env/{icecc-create-env-
> > native_0.1.bb => icecc-create-env_0.1.bb} (98%)
> >  create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-
> > toolchain/icecc-env.sh
> >  create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-
> > toolchain/icecc-setup.sh
> >  create mode 100644 meta/recipes-devtools/icecc-
> > toolchain/nativesdk-icecc-toolchain_0.1.bb
> > 


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 00/14] Fix support for Icecream
  2018-02-07 21:19   ` Joshua Watt
@ 2018-02-08  9:57     ` Tomas Novotny
  0 siblings, 0 replies; 40+ messages in thread
From: Tomas Novotny @ 2018-02-08  9:57 UTC (permalink / raw)
  To: Joshua Watt; +Cc: OE-core

Hi Joshua,

On Wed, 07 Feb 2018 15:19:12 -0600
Joshua Watt <jpewhacker@gmail.com> wrote:

> On Wed, 2018-02-07 at 21:59 +0100, Tomas Novotny wrote:
> > Hi Joshua,
> > 
> > On Tue,  6 Feb 2018 16:01:19 -0600
> > Joshua Watt <jpewhacker@gmail.com> wrote:
> >   
> > > Fix up support for using Icecream to do distributed builds, which
> > > appears to have been broken for some time.  
> > 
> > we were using icecream a year ago and we set ICECC_CARET_WORKAROUND
> > env
> > variable to 0 (in set_icecc_env() in icecc.bbclass). The default is 1
> > and it
> > causes a local rebuild when any warning is emitted.
> > 
> > I don't have exact numbers, but the extreme case was opencv. There
> > was so
> > many warnings that distributed build on ~10 threads was slower than
> > local
> > build on 4 threads.  
> 
> Ok, that make sense. I'll add a patch to default to
> ICECC_CARET_WORKAROUND to my patch series. Thanks for the heads up!

thanks a lot. Please note one smaller consequence. The warning message is
retained, but the second line of warning containing "^" pointing to the exact
position is not printed. I guess that this is ok for OE.

Tomas

> > I know that it is some kind of configuration, but I would set the
> > default to
> > 0. Or do it at least configurable.
> >   
> > > In addition, Icecream support can now be enabled in the SDK. When
> > > enabled, the SDK install process will check if the host supports
> > > icecc
> > > and if so will construct a proper environment tarball and use it
> > > when
> > > compiling.  
> > 
> > Thanks for work on that, I'm keen to use it in our environment.
> > 
> > Tomas
> >   
> > > Most of the changes should be straightforward. icecc-create-env has
> > > been almost completely re-written but the changes were broken up
> > > into
> > > hopefully logical chunks.
> > > 
> > > The following changes since commit
> > > 385944254d0ef88bd6450a221a54cbcb40020b42:
> > > 
> > >   tcmode-default.inc: drop preferred version of gzip-native (2018-
> > > 01-31 17:01:20 +0000)
> > > 
> > > are available in the Git repository at:
> > > 
> > >   git://push.yoctoproject.org/poky-contrib jpew/icecream
> > > 
> > > Joshua Watt (14):
> > >   icecc.bbclass: Move to shared work directory
> > >   icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage
> > >   icecc.bbclass: Skip canadian-cross compiles
> > >   icecc-create-env: Reformat
> > >   icecc-create-env: Add /bin/true to environment
> > >   icecc-create-env: Use program interpreter for deps
> > >   icecc-create-env: Symlink alternate names
> > >   icecc-create-env: Archive directory
> > >   icecc-create-env: Fix executable rpaths
> > >   icecc-create-env: Add support for nativesdk
> > >   icecc-create-env: Allow multiple tool aliases
> > >   toolchain-shar-extract: Add post-relocate scripts
> > >   icecc-toolchain: Add SDK icecream setup
> > >   icecc.bbclass: Add IceCream support to SDK
> > > 
> > >  meta/classes/icecc.bbclass                         |  37 ++-
> > >  meta/classes/toolchain-scripts.bbclass             |  15 +
> > >  meta/files/toolchain-shar-extract.sh               |   8 +
> > >  meta/recipes-core/meta/meta-environment.bb         |   2 +
> > >  .../icecc-create-env/icecc-create-env              | 328
> > > ++++++++++++++-------
> > >  ...e-env-native_0.1.bb => icecc-create-env_0.1.bb} |   4 +-
> > >  .../icecc-toolchain/icecc-toolchain/icecc-env.sh   |  37 +++
> > >  .../icecc-toolchain/icecc-toolchain/icecc-setup.sh |  43 +++
> > >  .../nativesdk-icecc-toolchain_0.1.bb               |  38 +++
> > >  9 files changed, 390 insertions(+), 122 deletions(-)
> > >  rename meta/recipes-devtools/icecc-create-env/{icecc-create-env-
> > > native_0.1.bb => icecc-create-env_0.1.bb} (98%)
> > >  create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-
> > > toolchain/icecc-env.sh
> > >  create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-
> > > toolchain/icecc-setup.sh
> > >  create mode 100644 meta/recipes-devtools/icecc-
> > > toolchain/nativesdk-icecc-toolchain_0.1.bb
> > >   
> 


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 00/17] Fix support for Icecream
  2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
                   ` (15 preceding siblings ...)
  2018-02-07 20:59 ` [PATCH 00/14] " Tomas Novotny
@ 2018-02-12 16:51 ` Joshua Watt
  2018-02-12 16:51   ` [PATCH v2 01/17] icecc.bbclass: Move to shared work directory Joshua Watt
                     ` (16 more replies)
  16 siblings, 17 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:51 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Fix up support for using Icecream to do distributed builds, which
appears to have been broken for some time.

In addition, Icecream support can now be enabled in the SDK. When
enabled, the SDK install process will check if the host supports icecc
and if so will construct a proper environment tarball and use it when
compiling.

Most of the changes should be straightforward. icecc-create-env has
been almost completely re-written but the changes were broken up into
hopefully logical chunks.

V2:
  * Default ICECC_CARET_WORKAROUND = "0" which greatly speeds up build
    times in recipes with a lot of warnings. (Thanks to Tomas Novotny
    <tomas@novotny.cz>)
  * Fix elfutils build when ICECC_CARET_WORKAROUND = "0"
  * Minor fixes to commit messages and patchtest failures

The following changes since commit 44ea6ded0e8e73f5258ce55bd1b851e24243b76a:

  bitbake: bitbake-user-manual: Commented out Placeholder Paragraph (2018-02-06 18:10:35 +0000)

are available in the Git repository at:

  git://push.yoctoproject.org/poky-contrib jpew/icecream

Joshua Watt (17):
  icecc.bbclass: Move to shared work directory
  icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage
  icecc.bbclass: Skip canadian-cross compiles
  icecc-create-env: Reformat
  icecc-create-env: Add /bin/true to environment
  icecc-create-env: Use program interpreter for deps
  icecc-create-env: Symlink alternate names
  icecc-create-env: Archive directory
  icecc-create-env: Fix executable rpaths
  icecc-create-env: Add support for nativesdk
  icecc-create-env: Allow multiple tool aliases
  toolchain-shar-extract: Add post-relocate scripts
  icecc-toolchain: Add SDK icecream setup
  icecc.bbclass: Add Icecream support to SDK
  icecc.bbclass: Disable caret workaround by default
  icecc-toolchain: Disable caret workaround
  elfutils: Use fallthrough attribute

 meta/classes/icecc.bbclass                         |  57 +-
 meta/classes/toolchain-scripts.bbclass             |  15 +
 meta/files/toolchain-shar-extract.sh               |   8 +
 meta/recipes-core/meta/meta-environment.bb         |   2 +
 meta/recipes-devtools/elfutils/elfutils_0.170.bb   |   4 +-
 .../files/0001-Use-fallthrough-attribute.patch     | 791 +++++++++++++++++++++
 .../elfutils/files/debian/fallthrough.patch        |  36 -
 .../icecc-create-env/icecc-create-env              | 328 ++++++---
 ...e-env-native_0.1.bb => icecc-create-env_0.1.bb} |   4 +-
 .../icecc-toolchain/icecc-toolchain/icecc-env.sh   |  49 ++
 .../icecc-toolchain/icecc-toolchain/icecc-setup.sh |  43 ++
 .../nativesdk-icecc-toolchain_0.1.bb               |  38 +
 12 files changed, 1214 insertions(+), 161 deletions(-)
 create mode 100644 meta/recipes-devtools/elfutils/files/0001-Use-fallthrough-attribute.patch
 delete mode 100644 meta/recipes-devtools/elfutils/files/debian/fallthrough.patch
 rename meta/recipes-devtools/icecc-create-env/{icecc-create-env-native_0.1.bb => icecc-create-env_0.1.bb} (98%)
 create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
 create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
 create mode 100644 meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb

-- 
2.14.3



^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v2 01/17] icecc.bbclass: Move to shared work directory
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
@ 2018-02-12 16:51   ` Joshua Watt
  2018-02-12 16:51   ` [PATCH v2 02/17] icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage Joshua Watt
                     ` (15 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:51 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Generate the icecc toolchains in a shared work directory. This class was
already setup to correctly synchronize creating the toolchains in a
shared location before the RSS changes, so return to that behavior
instead of generated the toolchains in each recipe's sysroot.
Additionally, it makes no sense for each recipe to generate a toolchain,
only to find it was already generated and uploaded to the compile server
by another recipe.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 1cc1c4ddb0f..e8725b582b3 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -151,6 +151,9 @@ def icecc_is_native(bb, d):
         bb.data.inherits_class("cross", d) or \
         bb.data.inherits_class("native", d);
 
+def icecc_dir(bb, d):
+    return d.expand('${TMPDIR}/work-shared/ice')
+
 # Don't pollute allarch signatures with TARGET_FPU
 icecc_version[vardepsexclude] += "TARGET_FPU"
 def icecc_version(bb, d):
@@ -175,8 +178,8 @@ def icecc_version(bb, d):
             archive_name += "-kernel"
 
     import socket
-    ice_dir = d.expand('${STAGING_DIR_NATIVE}${prefix_native}')
-    tar_file = os.path.join(ice_dir, 'ice', archive_name + "-@VERSION@-" + socket.gethostname() + '.tar.gz')
+    ice_dir = icecc_dir(bb, d)
+    tar_file = os.path.join(ice_dir, archive_name + "-@VERSION@-" + socket.gethostname() + '.tar.gz')
 
     return tar_file
 
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 02/17] icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
  2018-02-12 16:51   ` [PATCH v2 01/17] icecc.bbclass: Move to shared work directory Joshua Watt
@ 2018-02-12 16:51   ` Joshua Watt
  2018-02-12 16:51   ` [PATCH v2 03/17] icecc.bbclass: Skip canadian-cross compiles Joshua Watt
                     ` (14 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:51 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

STAGING_BINDIR_TOOLCHAIN is actually a path list, not a single path. Fix
icecc.bbclass to try all the paths in the variable instead of treating
it as a single path.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index e8725b582b3..35a1aaef86f 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -210,15 +210,14 @@ def icecc_get_tool(bb, d, tool):
     else:
         ice_dir = d.expand('${STAGING_BINDIR_TOOLCHAIN}')
         target_sys = d.expand('${TARGET_SYS}')
-        tool_bin = os.path.join(ice_dir, "%s-%s" % (target_sys, tool))
-        if os.path.isfile(tool_bin):
-            return tool_bin
-        else:
-            external_tool_bin = icecc_get_external_tool(bb, d, tool)
-            if os.path.isfile(external_tool_bin):
-                return external_tool_bin
-            else:
-                return ""
+        for p in ice_dir.split(':'):
+            tool_bin = os.path.join(p, "%s-%s" % (target_sys, tool))
+            if os.path.isfile(tool_bin):
+                return tool_bin
+        external_tool_bin = icecc_get_external_tool(bb, d, tool)
+        if os.path.isfile(external_tool_bin):
+            return external_tool_bin
+        return ""
 
 def icecc_get_and_check_tool(bb, d, tool):
     # Check that g++ or gcc is not a symbolic link to icecc binary in
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 03/17] icecc.bbclass: Skip canadian-cross compiles
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
  2018-02-12 16:51   ` [PATCH v2 01/17] icecc.bbclass: Move to shared work directory Joshua Watt
  2018-02-12 16:51   ` [PATCH v2 02/17] icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage Joshua Watt
@ 2018-02-12 16:51   ` Joshua Watt
  2018-02-12 16:51   ` [PATCH v2 04/17] icecc-create-env: Reformat Joshua Watt
                     ` (13 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:51 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

icecc.bbclass will no longer attempt to distribute cross-canadian
compiles. While it is technically possible to generate a toolchain that runs
on the build system and generates executables for the host system, this
is not the normal way that icecc operates. There are so few of these
recipes that it is probably not worth maintaining a distinct code path
for them.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 35a1aaef86f..9d5eaed57ce 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -101,6 +101,9 @@ def use_icecc(bb,d):
     if icecc_is_allarch(bb, d):
         return "no"
 
+    if icecc_is_cross_canadian(bb, d):
+        return "no"
+
     pn = d.getVar('PN')
 
     system_class_blacklist = []
@@ -151,6 +154,9 @@ def icecc_is_native(bb, d):
         bb.data.inherits_class("cross", d) or \
         bb.data.inherits_class("native", d);
 
+def icecc_is_cross_canadian(bb, d):
+    return bb.data.inherits_class("cross-canadian", d)
+
 def icecc_dir(bb, d):
     return d.expand('${TMPDIR}/work-shared/ice')
 
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 04/17] icecc-create-env: Reformat
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (2 preceding siblings ...)
  2018-02-12 16:51   ` [PATCH v2 03/17] icecc.bbclass: Skip canadian-cross compiles Joshua Watt
@ 2018-02-12 16:51   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 05/17] icecc-create-env: Add /bin/true to environment Joshua Watt
                     ` (12 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:51 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

The environment script used an annoying mix of tabs and spaces and no
mapping of tabs to spaces would produce pleasant indentation. Reformat
to eliminate tab characters and settle on 4 spaces for indentation
(which matches the upstream icecream script from which this is derived)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env              | 208 ++++++++++-----------
 1 file changed, 104 insertions(+), 104 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 7e4dbc414e7..723f1f9bd90 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -8,63 +8,63 @@ target_files=
 
 is_contained ()
 {
-  case " $target_files " in
-    *" $1 "* ) return 0 ;;
-    *"=$1 "* ) return 0;;
-    * ) return 1 ;;
-  esac
+    case " $target_files " in
+        *" $1 "* ) return 0 ;;
+        *"=$1 "* ) return 0;;
+        * ) return 1 ;;
+    esac
 }
 
 add_file ()
 {
-  local name="$1"
-  local path="$1";
-  if test -n "$2"; then
-    name="$2"
-  fi
-  test -z "$name" && return
-  # ls -H isn't really the same as readlink, but
-  # readlink is not portable enough.
-  path=`ls -H $path`
-  toadd="$name=$path"
-  is_contained "$toadd" && return
-  if test -z "$silent"; then
-  echo "adding file $toadd"
-  fi
-  target_files="$target_files $toadd"
-  if test -x "$path"; then
-    # Only call ldd when it makes sense
-    if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then
-	if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then
-	   # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc
-		# this regexp parse the outputs like:
-		# ldd /usr/bin/gcc
-		#         linux-gate.so.1 =>  (0xffffe000)
-		#         libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000)
-		#         /lib/ld-linux.so.2 (0xb7fe8000)
-		# covering both situations ( with => and without )
-          for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do
-	    test -f "$lib" || continue
-	    # Check wether the same library also exists in the parent directory,
-	    # and prefer that on the assumption that it is a more generic one.
-	    local baselib=`echo "$lib" | sed 's,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,'`
-	    test -f "$baselib" && lib=$baselib
-	  add_file "$lib"
-        done
-      fi
+    local name="$1"
+    local path="$1";
+    if test -n "$2"; then
+        name="$2"
+    fi
+    test -z "$name" && return
+    # ls -H isn't really the same as readlink, but
+    # readlink is not portable enough.
+    path=`ls -H $path`
+    toadd="$name=$path"
+    is_contained "$toadd" && return
+    if test -z "$silent"; then
+        echo "adding file $toadd"
+    fi
+    target_files="$target_files $toadd"
+    if test -x "$path"; then
+        # Only call ldd when it makes sense
+        if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then
+            if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then
+                # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc
+                # this regexp parse the outputs like:
+                # ldd /usr/bin/gcc
+                #         linux-gate.so.1 =>  (0xffffe000)
+                #         libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000)
+                #         /lib/ld-linux.so.2 (0xb7fe8000)
+                # covering both situations ( with => and without )
+                for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do
+                    test -f "$lib" || continue
+                    # Check wether the same library also exists in the parent directory,
+                    # and prefer that on the assumption that it is a more generic one.
+                    local baselib=`echo "$lib" | sed 's,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,'`
+                    test -f "$baselib" && lib=$baselib
+                    add_file "$lib"
+                done
+            fi
+        fi
     fi
-  fi
 }
 
 # backward compat
 if test "$1" = "--respect-path"; then
-  shift
+    shift
 fi
 
 #add a --silent switch to avoid "broken pipe" errors when calling this scipt from within OE
 if test "$1" = "--silent"; then
- silent=1
- shift
+    silent=1
+    shift
 fi
 
 
@@ -77,18 +77,18 @@ shift
 archive_name=$1
 
 if test -z "$added_gcc" || test -z "$added_gxx" ; then
-	echo "usage: $0 <gcc_path> <g++_path>"
-	exit 1
+    echo "usage: $0 <gcc_path> <g++_path>"
+    exit 1
 fi
 
 if ! test -x "$added_gcc" ; then
-  echo "'$added_gcc' is no executable."
-  exit 1
+    echo "'$added_gcc' is no executable."
+    exit 1
 fi
 
 if ! test -x "$added_gxx" ; then
-  echo "'$added_gcc' is no executable."
-  exit 1
+    echo "'$added_gcc' is no executable."
+    exit 1
 fi
 
 
@@ -97,51 +97,51 @@ add_file $added_gcc /usr/bin/gcc
 add_file $added_gxx /usr/bin/g++
 
 if test -z "$added_as" ; then
- add_file /usr/bin/as /usr/bin/as
+    add_file /usr/bin/as /usr/bin/as
 else
- if ! test -x "$added_as" ; then
-  echo "'$added_as' is no executable."
-  exit 1
- fi
+    if ! test -x "$added_as" ; then
+        echo "'$added_as' is no executable."
+        exit 1
+    fi
 
- add_file $added_as  /usr/bin/as
+    add_file $added_as  /usr/bin/as
 fi
 
 add_file `$added_gcc -print-prog-name=cc1` /usr/bin/cc1
 add_file `$added_gxx -print-prog-name=cc1plus` /usr/bin/cc1plus
 specfile=`$added_gcc -print-file-name=specs`
 if test -n "$specfile" && test -e "$specfile"; then
-  add_file "$specfile"
+    add_file "$specfile"
 fi
 
 ltofile=`$added_gcc -print-prog-name=lto1`
 pluginfile="${ltofile%lto1}liblto_plugin.so"
 if test -r "$pluginfile"
 then
-  add_file $pluginfile  ${pluginfile#*usr}
-  add_file $pluginfile  /usr${pluginfile#*usr}
+    add_file $pluginfile  ${pluginfile#*usr}
+    add_file $pluginfile  /usr${pluginfile#*usr}
 fi
 
 tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
 new_target_files=
 for i in $target_files; do
- case $i in
-   *=/*)
-    target=`echo $i | cut -d= -f1`
-    path=`echo $i | cut -d= -f2`
-    ;;
-   *)
-    path=$i
-    target=$i
-    ;;
-  esac
-  mkdir -p $tempdir/`dirname $target`
-  cp -p $path $tempdir/$target
-  if test -f $tempdir/$target -a -x $tempdir/$target; then
-    strip -s $tempdir/$target 2>/dev/null
-  fi
-  target=`echo $target | cut -b2-`
-  new_target_files="$new_target_files $target"
+    case $i in
+        *=/*)
+            target=`echo $i | cut -d= -f1`
+            path=`echo $i | cut -d= -f2`
+            ;;
+        *)
+            path=$i
+            target=$i
+            ;;
+    esac
+    mkdir -p $tempdir/`dirname $target`
+    cp -p $path $tempdir/$target
+    if test -f $tempdir/$target -a -x $tempdir/$target; then
+        strip -s $tempdir/$target 2>/dev/null
+    fi
+    target=`echo $target | cut -b2-`
+    new_target_files="$new_target_files $target"
 done
 
 #sort the files
@@ -150,43 +150,43 @@ target_files=`for i in $new_target_files; do echo $i; done | sort`
 #test if an archive name was supplied
 #if not use the md5 of all files as the archive name
 if test -z "$archive_name"; then
-  md5sum=NONE
-  for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do
-    if test -x $file; then
-      md5sum=$file
-      break
-    fi
-  done
-
-  #calculate md5 and use it as the archive name
-  archive_name=`for i in $target_files; do test -f $tempdir/$i && $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'`.tar.gz || {
-    if test -z "$silent"; then
-     echo "Couldn't compute MD5 sum."
-    fi
-    exit 2
-  }
-  mydir=`pwd`
+    md5sum=NONE
+    for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do
+        if test -x $file; then
+            md5sum=$file
+            break
+        fi
+    done
+
+    #calculate md5 and use it as the archive name
+    archive_name=`for i in $target_files; do test -f $tempdir/$i && $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'`.tar.gz || {
+        if test -z "$silent"; then
+            echo "Couldn't compute MD5 sum."
+        fi
+        exit 2
+    }
+    mydir=`pwd`
 else
-  mydir="`dirname "$archive_name"`"
+    mydir="`dirname "$archive_name"`"
 
-  #check if we have a full path or only a filename
-  if test "$mydir" = "." ; then
-    mydir=`pwd`
-  else
-    mydir=""
-  fi
+    #check if we have a full path or only a filename
+    if test "$mydir" = "." ; then
+        mydir=`pwd`
+    else
+        mydir=""
+    fi
 fi
 
 if test -z "$silent"; then
-echo "creating $archive_name"
+    echo "creating $archive_name"
 fi
 
 cd $tempdir
 tar -czhf "$mydir/$archive_name" $target_files || {
- if test -z "$silent"; then
-  echo "Couldn't create archive"
- fi
-  exit 3
+    if test -z "$silent"; then
+        echo "Couldn't create archive"
+    fi
+    exit 3
 }
 cd ..
 rm -rf $tempdir
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 05/17] icecc-create-env: Add /bin/true to environment
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (3 preceding siblings ...)
  2018-02-12 16:51   ` [PATCH v2 04/17] icecc-create-env: Reformat Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 06/17] icecc-create-env: Use program interpreter for deps Joshua Watt
                     ` (11 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

icecream daemons execute /bin/true from the environment as a check to
determine if the environment is valid at all, so it needs to be
included.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env/icecc-create-env         | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 723f1f9bd90..c838256f748 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -122,6 +122,16 @@ then
     add_file $pluginfile  /usr${pluginfile#*usr}
 fi
 
+# for testing the environment is usable at all
+if test -x /bin/true; then
+    add_file /bin/true
+elif test -x /usr/bin/true; then
+    add_file /usr/bin/true /bin/true
+else
+    echo "'true' not found"
+    exit 1
+fi
+
 tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
 new_target_files=
 for i in $target_files; do
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 06/17] icecc-create-env: Use program interpreter for deps
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (4 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 05/17] icecc-create-env: Add /bin/true to environment Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 07/17] icecc-create-env: Symlink alternate names Joshua Watt
                     ` (10 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

ldd cannot always be used to determine a program's dependencies
correctly, particularly when the program specifies an alternate program
interpreter (dynamic loader). This commonly happens when using a
uninative tarball. Instead, determine the program's requested
interpreter, and ask it to list the dependencies.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env                | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index c838256f748..7636d090a48 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -6,6 +6,12 @@
 
 target_files=
 
+is_dynamic_elf ()
+{
+    # Is the file an dynamically linked ELF executable?
+    (file -L "$1" | grep 'ELF' > /dev/null 2>&1) && (! file -L "$1" | grep 'static' > /dev/null 2>&1)
+}
+
 is_contained ()
 {
     case " $target_files " in
@@ -34,8 +40,16 @@ add_file ()
     target_files="$target_files $toadd"
     if test -x "$path"; then
         # Only call ldd when it makes sense
-        if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then
-            if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then
+        if is_dynamic_elf "$path"; then
+            # Request the program interpeter (dynamic loader)
+            interp=`readelf -w -l "$path" | grep "Requesting program interpreter:" | sed "s/\s*\[Requesting program interpreter:\s*\(.*\)\]/\1/g"`
+
+            if test -n "$interp" && test -x "$interp"; then
+                # Use the dynamic loaders --list argument to list the
+                # depenencies. The program may have a a different program
+                # interpeter (typical when using uninative tarballs), which is
+                # why we can't just call ldd.
+                #
                 # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc
                 # this regexp parse the outputs like:
                 # ldd /usr/bin/gcc
@@ -43,7 +57,7 @@ add_file ()
                 #         libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000)
                 #         /lib/ld-linux.so.2 (0xb7fe8000)
                 # covering both situations ( with => and without )
-                for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do
+                for lib in `$interp --list "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do
                     test -f "$lib" || continue
                     # Check wether the same library also exists in the parent directory,
                     # and prefer that on the assumption that it is a more generic one.
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 07/17] icecc-create-env: Symlink alternate names
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (5 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 06/17] icecc-create-env: Use program interpreter for deps Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 08/17] icecc-create-env: Archive directory Joshua Watt
                     ` (9 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Instead of renaming files to a new path in the toolchain archive, keep
the files with their original paths and create a relative symbolic link
from the new path to the original file.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env              | 64 +++++++++++++++++++---
 1 file changed, 57 insertions(+), 7 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 7636d090a48..0791bd54b27 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -21,10 +21,28 @@ is_contained ()
     esac
 }
 
+normalize_path ()
+{
+    # Normalizes the path to a file or directory, removing all "." and ".."
+    # entries. Use pwd -L to explicitly prevent symlink expansion
+    local path=$1
+    if test -f "$path"; then
+        pushd $(dirname $path) > /dev/null 2>&1
+        dir_path=$(pwd -L)
+        path=$dir_path/$(basename $path)
+        popd > /dev/null 2>&1
+    elif test -d "$path"; then
+        pushd $path > /dev/null 2>&1
+        path=$(pwd -L)
+        popd > /dev/null 2>&1
+    fi
+    echo $path
+}
+
 add_file ()
 {
-    local name="$1"
-    local path="$1";
+    local path=`normalize_path $1`
+    local name="$path"
     if test -n "$2"; then
         name="$2"
     fi
@@ -129,7 +147,7 @@ if test -n "$specfile" && test -e "$specfile"; then
 fi
 
 ltofile=`$added_gcc -print-prog-name=lto1`
-pluginfile="${ltofile%lto1}liblto_plugin.so"
+pluginfile=`normalize_path "${ltofile%lto1}liblto_plugin.so"`
 if test -r "$pluginfile"
 then
     add_file $pluginfile  ${pluginfile#*usr}
@@ -146,6 +164,19 @@ else
     exit 1
 fi
 
+link_rel ()
+{
+    local target="$1"
+    local name="$2"
+    local base="$3"
+
+    local prefix=`dirname $name`
+
+    prefix=`echo $prefix | sed 's,[^/]\+,..,g' | sed 's,^/*,,g'`
+
+    ln -s $prefix/$target $base/$name
+}
+
 tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
 new_target_files=
 for i in $target_files; do
@@ -159,11 +190,30 @@ for i in $target_files; do
             target=$i
             ;;
     esac
-    mkdir -p $tempdir/`dirname $target`
-    cp -p $path $tempdir/$target
-    if test -f $tempdir/$target -a -x $tempdir/$target; then
-        strip -s $tempdir/$target 2>/dev/null
+    if test "$target" == "$path"; then
+        mkdir -p $tempdir/`dirname $target`
+        cp -pH $target $tempdir/$target
+
+        if test -f $tempdir/$target -a -x $tempdir/$target; then
+            strip -s $tempdir/$target 2>/dev/null
+        fi
+    else
+        mkdir -p $tempdir/`dirname $path`
+        cp -pH $path $tempdir/$path
+
+        mkdir -p $tempdir/`dirname $target`
+        # Relative links are used because the files are checked for being
+        # executable outside the chroot
+        link_rel $path $target $tempdir
+
+        if test -f $tempdir/$path -a -x $tempdir/$path; then
+            strip -s $tempdir/$path 2>/dev/null
+        fi
+
+        path=`echo $path | cut -b2-`
+        new_target_files="$new_target_files $path"
     fi
+
     target=`echo $target | cut -b2-`
     new_target_files="$new_target_files $target"
 done
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 08/17] icecc-create-env: Archive directory
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (6 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 07/17] icecc-create-env: Symlink alternate names Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 09/17] icecc-create-env: Fix executable rpaths Joshua Watt
                     ` (8 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Taring up the toolchain is now done by adding the entire working
directory, instead of listing all the files individually. This is done
because the list of files may contain ".." entries, which tar does not
like and strips out, resulting in bad archives. This should result in an
identical archive to what was previously generated.

In addition, symbolic links are no longer dereferenced when creating the
archive, as they are purposely included to provide alternate names for
files

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env/icecc-create-env              | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 0791bd54b27..426b093d91c 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -256,7 +256,11 @@ if test -z "$silent"; then
 fi
 
 cd $tempdir
-tar -czhf "$mydir/$archive_name" $target_files || {
+# Add everything in the temp directory. Tar doesn't like to be given files with
+# ".." in them, which frequently happens in $target_files, and will strip off
+# the path prefix past the offending "..". This makes the archive generate
+# incorrectly
+tar -czf "$mydir/$archive_name" . || {
     if test -z "$silent"; then
         echo "Couldn't create archive"
     fi
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 09/17] icecc-create-env: Fix executable rpaths
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (7 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 08/17] icecc-create-env: Archive directory Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 10/17] icecc-create-env: Add support for nativesdk Joshua Watt
                     ` (7 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Executables in the toolchain archive occasionally contain runtime
library search paths (RPATH) that use the $ORIGIN placeholder. However,
in order for that placeholder to work, /proc must be mounted. When
iceccd executes the toolchain in the chroot environment, it doesn't
mount /proc, so it is unable to resolve $ORIGIN resulting in a failure
to find dynamic libraries.

The fix is to replace $ORIGIN in executable RPATH entries with the known
chroot executable path. In order for this to work, the actual real path
to the executable must be resolved to remove any symlinks, otherwise the
calculate $ORIGIN replacement will be wrong. This is done by using
"readlink -f", which is an acceptable dependency because Yocto already
requires it.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env              | 40 ++++++++++++++++++++--
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 426b093d91c..90d249df9f3 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -12,6 +12,26 @@ is_dynamic_elf ()
     (file -L "$1" | grep 'ELF' > /dev/null 2>&1) && (! file -L "$1" | grep 'static' > /dev/null 2>&1)
 }
 
+fix_rpath ()
+{
+    # Patches the RPATH for a file. When the program is executed in the chroot
+    # be iceccd, /proc is not mounted. As such, $ORIGIN can't be resolved. To
+    # work around this, replace all instances of $ORIGIN in RPATH with the
+    # known chroot path to the executables directory
+    local path="$1"
+    local origin="$2"
+    if ! is_dynamic_elf "$path"; then
+        return
+    fi
+    local new_rpath="`readelf -w -d "$path" | grep RPATH | \
+        sed 's/.*\[\(.*\)\]/\1/g' | \
+        sed "s,\\\$ORIGIN,/$origin,g"`"
+
+    if test -n "$new_rpath"; then
+        $PATCHELF --set-rpath "$new_rpath" "$path"
+    fi
+}
+
 is_contained ()
 {
     case " $target_files " in
@@ -47,9 +67,8 @@ add_file ()
         name="$2"
     fi
     test -z "$name" && return
-    # ls -H isn't really the same as readlink, but
-    # readlink is not portable enough.
-    path=`ls -H $path`
+    # readlink is required for Yocto, so we can use it
+    path=`readlink -f "$path"`
     toadd="$name=$path"
     is_contained "$toadd" && return
     if test -z "$silent"; then
@@ -108,6 +127,17 @@ added_as=$1
 shift
 archive_name=$1
 
+if test -z "$PATCHELF"; then
+    PATCHELF=`which patchelf 2> /dev/null`
+fi
+if test -z "$PATCHELF"; then
+    PATCHELF=`which patchelf-uninative 2> /dev/null`
+fi
+if test -z "$PATCHELF"; then
+    echo "patchelf is required"
+    exit 1
+fi
+
 if test -z "$added_gcc" || test -z "$added_gxx" ; then
     echo "usage: $0 <gcc_path> <g++_path>"
     exit 1
@@ -197,6 +227,8 @@ for i in $target_files; do
         if test -f $tempdir/$target -a -x $tempdir/$target; then
             strip -s $tempdir/$target 2>/dev/null
         fi
+
+        fix_rpath $tempdir/$target `dirname $target`
     else
         mkdir -p $tempdir/`dirname $path`
         cp -pH $path $tempdir/$path
@@ -210,6 +242,8 @@ for i in $target_files; do
             strip -s $tempdir/$path 2>/dev/null
         fi
 
+        fix_rpath $tempdir/$path `dirname $path`
+
         path=`echo $path | cut -b2-`
         new_target_files="$new_target_files $path"
     fi
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 10/17] icecc-create-env: Add support for nativesdk
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (8 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 09/17] icecc-create-env: Fix executable rpaths Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 11/17] icecc-create-env: Allow multiple tool aliases Joshua Watt
                     ` (6 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

icecc-create-env can now be built as a nativesdk recipe, allowing the
script to be included as part of an SDK

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../{icecc-create-env-native_0.1.bb => icecc-create-env_0.1.bb}       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename meta/recipes-devtools/icecc-create-env/{icecc-create-env-native_0.1.bb => icecc-create-env_0.1.bb} (98%)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb b/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb
similarity index 98%
rename from meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb
rename to meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb
index f8f4aef3923..053945ebbc6 100644
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb
@@ -12,8 +12,6 @@ PR = "r2"
 DEPENDS = ""
 INHIBIT_DEFAULT_DEPS = "1"
 
-inherit native
-
 # This is needed, because otherwise there is dependency loop from quilt-native
 # Dependency loop #1 found:
 #  Task 10907 (meta/recipes-devtools/quilt/quilt-native_0.60.bb, do_install) (dependent Tasks ['quilt-native, do_compile'])
@@ -34,3 +32,5 @@ do_install() {
     install -d ${D}/${bindir}
     install -m 0755 ${WORKDIR}/icecc-create-env ${D}/${bindir}
 }
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 11/17] icecc-create-env: Allow multiple tool aliases
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (9 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 10/17] icecc-create-env: Add support for nativesdk Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 12/17] toolchain-shar-extract: Add post-relocate scripts Joshua Watt
                     ` (5 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

When files are added to the environment, multiple aliases can be given
for the file (by calling add_path multiple times with a second
argument). All of these names will end up with a symlink to the original
file.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-create-env/icecc-create-env              | 110 ++++++++++-----------
 1 file changed, 54 insertions(+), 56 deletions(-)

diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 90d249df9f3..537e38a9ba0 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -4,7 +4,8 @@
 # Copyright (C) 2004 by the Icecream Authors
 # GPL
 
-target_files=
+target_paths=
+target_aliases=
 
 is_dynamic_elf ()
 {
@@ -32,15 +33,33 @@ fix_rpath ()
     fi
 }
 
-is_contained ()
+add_path ()
 {
-    case " $target_files " in
-        *" $1 "* ) return 0 ;;
-        *"=$1 "* ) return 0;;
-        * ) return 1 ;;
+    case " $target_paths " in
+        *" $1 "*)
+            return 1
+            ;;
+        *)
+            target_paths="$target_paths $1"
+            return 0
+            ;;
     esac
 }
 
+add_alias ()
+{
+    if test "$1" != "$2"; then
+        local alias="$1=$2"
+        case " $target_aliases " in
+            *" $alias "*)
+                ;;
+            *)
+                target_aliases="$target_aliases $alias"
+                ;;
+        esac
+    fi
+}
+
 normalize_path ()
 {
     # Normalizes the path to a file or directory, removing all "." and ".."
@@ -61,20 +80,17 @@ normalize_path ()
 
 add_file ()
 {
-    local path=`normalize_path $1`
-    local name="$path"
-    if test -n "$2"; then
-        name="$2"
-    fi
-    test -z "$name" && return
+    local p=`normalize_path $1`
     # readlink is required for Yocto, so we can use it
-    path=`readlink -f "$path"`
-    toadd="$name=$path"
-    is_contained "$toadd" && return
-    if test -z "$silent"; then
-        echo "adding file $toadd"
+    local path=`readlink -f "$p"`
+
+    add_alias "$path" "$p"
+    if test -n "$2"; then
+        add_alias "$path" "$2"
     fi
-    target_files="$target_files $toadd"
+
+    add_path "$path" || return
+
     if test -x "$path"; then
         # Only call ldd when it makes sense
         if is_dynamic_elf "$path"; then
@@ -208,52 +224,34 @@ link_rel ()
 }
 
 tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
-new_target_files=
-for i in $target_files; do
-    case $i in
-        *=/*)
-            target=`echo $i | cut -d= -f1`
-            path=`echo $i | cut -d= -f2`
-            ;;
-        *)
-            path=$i
-            target=$i
-            ;;
-    esac
-    if test "$target" == "$path"; then
-        mkdir -p $tempdir/`dirname $target`
-        cp -pH $target $tempdir/$target
-
-        if test -f $tempdir/$target -a -x $tempdir/$target; then
-            strip -s $tempdir/$target 2>/dev/null
-        fi
-
-        fix_rpath $tempdir/$target `dirname $target`
-    else
-        mkdir -p $tempdir/`dirname $path`
-        cp -pH $path $tempdir/$path
+target_files=
+for path in $target_paths; do
+    mkdir -p $tempdir/`dirname $path`
+    cp -pH $path $tempdir/$path
 
-        mkdir -p $tempdir/`dirname $target`
-        # Relative links are used because the files are checked for being
-        # executable outside the chroot
-        link_rel $path $target $tempdir
+    if test -f $tempdir/$path -a -x $tempdir/$path; then
+        strip -s $tempdir/$path 2>/dev/null
+    fi
 
-        if test -f $tempdir/$path -a -x $tempdir/$path; then
-            strip -s $tempdir/$path 2>/dev/null
-        fi
+    fix_rpath $tempdir/$path `dirname $path`
+    target_files="$target_files $path"
+done
 
-        fix_rpath $tempdir/$path `dirname $path`
+for i in $target_aliases; do
+    target=`echo $i | cut -d= -f1`
+    link_name=`echo $i | cut -d= -f2`
 
-        path=`echo $path | cut -b2-`
-        new_target_files="$new_target_files $path"
-    fi
+    mkdir -p $tempdir/`dirname $link_name`
+    # Relative links are used because the files are checked for being
+    # executable outside the chroot
+    link_rel $target $link_name $tempdir
 
-    target=`echo $target | cut -b2-`
-    new_target_files="$new_target_files $target"
+    link_name=`echo $link_name | cut -b2-`
+    target_files="$target_files $link_name"
 done
 
 #sort the files
-target_files=`for i in $new_target_files; do echo $i; done | sort`
+target_files=`for i in $target_files; do echo $i; done | sort`
 
 #test if an archive name was supplied
 #if not use the md5 of all files as the archive name
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 12/17] toolchain-shar-extract: Add post-relocate scripts
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (10 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 11/17] icecc-create-env: Allow multiple tool aliases Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 13/17] icecc-toolchain: Add SDK icecream setup Joshua Watt
                     ` (4 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Recipes can now install post-relocation scripts which will be run when
the SDK is installed.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/toolchain-scripts.bbclass     | 15 +++++++++++++++
 meta/files/toolchain-shar-extract.sh       |  8 ++++++++
 meta/recipes-core/meta/meta-environment.bb |  2 ++
 3 files changed, 25 insertions(+)

diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass
index 9bcfe708c7c..eeb320d15a8 100644
--- a/meta/classes/toolchain-scripts.bbclass
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -116,6 +116,21 @@ fi
 EOF
 }
 
+toolchain_create_post_relocate_script() {
+	script=$1
+	rm -f $script
+	touch $script
+
+    cat >> $script <<EOF
+if [ -d "${SDKPATHNATIVE}/post-relocate-setup.d/" ]; then
+    for s in ${SDKPATHNATIVE}/post-relocate-setup.d/*.sh; do
+        \$s "\$1"
+    done
+    rm -rf "${SDKPATHNATIVE}/post-relocate-setup.d"
+fi
+EOF
+}
+
 #we get the cached site config in the runtime
 TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d)}"
 TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d"
diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 91804ec2818..f7ab43066fb 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -259,6 +259,14 @@ if [ $savescripts = 0 ] ; then
 	$SUDO_EXEC rm -f ${env_setup_script%/*}/relocate_sdk.py ${env_setup_script%/*}/relocate_sdk.sh
 fi
 
+# Execute post-relocation script
+post_relocate="$target_sdk_dir/post-relocate-setup.sh"
+if [ -e "$post_relocate" ]; then
+	$SUDO_EXEC sed -e "s:@SDKPATH@:$target_sdk_dir:g" -i $post_relocate
+	$SUDO_EXEC /bin/sh $post_relocate "$target_sdk_dir" "@SDKPATH@"
+	$SUDO_EXEC rm -f $post_relocate
+fi
+
 echo "SDK has been successfully set up and is ready to be used."
 echo "Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g."
 for env_setup_script in `ls $target_sdk_dir/environment-setup-*`; do
diff --git a/meta/recipes-core/meta/meta-environment.bb b/meta/recipes-core/meta/meta-environment.bb
index 29da121a3a9..09f757a087c 100644
--- a/meta/recipes-core/meta/meta-environment.bb
+++ b/meta/recipes-core/meta/meta-environment.bb
@@ -55,6 +55,8 @@ create_sdk_files() {
 
 	# Add version information
 	toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS}
+
+	toolchain_create_post_relocate_script ${SDK_OUTPUT}/${SDKPATH}/post-relocate-setup.sh
 }
 
 do_install() {
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 13/17] icecc-toolchain: Add SDK icecream setup
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (11 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 12/17] toolchain-shar-extract: Add post-relocate scripts Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 14/17] icecc.bbclass: Add Icecream support to SDK Joshua Watt
                     ` (3 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Icecream can now be optionally included in the generated SDK by
including nativesdk-icecc-toolchain to TOOLCHAIN_HOST_TASK. When the SDK
is installed a post-relocation script will check if icecc exists and if
so will generate the toolchain environment.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-toolchain/icecc-toolchain/icecc-env.sh   | 37 +++++++++++++++++++
 .../icecc-toolchain/icecc-toolchain/icecc-setup.sh | 43 ++++++++++++++++++++++
 .../nativesdk-icecc-toolchain_0.1.bb               | 38 +++++++++++++++++++
 3 files changed, 118 insertions(+)
 create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
 create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
 create mode 100644 meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb

diff --git a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
new file mode 100644
index 00000000000..9c9bb4dc4ea
--- /dev/null
+++ b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (c) 2018 Joshua Watt, Garmin International,Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+
+if [ -z "$ICECC_PATH" ]; then
+    ICECC_PATH=$(which icecc 2> /dev/null)
+fi
+
+if [ -n "$ICECC_PATH" ]; then
+    export ICECC_PATH
+    export ICECC_VERSION="$OECORE_NATIVE_SYSROOT/usr/share/icecream/@TOOLCHAIN_ENV@"
+    export ICECC="$(which ${CROSS_COMPILE}gcc)"
+    export ICECXX="$(which ${CROSS_COMPILE}g++)"
+    export ICEAS="$(which ${CROSS_COMPILE}as)"
+    export PATH="$OECORE_NATIVE_SYSROOT/usr/share/icecream/bin:$PATH"
+else
+    echo "Icecc not found. Disabling distributed compiling"
+fi
+
diff --git a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
new file mode 100644
index 00000000000..04808265781
--- /dev/null
+++ b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (c) 2018 Joshua Watt, Garmin International,Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+
+# Setup environment
+for env_setup_script in `ls $1/environment-setup-*`; do
+	. $env_setup_script
+done
+
+# ICECC_PATH will have been found icecc-env.sh
+if [ -z "$ICECC_PATH" ]; then
+    exit 0
+fi
+
+echo "Setting up IceCream distributed compiling..."
+
+# Create the environment
+mkdir -p "`dirname $ICECC_VERSION`"
+icecc-create-env $ICECC $ICECXX $ICEAS $ICECC_VERSION || exit $?
+
+# Create symbolic links
+d="$OECORE_NATIVE_SYSROOT/usr/share/icecream/bin"
+mkdir -p "$d"
+ln -s "$ICECC_PATH" "$d/${CROSS_COMPILE}gcc"
+ln -s "$ICECC_PATH" "$d/${CROSS_COMPILE}g++"
diff --git a/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb
new file mode 100644
index 00000000000..91958d7fbcc
--- /dev/null
+++ b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb
@@ -0,0 +1,38 @@
+# Copyright (c) 2018 Joshua Watt, Garmin International,Inc.
+# Released under the MIT license (see COPYING.MIT for the terms)
+SUMMARY = "Generates Icecream toolchain for SDK"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${WORKDIR}/icecc-env.sh;beginline=2;endline=20;md5=aafdb7bc2aa7ac5d039fda0c8733983c"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+SRC_URI = "\
+    file://icecc-env.sh \
+    file://icecc-setup.sh \
+    "
+
+inherit nativesdk
+
+ENV_NAME="${DISTRO}-${TCLIBC}-${SDK_ARCH}-${TUNE_PKGARCH}-${DISTRO_VERSION}.tar.gz"
+
+do_compile() {
+}
+
+do_install() {
+    install -d ${D}${SDKPATHNATIVE}${datadir}/icecream/bin
+
+    install -d ${D}${SDKPATHNATIVE}/environment-setup.d/
+    install -m 0644 ${WORKDIR}/icecc-env.sh ${D}${SDKPATHNATIVE}/environment-setup.d/
+    sed -i ${D}${SDKPATHNATIVE}/environment-setup.d/icecc-env.sh \
+        -e "s,@TOOLCHAIN_ENV@,${ENV_NAME},g"
+
+    install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
+    install -m 0755 ${WORKDIR}/icecc-setup.sh ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
+    sed -i ${D}${SDKPATHNATIVE}/post-relocate-setup.d/icecc-setup.sh \
+        -e "s,@TOOLCHAIN_ENV@,${ENV_NAME},g"
+}
+
+PACKAGES = "${PN}"
+FILES_${PN} = "${SDKPATHNATIVE}"
+RDEPENDS_${PN} += "nativesdk-icecc-create-env"
+
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 14/17] icecc.bbclass: Add Icecream support to SDK
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (12 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 13/17] icecc-toolchain: Add SDK icecream setup Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 15/17] icecc.bbclass: Disable caret workaround by default Joshua Watt
                     ` (2 subsequent siblings)
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

If icecc is inherited, generated SDKs will automatically have optional
support for compiling using the Icecream distributed compiler

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 9d5eaed57ce..8492ece60c3 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -346,3 +346,10 @@ do_compile_kernelmodules_prepend() {
 do_install_prepend() {
     set_icecc_env
 }
+
+# IceCream is not (currently) supported in the extensible SDK
+ICECC_SDK_HOST_TASK = "nativesdk-icecc-toolchain"
+ICECC_SDK_HOST_TASK_task-populate-sdk-ext = ""
+
+# Add the toolchain scripts to the SDK
+TOOLCHAIN_HOST_TASK_append = " ${ICECC_SDK_HOST_TASK}"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 15/17] icecc.bbclass: Disable caret workaround by default
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (13 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 14/17] icecc.bbclass: Add Icecream support to SDK Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 16/17] icecc-toolchain: Disable caret workaround Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 17/17] elfutils: Use fallthrough attribute Joshua Watt
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Icecream has a behavior that causes it to recompile files locally if gcc
generates any warnings or errors. The reason for this is that GCC tries
to re-read the input file in order to display the offending line with a
caret below it, which doesn't work in the remote chroot.

Default to disabling this this workaround and add
-fno-diagnostics-show-caret to the GCC flags so that errors and warnings
generated by GCC do not show erroneous results.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/classes/icecc.bbclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index 8492ece60c3..e8f7eab1bc1 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -28,10 +28,23 @@
 #Error checking is kept to minimum so double check any parameters you pass to the class
 ###########################################################################################
 
-BB_HASHBASE_WHITELIST += "ICECC_PARALLEL_MAKE ICECC_DISABLED ICECC_USER_PACKAGE_BL ICECC_USER_CLASS_BL ICECC_USER_PACKAGE_WL ICECC_PATH ICECC_ENV_EXEC"
+BB_HASHBASE_WHITELIST += "ICECC_PARALLEL_MAKE ICECC_DISABLED ICECC_USER_PACKAGE_BL \
+    ICECC_USER_CLASS_BL ICECC_USER_PACKAGE_WL ICECC_PATH ICECC_ENV_EXEC \
+    ICECC_CARET_WORKAROUND ICECC_CFLAGS"
 
 ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env"
 
+# Default to disabling the caret workaround, If set to "1" in local.conf, icecc
+# will locally recompile any files that have warnings, which can adversely
+# affect performance.
+#
+# See: https://github.com/icecc/icecream/issues/190
+export ICECC_CARET_WORKAROUND ??= "0"
+
+ICECC_CFLAGS = ""
+CFLAGS += "${ICECC_CFLAGS}"
+CXXFLAGS += "${ICECC_CFLAGS}"
+
 def icecc_dep_prepend(d):
     # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command.  Whether or  not
     # we need that built is the responsibility of the patch function / class, not
@@ -170,6 +183,11 @@ def icecc_version(bb, d):
     if not d.getVar('PARALLEL_MAKE', False) == "" and parallel:
         d.setVar("PARALLEL_MAKE", parallel)
 
+    # Disable showing the caret in the GCC compiler output if the workaround is
+    # disabled
+    if d.getVar('ICECC_CARET_WORKAROUND', True) == '0':
+        d.setVar('ICECC_CFLAGS', '-fno-diagnostics-show-caret')
+
     if icecc_is_native(bb, d):
         archive_name = "local-host-env"
     elif d.expand('${HOST_PREFIX}') == "":
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 16/17] icecc-toolchain: Disable caret workaround
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (14 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 15/17] icecc.bbclass: Disable caret workaround by default Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  2018-02-12 16:52   ` [PATCH v2 17/17] elfutils: Use fallthrough attribute Joshua Watt
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Icecream has a behavior that causes it to recompile files locally if gcc
generates any warnings or errors. The reason for this is that GCC tries
to re-read the input file in order to display the offending line with a
caret below it, which doesn't work in the remote chroot.

Default to disabling this this workaround and add
-fno-diagnostics-show-caret to the GCC flags so that errors and warnings
generated by GCC do not show erroneous results. Users can override this
default in the SDK by defining ICECC_CARET_WORKAROUND="1" either before
or after sourcing the SDK environment.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .../icecc-toolchain/icecc-toolchain/icecc-env.sh           | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
index 9c9bb4dc4ea..94760076bfa 100644
--- a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
+++ b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
@@ -25,7 +25,19 @@ if [ -z "$ICECC_PATH" ]; then
 fi
 
 if [ -n "$ICECC_PATH" ]; then
-    export ICECC_PATH
+    # Default to disabling the caret workaround. If set to "1", icecc will
+    # locally recompile any files that have warnings, which can adversely
+    # affect performance.
+    #
+    # See: https://github.com/icecc/icecream/issues/190
+    if [ -z "$ICECC_CARET_WORKAROUND" ]; then
+        ICECC_CARET_WORKAROUND="0"
+    fi
+    if [ "$ICECC_CARET_WORKAROUND" != "1" ]; then
+        CFLAGS="$CFLAGS -fno-diagnostics-show-caret"
+        CXXFLAGS="$CXXFLAGS -fno-diagnostics-show-caret"
+    fi
+    export ICECC_PATH ICECC_CARET_WORKAROUND
     export ICECC_VERSION="$OECORE_NATIVE_SYSROOT/usr/share/icecream/@TOOLCHAIN_ENV@"
     export ICECC="$(which ${CROSS_COMPILE}gcc)"
     export ICECXX="$(which ${CROSS_COMPILE}g++)"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 17/17] elfutils: Use fallthrough attribute
  2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
                     ` (15 preceding siblings ...)
  2018-02-12 16:52   ` [PATCH v2 16/17] icecc-toolchain: Disable caret workaround Joshua Watt
@ 2018-02-12 16:52   ` Joshua Watt
  16 siblings, 0 replies; 40+ messages in thread
From: Joshua Watt @ 2018-02-12 16:52 UTC (permalink / raw)
  To: OE-core; +Cc: Tomas Novotny

Patches elfutils to use the fallthrough attribute instead of comments to
satisfy the -Wimplicit-fallthrough warning. Using comments is
insufficient when compiling remotely with Icecream because the file gets
pre-processed locally, removing the comments

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/recipes-devtools/elfutils/elfutils_0.170.bb   |   4 +-
 .../files/0001-Use-fallthrough-attribute.patch     | 791 +++++++++++++++++++++
 .../elfutils/files/debian/fallthrough.patch        |  36 -
 3 files changed, 793 insertions(+), 38 deletions(-)
 create mode 100644 meta/recipes-devtools/elfutils/files/0001-Use-fallthrough-attribute.patch
 delete mode 100644 meta/recipes-devtools/elfutils/files/debian/fallthrough.patch

diff --git a/meta/recipes-devtools/elfutils/elfutils_0.170.bb b/meta/recipes-devtools/elfutils/elfutils_0.170.bb
index 3b81e287b01..9242aea26b5 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.170.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.170.bb
@@ -32,8 +32,8 @@ SRC_URI += "\
         file://debian/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch \
         file://debian/0003-Add-mips-n64-relocation-format-hack.patch \
 "
-# Fix the patches from Debian with GCC7
-SRC_URI += "file://debian/fallthrough.patch"
+# Fix fallthrough with GCC7
+SRC_URI += "file://0001-Use-fallthrough-attribute.patch"
 
 # The buildsystem wants to generate 2 .h files from source using a binary it just built,
 # which can not pass the cross compiling, so let's work around it by adding 2 .h files
diff --git a/meta/recipes-devtools/elfutils/files/0001-Use-fallthrough-attribute.patch b/meta/recipes-devtools/elfutils/files/0001-Use-fallthrough-attribute.patch
new file mode 100644
index 00000000000..5e2155b3c66
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0001-Use-fallthrough-attribute.patch
@@ -0,0 +1,791 @@
+From 5cb883f67d00a63531ef195c242763d36b1905ca Mon Sep 17 00:00:00 2001
+From: Joshua Watt <Joshua.Watt@garmin.com>
+Date: Fri, 9 Feb 2018 12:46:38 -0600
+Subject: [PATCH] Use fallthrough attribute
+
+Use __attribute__ ((fallthrough)) to indicate switch case fall through
+instead of a comment. This ensure that the fallthrough warning is not
+triggered even if the file is pre-processed (hence stripping the
+comments) before it is compiled.
+
+The actual fallback implementation is hidden behind a FALLBACK macro in
+case the compiler doesn't support it.
+
+Finally, the -Wimplict-fallthrough warning was upgraded to only allow
+the attribute to satisfy it; a comment alone is no longer sufficient.
+
+Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
+
+Upstream-Status: Submitted [1]
+
+[1] https://sourceware.org/ml/elfutils-devel/2018-q1/msg00027.html
+---
+ backends/aarch64_retval.c    | 2 +-
+ backends/alpha_retval.c      | 4 ++--
+ backends/arm_regs.c          | 2 +-
+ backends/arm_retval.c        | 2 +-
+ backends/i386_regs.c         | 2 +-
+ backends/i386_retval.c       | 4 ++--
+ backends/ia64_retval.c       | 2 +-
+ backends/linux-core-note.c   | 2 +-
+ backends/m68k_retval.c       | 4 ++--
+ backends/mips_retval.c       | 4 ++--
+ backends/parisc_retval.c     | 5 +++--
+ backends/ppc64_retval.c      | 6 +++---
+ backends/ppc_regs.c          | 2 +-
+ backends/ppc_retval.c        | 4 ++--
+ backends/s390_retval.c       | 4 ++--
+ backends/sh_retval.c         | 2 +-
+ backends/sparc_retval.c      | 2 +-
+ backends/tilegx_retval.c     | 4 ++--
+ backends/x86_64_regs.c       | 2 +-
+ backends/x86_64_retval.c     | 2 +-
+ config/eu.am                 | 4 +++-
+ configure.ac                 | 6 ++++++
+ lib/eu-config.h              | 7 +++++++
+ libcpu/i386_disasm.c         | 2 +-
+ libcpu/i386_parse.c          | 4 ++--
+ libdw/cfi.c                  | 4 ++--
+ libdw/dwarf_frame_register.c | 2 +-
+ libdwfl/dwfl_report_elf.c    | 2 +-
+ libdwfl/frame_unwind.c       | 2 +-
+ libebl/eblobjnote.c          | 2 +-
+ libelf/elf32_updatenull.c    | 2 +-
+ libelf/elf_begin.c           | 4 ++--
+ libelf/elf_cntl.c            | 2 +-
+ src/addr2line.c              | 2 +-
+ src/elfcompress.c            | 2 +-
+ src/elflint.c                | 8 ++++----
+ src/objdump.c                | 2 +-
+ src/readelf.c                | 8 ++++----
+ src/strings.c                | 2 +-
+ tests/backtrace.c            | 2 +-
+ tests/elfstrmerge.c          | 3 ++-
+ 41 files changed, 75 insertions(+), 58 deletions(-)
+
+diff --git a/backends/aarch64_retval.c b/backends/aarch64_retval.c
+index 68de307..1308340 100644
+--- a/backends/aarch64_retval.c
++++ b/backends/aarch64_retval.c
+@@ -292,7 +292,7 @@ aarch64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  assert (count > 0);
+ 	  if (count <= 4)
+ 	    return pass_hfa (locp, base_size, count);
+-	  /* Fall through.  */
++	  FALLTHROUGH;
+ 
+ 	case 1:
+ 	  /* Not a HFA.  */
+diff --git a/backends/alpha_retval.c b/backends/alpha_retval.c
+index 53dbfa4..d9bae3b 100644
+--- a/backends/alpha_retval.c
++++ b/backends/alpha_retval.c
+@@ -85,7 +85,7 @@ alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+@@ -131,7 +131,7 @@ alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  }
+       }
+ 
+-      /* Else fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_structure_type:
+     case DW_TAG_class_type:
+diff --git a/backends/arm_regs.c b/backends/arm_regs.c
+index 4ee1039..418c931 100644
+--- a/backends/arm_regs.c
++++ b/backends/arm_regs.c
+@@ -81,7 +81,7 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)),
+        * but gcc maps FPA registers here
+        */
+       regno += 96 - 16;
+-      /* Fall through.  */
++      FALLTHROUGH;
+     case 96 + 0 ... 96 + 7:
+       *setname = "FPA";
+       *type = DW_ATE_float;
+diff --git a/backends/arm_retval.c b/backends/arm_retval.c
+index 8687eab..313e4eb 100644
+--- a/backends/arm_retval.c
++++ b/backends/arm_retval.c
+@@ -90,7 +90,7 @@ arm_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp,
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+diff --git a/backends/i386_regs.c b/backends/i386_regs.c
+index fd963a6..7ec93bb 100644
+--- a/backends/i386_regs.c
++++ b/backends/i386_regs.c
+@@ -92,7 +92,7 @@ i386_register_info (Ebl *ebl __attribute__ ((unused)),
+     case 5:
+     case 8:
+       *type = DW_ATE_address;
+-      /* Fallthrough */
++      FALLTHROUGH;
+     case 0 ... 3:
+     case 6 ... 7:
+       name[0] = 'e';
+diff --git a/backends/i386_retval.c b/backends/i386_retval.c
+index 4aa646f..32fec72 100644
+--- a/backends/i386_retval.c
++++ b/backends/i386_retval.c
+@@ -85,7 +85,7 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+@@ -123,7 +123,7 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	if (size <= 8)
+ 	  return nloc_intregpair;
+       }
+-    /* Fallthrough */
++    FALLTHROUGH;
+ 
+     case DW_TAG_structure_type:
+     case DW_TAG_class_type:
+diff --git a/backends/ia64_retval.c b/backends/ia64_retval.c
+index dcd5f28..03ea4d8 100644
+--- a/backends/ia64_retval.c
++++ b/backends/ia64_retval.c
+@@ -260,7 +260,7 @@ ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c
+index 67638d7..5f06c89 100644
+--- a/backends/linux-core-note.c
++++ b/backends/linux-core-note.c
+@@ -226,7 +226,7 @@ EBLHOOK(core_note) (const GElf_Nhdr *nhdr, const char *name,
+       if (memcmp (name, "CORE", nhdr->n_namesz) == 0)
+ 	break;
+       /* Buggy old Linux kernels didn't terminate "LINUX".  */
+-      /* Fall through. */
++      FALLTHROUGH;
+ 
+     case sizeof "LINUX":
+       if (memcmp (name, "LINUX", nhdr->n_namesz) == 0)
+diff --git a/backends/m68k_retval.c b/backends/m68k_retval.c
+index c68ed02..a653ba3 100644
+--- a/backends/m68k_retval.c
++++ b/backends/m68k_retval.c
+@@ -92,7 +92,7 @@ m68k_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+@@ -135,7 +135,7 @@ m68k_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	if (size <= 8)
+ 	  return nloc_intregpair;
+       }
+-      /* Fallthrough */
++      FALLTHROUGH;
+     case DW_TAG_structure_type:
+     case DW_TAG_class_type:
+     case DW_TAG_union_type:
+diff --git a/backends/mips_retval.c b/backends/mips_retval.c
+index 57487bb..c6e1ffe 100644
+--- a/backends/mips_retval.c
++++ b/backends/mips_retval.c
+@@ -306,7 +306,7 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = dwarf_tag (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+@@ -389,7 +389,7 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+             }
+         }
+ 
+-      /* Fallthrough to handle large types */
++      FALLTHROUGH; /* Fallthrough to handle large types */
+ 
+     case DW_TAG_array_type:
+     large:
+diff --git a/backends/parisc_retval.c b/backends/parisc_retval.c
+index df7ec3a..1f1e91a 100644
+--- a/backends/parisc_retval.c
++++ b/backends/parisc_retval.c
+@@ -116,7 +116,7 @@ parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, in
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = dwarf_tag (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+@@ -167,6 +167,7 @@ parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, in
+ 
+ 	/* Else fall through.  */
+       }
++      FALLTHROUGH;
+ 
+     case DW_TAG_structure_type:
+     case DW_TAG_class_type:
+@@ -189,7 +190,7 @@ parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, in
+         *locp = loc_aggregate;
+         return nloc_aggregate;
+ #endif
+-	/* fall through.  */
++	FALLTHROUGH;
+       }
+     }
+ 
+diff --git a/backends/ppc64_retval.c b/backends/ppc64_retval.c
+index a251983..eb1c11e 100644
+--- a/backends/ppc64_retval.c
++++ b/backends/ppc64_retval.c
+@@ -96,7 +96,7 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+@@ -141,7 +141,7 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  return nloc_intreg;
+ 	}
+ 
+-      /* Else fall through.  */
++      FALLTHROUGH;
+     case DW_TAG_structure_type:
+     case DW_TAG_class_type:
+     case DW_TAG_union_type:
+@@ -161,7 +161,7 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	    return nloc_vmxreg;
+ 	  }
+       }
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_string_type:
+       if (dwarf_aggregate_size (typedie, &size) == 0 && size <= 8)
+diff --git a/backends/ppc_regs.c b/backends/ppc_regs.c
+index c2d5011..43d2534 100644
+--- a/backends/ppc_regs.c
++++ b/backends/ppc_regs.c
+@@ -140,7 +140,7 @@ ppc_register_info (Ebl *ebl __attribute__ ((unused)),
+     case 100:
+       if (*bits == 32)
+ 	return stpcpy (name, "mq") + 1 - name;
+-      /* Fallthrough */
++      FALLTHROUGH;
+     case 102 ... 107:
+       name[0] = 's';
+       name[1] = 'p';
+diff --git a/backends/ppc_retval.c b/backends/ppc_retval.c
+index b14a99f..39b42da 100644
+--- a/backends/ppc_retval.c
++++ b/backends/ppc_retval.c
+@@ -108,7 +108,7 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+@@ -172,7 +172,7 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	      return nloc_intregquad;
+ 	    }
+       }
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_structure_type:
+     case DW_TAG_class_type:
+diff --git a/backends/s390_retval.c b/backends/s390_retval.c
+index a927d46..2043f98 100644
+--- a/backends/s390_retval.c
++++ b/backends/s390_retval.c
+@@ -87,7 +87,7 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+@@ -127,7 +127,7 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	    return size <= asize ? nloc_intreg : nloc_intregpair;
+ 	  }
+       }
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_structure_type:
+     case DW_TAG_class_type:
+diff --git a/backends/sh_retval.c b/backends/sh_retval.c
+index d44f260..33d7d96 100644
+--- a/backends/sh_retval.c
++++ b/backends/sh_retval.c
+@@ -84,7 +84,7 @@ sh_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+diff --git a/backends/sparc_retval.c b/backends/sparc_retval.c
+index e1b1775..fb81cdc 100644
+--- a/backends/sparc_retval.c
++++ b/backends/sparc_retval.c
+@@ -91,7 +91,7 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+diff --git a/backends/tilegx_retval.c b/backends/tilegx_retval.c
+index db81a20..7f7d24b 100644
+--- a/backends/tilegx_retval.c
++++ b/backends/tilegx_retval.c
+@@ -79,7 +79,7 @@ tilegx_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+@@ -113,7 +113,7 @@ tilegx_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  return nloc_intreg;
+ 	}
+ 
+-      /* Else fall through.  */
++      FALLTHROUGH;
+     case DW_TAG_structure_type:
+     case DW_TAG_class_type:
+     case DW_TAG_union_type:
+diff --git a/backends/x86_64_regs.c b/backends/x86_64_regs.c
+index 8430440..ef987da 100644
+--- a/backends/x86_64_regs.c
++++ b/backends/x86_64_regs.c
+@@ -87,7 +87,7 @@ x86_64_register_info (Ebl *ebl __attribute__ ((unused)),
+ 
+     case 6 ... 7:
+       *type = DW_ATE_address;
+-      /* Fallthrough */
++      FALLTHROUGH;
+     case 0 ... 5:
+       name[0] = 'r';
+       name[1] = baseregs[regno][0];
+diff --git a/backends/x86_64_retval.c b/backends/x86_64_retval.c
+index b3799ae..f9114cb 100644
+--- a/backends/x86_64_retval.c
++++ b/backends/x86_64_retval.c
+@@ -100,7 +100,7 @@ x86_64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+ 	  typedie = dwarf_formref_die (attr, &die_mem);
+ 	  tag = DWARF_TAG_OR_RETURN (typedie);
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+ 
+     case DW_TAG_base_type:
+     case DW_TAG_enumeration_type:
+diff --git a/config/eu.am b/config/eu.am
+index 8fe1e25..b6ec581 100644
+--- a/config/eu.am
++++ b/config/eu.am
+@@ -62,7 +62,9 @@ NULL_DEREFERENCE_WARNING=
+ endif
+ 
+ if HAVE_IMPLICIT_FALLTHROUGH_WARNING
+-IMPLICIT_FALLTHROUGH_WARNING=-Wimplicit-fallthrough
++# Use strict fallthrough. Only __attribute__((fallthrough)) will prevent the
++# warning
++IMPLICIT_FALLTHROUGH_WARNING=-Wimplicit-fallthrough=5
+ else
+ IMPLICIT_FALLTHROUGH_WARNING=
+ endif
+diff --git a/configure.ac b/configure.ac
+index 1f1856d..698efbb 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -360,6 +360,12 @@ CFLAGS="$old_CFLAGS"])
+ AM_CONDITIONAL(HAVE_IMPLICIT_FALLTHROUGH_WARNING,
+ 	       [test "x$ac_cv_implicit_fallthrough" != "xno"])
+ 
++# Assume the fallthrough attribute is supported if -Wimplict-fallthrough is supported
++if test "$ac_cv_implicit_fallthrough" = "yes"; then
++	AC_DEFINE([HAVE_FALLTHROUGH], [1],
++		  [Defined if __attribute__((fallthrough)) is supported])
++fi
++
+ dnl Check if we have argp available from our libc
+ AC_LINK_IFELSE(
+ 	[AC_LANG_PROGRAM(
+diff --git a/lib/eu-config.h b/lib/eu-config.h
+index 400cdc6..e8d4ec2 100644
+--- a/lib/eu-config.h
++++ b/lib/eu-config.h
+@@ -186,5 +186,12 @@ asm (".section predict_data, \"aw\"; .previous\n"
+ # define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SYMBOL_VERSIONING"
+ #endif
+ 
++#ifndef FALLTHROUGH
++# ifdef HAVE_FALLTHROUGH
++#  define FALLTHROUGH __attribute__ ((fallthrough))
++# else
++#  define FALLTHROUGH ((void) 0)
++# endif
++#endif
+ 
+ #endif	/* eu-config.h */
+diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
+index 60fd6d4..837a3a8 100644
+--- a/libcpu/i386_disasm.c
++++ b/libcpu/i386_disasm.c
+@@ -819,7 +819,7 @@ i386_disasm (Ebl *ebl __attribute__((unused)),
+ 			      ++param_start;
+ 			      break;
+ 			    }
+-			  /* Fallthrough */
++			  FALLTHROUGH;
+ 			default:
+ 			  str = "";
+ 			  assert (! "INVALID not handled");
+diff --git a/libcpu/i386_parse.c b/libcpu/i386_parse.c
+index ef1ac35..6fa7ce3 100644
+--- a/libcpu/i386_parse.c
++++ b/libcpu/i386_parse.c
+@@ -1047,7 +1047,7 @@ yytnamerr (char *yyres, const char *yystr)
+           case '\\':
+             if (*++yyp != '\\')
+               goto do_not_strip_quotes;
+-            /* Fall through.  */
++            FALLTHROUGH;
+           default:
+             if (yyres)
+               yyres[yyn] = *yyp;
+@@ -2042,7 +2042,7 @@ yyabortlab:
+ yyexhaustedlab:
+   yyerror (YY_("memory exhausted"));
+   yyresult = 2;
+-  /* Fall through.  */
++  FALLTHROUGH;
+ #endif
+ 
+ yyreturn:
+diff --git a/libdw/cfi.c b/libdw/cfi.c
+index daa845f..341e055 100644
+--- a/libdw/cfi.c
++++ b/libdw/cfi.c
+@@ -138,7 +138,7 @@ execute_cfi (Dwarf_CFI *cache,
+ 
+ 	case DW_CFA_advance_loc1:
+ 	  operand = *program++;
+-	  /* Fallthrough */
++	  FALLTHROUGH;
+ 	case DW_CFA_advance_loc + 0 ... DW_CFA_advance_loc + CFI_PRIMARY_MAX:
+ 	advance_loc:
+ 	  loc += operand * cie->code_alignment_factor;
+@@ -301,7 +301,7 @@ execute_cfi (Dwarf_CFI *cache,
+ 
+ 	case DW_CFA_restore_extended:
+ 	  get_uleb128 (operand, program, end);
+-	  /* Fallthrough */
++	  FALLTHROUGH;
+ 	case DW_CFA_restore + 0 ... DW_CFA_restore + CFI_PRIMARY_MAX:
+ 
+ 	  if (unlikely (abi_cfi) && likely (opcode == DW_CFA_restore))
+diff --git a/libdw/dwarf_frame_register.c b/libdw/dwarf_frame_register.c
+index 37e8e91..d0159fb 100644
+--- a/libdw/dwarf_frame_register.c
++++ b/libdw/dwarf_frame_register.c
+@@ -62,7 +62,7 @@ dwarf_frame_register (Dwarf_Frame *fs, int regno, Dwarf_Op *ops_mem,
+       /* Use the default rule for registers not yet mentioned in CFI.  */
+       if (fs->cache->default_same_value)
+ 	goto same_value;
+-      /*FALLTHROUGH*/
++      FALLTHROUGH;
+     case reg_undefined:
+       /* The value is known to be unavailable.  */
+       break;
+diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c
+index 6950a37..3fc9384 100644
+--- a/libdwfl/dwfl_report_elf.c
++++ b/libdwfl/dwfl_report_elf.c
+@@ -174,7 +174,7 @@ __libdwfl_elf_address_range (Elf *elf, GElf_Addr base, bool add_p_vaddr,
+       /* An assigned base address is meaningless for these.  */
+       base = 0;
+       add_p_vaddr = true;
+-      /* Fallthrough. */
++      FALLTHROUGH;
+     case ET_DYN:
+     default:;
+       size_t phnum;
+diff --git a/libdwfl/frame_unwind.c b/libdwfl/frame_unwind.c
+index 4dc9c43..eaea495 100644
+--- a/libdwfl/frame_unwind.c
++++ b/libdwfl/frame_unwind.c
+@@ -442,7 +442,7 @@ expr_eval (Dwfl_Frame *state, Dwarf_Frame *frame, const Dwarf_Op *ops,
+ 	    }
+ 	  if (val1 == 0)
+ 	    break;
+-	  /* FALLTHRU */
++	  FALLTHROUGH;
+ 	case DW_OP_skip:;
+ 	  Dwarf_Word offset = op->offset + 1 + 2 + (int16_t) op->number;
+ 	  const Dwarf_Op *found = bsearch ((void *) (uintptr_t) offset, ops, nops,
+diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c
+index f80a1a5..ca4f155 100644
+--- a/libebl/eblobjnote.c
++++ b/libebl/eblobjnote.c
+@@ -223,7 +223,7 @@ ebl_object_note (Ebl *ebl, const char *name, uint32_t type,
+ 		free (buf);
+ 	      break;
+ 	    }
+-	  /* FALLTHROUGH */
++	  FALLTHROUGH;
+ 
+ 	default:
+ 	  /* Unknown type.  */
+diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
+index a51bf70..5351518 100644
+--- a/libelf/elf32_updatenull.c
++++ b/libelf/elf32_updatenull.c
+@@ -232,7 +232,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
+ 		      __libelf_seterrno (ELF_E_GROUP_NOT_REL);
+ 		      return -1;
+ 		    }
+-		  /* FALLTHROUGH */
++		  FALLTHROUGH;
+ 		case SHT_SYMTAB_SHNDX:
+ 		  sh_entsize = elf_typesize (32, ELF_T_WORD, 1);
+ 		  break;
+diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
+index 6f85038..6de206a 100644
+--- a/libelf/elf_begin.c
++++ b/libelf/elf_begin.c
+@@ -582,7 +582,7 @@ read_unmmaped_file (int fildes, off_t offset, size_t maxsize, Elf_Cmd cmd,
+ 			     ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr)))
+ 	return file_read_elf (fildes, NULL, mem.header, offset, maxsize, cmd,
+ 			      parent);
+-      /* FALLTHROUGH */
++      FALLTHROUGH;
+ 
+     default:
+       break;
+@@ -1097,7 +1097,7 @@ elf_begin (int fildes, Elf_Cmd cmd, Elf *ref)
+ 	  retval = NULL;
+ 	  break;
+ 	}
+-      /* FALLTHROUGH */
++      FALLTHROUGH;
+ 
+     case ELF_C_READ:
+     case ELF_C_READ_MMAP:
+diff --git a/libelf/elf_cntl.c b/libelf/elf_cntl.c
+index ab13ffb..fd68178 100644
+--- a/libelf/elf_cntl.c
++++ b/libelf/elf_cntl.c
+@@ -62,7 +62,7 @@ elf_cntl (Elf *elf, Elf_Cmd cmd)
+ 	  result = -1;
+ 	  break;
+ 	}
+-      /* FALLTHROUGH */
++      FALLTHROUGH;
+ 
+     case ELF_C_FDDONE:
+       /* Mark the file descriptor as not usable.  */
+diff --git a/src/addr2line.c b/src/addr2line.c
+index ba414a7..444ee52 100644
+--- a/src/addr2line.c
++++ b/src/addr2line.c
+@@ -618,7 +618,7 @@ handle_address (const char *string, Dwfl *dwfl)
+ 	case 1:
+ 	  addr = 0;
+ 	  j = i;
+-	  /* Fallthrough */
++	  FALLTHROUGH;
+ 	case 2:
+ 	  if (string[j] != '\0')
+ 	    break;
+diff --git a/src/elfcompress.c b/src/elfcompress.c
+index 8e0d5c5..25378a4 100644
+--- a/src/elfcompress.c
++++ b/src/elfcompress.c
+@@ -149,7 +149,7 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
+ 		    N_("Only one input file allowed together with '-o'"));
+       /* We only use this for checking the number of arguments, we don't
+ 	 actually want to consume them.  */
+-      /* Fallthrough */
++      FALLTHROUGH;
+     default:
+       return ARGP_ERR_UNKNOWN;
+     }
+diff --git a/src/elflint.c b/src/elflint.c
+index 51e53c2..df1b3a0 100644
+--- a/src/elflint.c
++++ b/src/elflint.c
+@@ -1764,7 +1764,7 @@ section [%2d] '%s': entry %zu: pointer does not match address of section [%2d] '
+ 	  if (dyn->d_tag < DT_ADDRRNGLO || dyn->d_tag > DT_ADDRRNGHI)
+ 	    /* Value is no pointer.  */
+ 	    break;
+-	  /* FALLTHROUGH */
++	  FALLTHROUGH;
+ 
+ 	case DT_AUXILIARY:
+ 	case DT_FILTER:
+@@ -3993,7 +3993,7 @@ section [%2zu] '%s': merge flag set but entry size is zero\n"),
+ 	    case SHT_NOBITS:
+ 	      if (is_debuginfo)
+ 		break;
+-	      /* Fallthrough */
++	      FALLTHROUGH;
+ 	    default:
+ 	      ERROR (gettext ("\
+ section [%2zu] '%s' has unexpected type %d for an executable section\n"),
+@@ -4137,7 +4137,7 @@ section [%2zu] '%s': ELF header says this is the section header string table but
+ 	    ERROR (gettext ("\
+ section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n"),
+ 		   cnt, section_name (ebl, cnt));
+-	  /* FALLTHROUGH */
++	  FALLTHROUGH;
+ 	case SHT_SYMTAB:
+ 	  check_symtab (ebl, ehdr, shdr, cnt);
+ 	  break;
+@@ -4336,7 +4336,7 @@ section [%2d] '%s': unknown core file note type %" PRIu32
+ 	    if (nhdr.n_namesz == sizeof "Linux"
+ 		&& !memcmp (data->d_buf + name_offset, "Linux", sizeof "Linux"))
+ 	      break;
+-	    /* Fallthrough */
++	    FALLTHROUGH;
+ 	  default:
+ 	    if (shndx == 0)
+ 	      ERROR (gettext ("\
+diff --git a/src/objdump.c b/src/objdump.c
+index 860cfac..0dd9a6a 100644
+--- a/src/objdump.c
++++ b/src/objdump.c
+@@ -223,7 +223,7 @@ parse_opt (int key, char *arg,
+ 	}
+       /* We only use this for checking the number of arguments, we don't
+ 	 actually want to consume them.  */
+-      /* Fallthrough */
++      FALLTHROUGH;
+     default:
+       return ARGP_ERR_UNKNOWN;
+     }
+diff --git a/src/readelf.c b/src/readelf.c
+index 346eccd..6a27e7e 100644
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -465,7 +465,7 @@ parse_opt (int key, char *arg,
+ 	  print_string_sections = true;
+ 	  break;
+ 	}
+-      /* Fall through.  */
++      FALLTHROUGH;
+     case 'x':
+       add_dump_section (arg, false);
+       any_control_option = true;
+@@ -6029,7 +6029,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
+ 			dwarf_form_name (form), (uintmax_t) num);
+ 	      return DWARF_CB_OK;
+ 	    }
+-	  /* else fallthrough */
++	  FALLTHROUGH;
+ 
+ 	/* These cases always take a loclistptr and no constant. */
+ 	case DW_AT_location:
+@@ -6195,7 +6195,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
+ 	      print_block (block.length, block.data);
+ 	      break;
+ 	    }
+-	  /* Fall through.  */
++	  FALLTHROUGH;
+ 
+ 	case DW_AT_location:
+ 	case DW_AT_data_location:
+@@ -9227,7 +9227,7 @@ handle_auxv_note (Ebl *ebl, Elf *core, GElf_Word descsz, GElf_Off desc_pos)
+ 		printf ("    %s\n", name);
+ 		break;
+ 	      }
+-	    /* Fall through */
++	    FALLTHROUGH;
+ 	  case 'x':		/* hex */
+ 	  case 'p':		/* address */
+ 	  case 's':		/* address of string */
+diff --git a/src/strings.c b/src/strings.c
+index d214356..03d0f13 100644
+--- a/src/strings.c
++++ b/src/strings.c
+@@ -246,7 +246,7 @@ parse_opt (int key, char *arg,
+ 	case 'b':
+ 	case 'B':
+ 	  big_endian = true;
+-	  /* FALLTHROUGH */
++	  FALLTHROUGH;
+ 
+ 	case 'l':
+ 	case 'L':
+diff --git a/tests/backtrace.c b/tests/backtrace.c
+index 21abe8a..f5dd761 100644
+--- a/tests/backtrace.c
++++ b/tests/backtrace.c
+@@ -127,7 +127,7 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
+ 	  assert (symname2 == NULL || strcmp (symname2, "jmp") != 0);
+ 	  break;
+ 	}
+-      /* FALLTHRU */
++      FALLTHROUGH;
+     case 4:
+       /* Some simple frame unwinders get this wrong and think sigusr2
+ 	 is calling itself again. Allow it and just pretend there is
+diff --git a/tests/elfstrmerge.c b/tests/elfstrmerge.c
+index 8d5b53c..62c549d 100644
+--- a/tests/elfstrmerge.c
++++ b/tests/elfstrmerge.c
+@@ -578,7 +578,8 @@ main (int argc, char **argv)
+ 	      break;
+ 
+ 	    case SHT_DYNAMIC:
+-	      /* Fallthrough.  There are string indexes in here, but
++	      FALLTHROUGH;
++	      /* There are string indexes in here, but
+ 		 they (should) point to a allocated string table,
+ 		 which we don't alter.  */
+ 	    default:
+-- 
+2.14.3
+
diff --git a/meta/recipes-devtools/elfutils/files/debian/fallthrough.patch b/meta/recipes-devtools/elfutils/files/debian/fallthrough.patch
deleted file mode 100644
index b2623f9d2e5..00000000000
--- a/meta/recipes-devtools/elfutils/files/debian/fallthrough.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-GCC7 adds -Wimplicit-fallthrough to warn when a switch case falls through,
-however this causes warnings (which are promoted to errors) with the elfutils
-patches from Debian for mips and parisc, which use fallthrough's by design.
-
-Explicitly mark the intentional fallthrough switch cases with a comment to
-disable the warnings where the fallthrough behaviour is desired.
-
-Upstream-Status: Pending [debian]
-Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
-
-Index: elfutils-0.168/backends/parisc_retval.c
-===================================================================
---- elfutils-0.168.orig/backends/parisc_retval.c
-+++ elfutils-0.168/backends/parisc_retval.c
-@@ -166,7 +166,7 @@ parisc_return_value_location_ (Dwarf_Die
- 	  return nloc_intregpair;
- 
- 	/* Else fall through.  */
--      }
-+      } // fallthrough
- 
-     case DW_TAG_structure_type:
-     case DW_TAG_class_type:
-Index: elfutils-0.168/backends/mips_retval.c
-===================================================================
---- elfutils-0.168.orig/backends/mips_retval.c
-+++ elfutils-0.168/backends/mips_retval.c
-@@ -387,7 +387,7 @@ mips_return_value_location (Dwarf_Die *f
-               else
-                 return nloc_intregpair;
-             }
--        }
-+        } // fallthrough
- 
-       /* Fallthrough to handle large types */
- 
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH 13/14] icecc-toolchain: Add SDK icecream setup
  2018-02-06 22:01 ` [PATCH 13/14] icecc-toolchain: Add SDK icecream setup Joshua Watt
@ 2018-02-16 23:43   ` Martin Jansa
  2018-02-16 23:50     ` Joshua Watt
  0 siblings, 1 reply; 40+ messages in thread
From: Martin Jansa @ 2018-02-16 23:43 UTC (permalink / raw)
  To: Joshua Watt; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 8874 bytes --]

Is the LIC_FILES_CHKSUM correct? Doesn't match here:


nativesdk-icecc-toolchain/0.1-r0/icecc-env.sh;beginline=2;en
dline=20;md5=aafdb7bc2aa7ac5d039fda0c8733983c
nativesdk-icecc-toolchain: The new md5 checksum is
dd6b68c1efed8a9fb04e409b3b287d47
nativesdk-icecc-toolchain: Here is the selected license text:
vvvvvvvvvvvvvvvvvvvvvvvvvvvv beginline=2 vvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# Copyright (c) 2018 Joshua Watt, Garmin International,Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
copy
# of this software and associated documentation files (the "Software"), to
deal
# in the Software without restriction, including without limitation the
rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE
# SOFTWARE.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ endline=20 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


On Tue, Feb 6, 2018 at 11:01 PM, Joshua Watt <jpewhacker@gmail.com> wrote:

> IceCream can now be optionally included in the generated SDK by
> including nativesdk-icecc-toolchain to TOOLCHAIN_HOST_TASK. When the SDK
> is installed, it will check if icecc exists, and if so will generate the
> toolchain environment.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>  .../icecc-toolchain/icecc-toolchain/icecc-env.sh   | 37
> +++++++++++++++++++
>  .../icecc-toolchain/icecc-toolchain/icecc-setup.sh | 43
> ++++++++++++++++++++++
>  .../nativesdk-icecc-toolchain_0.1.bb               | 38
> +++++++++++++++++++
>  3 files changed, 118 insertions(+)
>  create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/
> icecc-env.sh
>  create mode 100644 meta/recipes-devtools/icecc-toolchain/icecc-toolchain/
> icecc-setup.sh
>  create mode 100644 meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-
> toolchain_0.1.bb
>
> diff --git a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
> b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
> new file mode 100644
> index 00000000000..4c34edbbc5d
> --- /dev/null
> +++ b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
> @@ -0,0 +1,37 @@
> +#! /bin/sh
> +# Copyright 2018 Garmin Ltd. or its subsidiaries
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> copy
> +# of this software and associated documentation files (the "Software"),
> to deal
> +# in the Software without restriction, including without limitation the
> rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice shall be included
> in
> +# all copies or substantial portions of the Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> IN THE
> +# SOFTWARE.
> +#
> +
> +if [ -z "$ICECC_PATH" ]; then
> +    ICECC_PATH=$(which icecc 2> /dev/null)
> +fi
> +
> +if [ -n "$ICECC_PATH" ]; then
> +    export ICECC_PATH
> +    export ICECC_VERSION="$OECORE_NATIVE_SYSROOT/usr/share/icecream/@
> TOOLCHAIN_ENV@"
> +    export ICECC="$(which ${CROSS_COMPILE}gcc)"
> +    export ICECXX="$(which ${CROSS_COMPILE}g++)"
> +    export ICEAS="$(which ${CROSS_COMPILE}as)"
> +    export PATH="$OECORE_NATIVE_SYSROOT/usr/share/icecream/bin:$PATH"
> +else
> +    echo "Icecc not found. Disabling distributed compiling"
> +fi
> +
> diff --git a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
> b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
> new file mode 100644
> index 00000000000..a433e55b029
> --- /dev/null
> +++ b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
> @@ -0,0 +1,43 @@
> +#! /bin/sh
> +# Copyright 2018 Garmin Ltd. or its subsidiaries
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> copy
> +# of this software and associated documentation files (the "Software"),
> to deal
> +# in the Software without restriction, including without limitation the
> rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice shall be included
> in
> +# all copies or substantial portions of the Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> IN THE
> +# SOFTWARE.
> +#
> +
> +# Setup environment
> +for env_setup_script in `ls $1/environment-setup-*`; do
> +       . $env_setup_script
> +done
> +
> +# ICECC_PATH will have been found icecc-env.sh
> +if [ -z "$ICECC_PATH" ]; then
> +    exit 0
> +fi
> +
> +echo "Setting up IceCream distributed compiling..."
> +
> +# Create the environment
> +mkdir -p "`dirname $ICECC_VERSION`"
> +icecc-create-env $ICECC $ICECXX $ICEAS $ICECC_VERSION || exit $?
> +
> +# Create symbolic links
> +d="$OECORE_NATIVE_SYSROOT/usr/share/icecream/bin"
> +mkdir -p "$d"
> +ln -s "$ICECC_PATH" "$d/${CROSS_COMPILE}gcc"
> +ln -s "$ICECC_PATH" "$d/${CROSS_COMPILE}g++"
> diff --git a/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-
> toolchain_0.1.bb b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-
> toolchain_0.1.bb
> new file mode 100644
> index 00000000000..28b2924ebfb
> --- /dev/null
> +++ b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-
> toolchain_0.1.bb
> @@ -0,0 +1,38 @@
> +# Copyright (C) 2018 Joshua Watt <JPEWhacker@gmail.com>
> +# Released under the MIT license (see COPYING.MIT for the terms)
> +DESCRIPTION = "Generates IceCream toolchains for SDKs"
> +LICENSE = "MIT"
> +LIC_FILES_CHKSUM = "file://${WORKDIR}/icecc-env.
> sh;beginline=2;endline=20;md5=aafdb7bc2aa7ac5d039fda0c8733983c"
> +
> +INHIBIT_DEFAULT_DEPS = "1"
> +
> +SRC_URI = "\
> +    file://icecc-env.sh \
> +    file://icecc-setup.sh \
> +    "
> +
> +inherit nativesdk
> +
> +ENV_NAME="${DISTRO}-${TCLIBC}-${SDK_ARCH}-${TUNE_PKGARCH}-$
> {DISTRO_VERSION}.tar.gz"
> +
> +do_compile() {
> +}
> +
> +do_install() {
> +    install -d ${D}${SDKPATHNATIVE}${datadir}/icecream/bin
> +
> +    install -d ${D}${SDKPATHNATIVE}/environment-setup.d/
> +    install -m 0644 ${WORKDIR}/icecc-env.sh ${D}${SDKPATHNATIVE}/
> environment-setup.d/
> +    sed -i ${D}${SDKPATHNATIVE}/environment-setup.d/icecc-env.sh \
> +        -e "s,@TOOLCHAIN_ENV@,${ENV_NAME},g"
> +
> +    install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
> +    install -m 0755 ${WORKDIR}/icecc-setup.sh ${D}${SDKPATHNATIVE}/post-
> relocate-setup.d/
> +    sed -i ${D}${SDKPATHNATIVE}/post-relocate-setup.d/icecc-setup.sh \
> +        -e "s,@TOOLCHAIN_ENV@,${ENV_NAME},g"
> +}
> +
> +PACKAGES = "${PN}"
> +FILES_${PN} = "${SDKPATHNATIVE}"
> +RDEPENDS_${PN} += "nativesdk-icecc-create-env"
> +
> --
> 2.14.3
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 11069 bytes --]

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 13/14] icecc-toolchain: Add SDK icecream setup
  2018-02-16 23:43   ` Martin Jansa
@ 2018-02-16 23:50     ` Joshua Watt
  2018-02-17  0:18       ` [PATCH] nativesdk-icecc-toolchain: Fix LIC_FILES_CHKSUM md5 Martin Jansa
  0 siblings, 1 reply; 40+ messages in thread
From: Joshua Watt @ 2018-02-16 23:50 UTC (permalink / raw)
  To: Martin Jansa; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 9014 bytes --]

On Feb 16, 2018 17:44, "Martin Jansa" <martin.jansa@gmail.com> wrote:

Is the LIC_FILES_CHKSUM correct? Doesn't match here:


No I must have updated the copyright and missed the checksum



nativesdk-icecc-toolchain/0.1-r0/icecc-env.sh;beginline=2;en
dline=20;md5=aafdb7bc2aa7ac5d039fda0c8733983c
nativesdk-icecc-toolchain: The new md5 checksum is
dd6b68c1efed8a9fb04e409b3b287d47
nativesdk-icecc-toolchain: Here is the selected license text:
vvvvvvvvvvvvvvvvvvvvvvvvvvvv beginline=2 vvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# Copyright (c) 2018 Joshua Watt, Garmin International,Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
copy
# of this software and associated documentation files (the "Software"), to
deal
# in the Software without restriction, including without limitation the
rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE
# SOFTWARE.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ endline=20 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


On Tue, Feb 6, 2018 at 11:01 PM, Joshua Watt <jpewhacker@gmail.com> wrote:

> IceCream can now be optionally included in the generated SDK by
> including nativesdk-icecc-toolchain to TOOLCHAIN_HOST_TASK. When the SDK
> is installed, it will check if icecc exists, and if so will generate the
> toolchain environment.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>  .../icecc-toolchain/icecc-toolchain/icecc-env.sh   | 37
> +++++++++++++++++++
>  .../icecc-toolchain/icecc-toolchain/icecc-setup.sh | 43
> ++++++++++++++++++++++
>  .../nativesdk-icecc-toolchain_0.1.bb               | 38
> +++++++++++++++++++
>  3 files changed, 118 insertions(+)
>  create mode 100644 meta/recipes-devtools/icecc-to
> olchain/icecc-toolchain/icecc-env.sh
>  create mode 100644 meta/recipes-devtools/icecc-to
> olchain/icecc-toolchain/icecc-setup.sh
>  create mode 100644 meta/recipes-devtools/icecc-toolchain/
> nativesdk-icecc-toolchain_0.1.bb
>
> diff --git a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
> b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
> new file mode 100644
> index 00000000000..4c34edbbc5d
> --- /dev/null
> +++ b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-env.sh
> @@ -0,0 +1,37 @@
> +#! /bin/sh
> +# Copyright 2018 Garmin Ltd. or its subsidiaries
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> copy
> +# of this software and associated documentation files (the "Software"),
> to deal
> +# in the Software without restriction, including without limitation the
> rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice shall be included
> in
> +# all copies or substantial portions of the Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> IN THE
> +# SOFTWARE.
> +#
> +
> +if [ -z "$ICECC_PATH" ]; then
> +    ICECC_PATH=$(which icecc 2> /dev/null)
> +fi
> +
> +if [ -n "$ICECC_PATH" ]; then
> +    export ICECC_PATH
> +    export ICECC_VERSION="$OECORE_NATIVE_SYSROOT/usr/share/icecream/@TO
> OLCHAIN_ENV@"
> +    export ICECC="$(which ${CROSS_COMPILE}gcc)"
> +    export ICECXX="$(which ${CROSS_COMPILE}g++)"
> +    export ICEAS="$(which ${CROSS_COMPILE}as)"
> +    export PATH="$OECORE_NATIVE_SYSROOT/usr/share/icecream/bin:$PATH"
> +else
> +    echo "Icecc not found. Disabling distributed compiling"
> +fi
> +
> diff --git a/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
> b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
> new file mode 100644
> index 00000000000..a433e55b029
> --- /dev/null
> +++ b/meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-setup.sh
> @@ -0,0 +1,43 @@
> +#! /bin/sh
> +# Copyright 2018 Garmin Ltd. or its subsidiaries
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> copy
> +# of this software and associated documentation files (the "Software"),
> to deal
> +# in the Software without restriction, including without limitation the
> rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice shall be included
> in
> +# all copies or substantial portions of the Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> IN THE
> +# SOFTWARE.
> +#
> +
> +# Setup environment
> +for env_setup_script in `ls $1/environment-setup-*`; do
> +       . $env_setup_script
> +done
> +
> +# ICECC_PATH will have been found icecc-env.sh
> +if [ -z "$ICECC_PATH" ]; then
> +    exit 0
> +fi
> +
> +echo "Setting up IceCream distributed compiling..."
> +
> +# Create the environment
> +mkdir -p "`dirname $ICECC_VERSION`"
> +icecc-create-env $ICECC $ICECXX $ICEAS $ICECC_VERSION || exit $?
> +
> +# Create symbolic links
> +d="$OECORE_NATIVE_SYSROOT/usr/share/icecream/bin"
> +mkdir -p "$d"
> +ln -s "$ICECC_PATH" "$d/${CROSS_COMPILE}gcc"
> +ln -s "$ICECC_PATH" "$d/${CROSS_COMPILE}g++"
> diff --git a/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-tool
> chain_0.1.bb b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-tool
> chain_0.1.bb
> new file mode 100644
> index 00000000000..28b2924ebfb
> --- /dev/null
> +++ b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-tool
> chain_0.1.bb
> @@ -0,0 +1,38 @@
> +# Copyright (C) 2018 Joshua Watt <JPEWhacker@gmail.com>
> +# Released under the MIT license (see COPYING.MIT for the terms)
> +DESCRIPTION = "Generates IceCream toolchains for SDKs"
> +LICENSE = "MIT"
> +LIC_FILES_CHKSUM = "file://${WORKDIR}/icecc-env.s
> h;beginline=2;endline=20;md5=aafdb7bc2aa7ac5d039fda0c8733983c"
> +
> +INHIBIT_DEFAULT_DEPS = "1"
> +
> +SRC_URI = "\
> +    file://icecc-env.sh \
> +    file://icecc-setup.sh \
> +    "
> +
> +inherit nativesdk
> +
> +ENV_NAME="${DISTRO}-${TCLIBC}-${SDK_ARCH}-${TUNE_PKGARCH}-$
> {DISTRO_VERSION}.tar.gz"
> +
> +do_compile() {
> +}
> +
> +do_install() {
> +    install -d ${D}${SDKPATHNATIVE}${datadir}/icecream/bin
> +
> +    install -d ${D}${SDKPATHNATIVE}/environment-setup.d/
> +    install -m 0644 ${WORKDIR}/icecc-env.sh ${D}${SDKPATHNATIVE}/environme
> nt-setup.d/
> +    sed -i ${D}${SDKPATHNATIVE}/environment-setup.d/icecc-env.sh \
> +        -e "s,@TOOLCHAIN_ENV@,${ENV_NAME},g"
> +
> +    install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
> +    install -m 0755 ${WORKDIR}/icecc-setup.sh
> ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
> +    sed -i ${D}${SDKPATHNATIVE}/post-relocate-setup.d/icecc-setup.sh \
> +        -e "s,@TOOLCHAIN_ENV@,${ENV_NAME},g"
> +}
> +
> +PACKAGES = "${PN}"
> +FILES_${PN} = "${SDKPATHNATIVE}"
> +RDEPENDS_${PN} += "nativesdk-icecc-create-env"
> +
> --
> 2.14.3
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 12396 bytes --]

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH] nativesdk-icecc-toolchain: Fix LIC_FILES_CHKSUM md5
  2018-02-16 23:50     ` Joshua Watt
@ 2018-02-17  0:18       ` Martin Jansa
  0 siblings, 0 replies; 40+ messages in thread
From: Martin Jansa @ 2018-02-17  0:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb
index 91958d7fbc..9d2750e479 100644
--- a/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb
+++ b/meta/recipes-devtools/icecc-toolchain/nativesdk-icecc-toolchain_0.1.bb
@@ -2,7 +2,7 @@
 # Released under the MIT license (see COPYING.MIT for the terms)
 SUMMARY = "Generates Icecream toolchain for SDK"
 LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${WORKDIR}/icecc-env.sh;beginline=2;endline=20;md5=aafdb7bc2aa7ac5d039fda0c8733983c"
+LIC_FILES_CHKSUM = "file://${WORKDIR}/icecc-env.sh;beginline=2;endline=20;md5=dd6b68c1efed8a9fb04e409b3b287d47"
 
 INHIBIT_DEFAULT_DEPS = "1"
 
-- 
2.15.1



^ permalink raw reply related	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2018-02-17  0:18 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 22:01 [PATCH 00/14] Fix support for Icecream Joshua Watt
2018-02-06 22:01 ` [PATCH 01/14] icecc.bbclass: Move to shared work directory Joshua Watt
2018-02-06 22:01 ` [PATCH 02/14] icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage Joshua Watt
2018-02-06 22:01 ` [PATCH 03/14] icecc.bbclass: Skip canadian-cross compiles Joshua Watt
2018-02-06 22:01 ` [PATCH 04/14] icecc-create-env: Reformat Joshua Watt
2018-02-06 22:01 ` [PATCH 05/14] icecc-create-env: Add /bin/true to environment Joshua Watt
2018-02-06 22:01 ` [PATCH 06/14] icecc-create-env: Use program interpreter for deps Joshua Watt
2018-02-06 22:01 ` [PATCH 07/14] icecc-create-env: Symlink alternate names Joshua Watt
2018-02-06 22:01 ` [PATCH 08/14] icecc-create-env: Archive directory Joshua Watt
2018-02-06 22:01 ` [PATCH 09/14] icecc-create-env: Fix executable rpaths Joshua Watt
2018-02-06 22:01 ` [PATCH 10/14] icecc-create-env: Add support for nativesdk Joshua Watt
2018-02-06 22:01 ` [PATCH 11/14] icecc-create-env: Allow multiple tool aliases Joshua Watt
2018-02-06 22:01 ` [PATCH 12/14] toolchain-shar-extract: Add post-relocate scripts Joshua Watt
2018-02-06 22:01 ` [PATCH 13/14] icecc-toolchain: Add SDK icecream setup Joshua Watt
2018-02-16 23:43   ` Martin Jansa
2018-02-16 23:50     ` Joshua Watt
2018-02-17  0:18       ` [PATCH] nativesdk-icecc-toolchain: Fix LIC_FILES_CHKSUM md5 Martin Jansa
2018-02-06 22:01 ` [PATCH 14/14] icecc.bbclass: Add IceCream support to SDK Joshua Watt
2018-02-06 22:32 ` ✗ patchtest: failure for Fix support for Icecream Patchwork
2018-02-07 20:59 ` [PATCH 00/14] " Tomas Novotny
2018-02-07 21:19   ` Joshua Watt
2018-02-08  9:57     ` Tomas Novotny
2018-02-12 16:51 ` [PATCH v2 00/17] " Joshua Watt
2018-02-12 16:51   ` [PATCH v2 01/17] icecc.bbclass: Move to shared work directory Joshua Watt
2018-02-12 16:51   ` [PATCH v2 02/17] icecc.bbclass: Fix STAGING_BINDIR_TOOLCHAIN usage Joshua Watt
2018-02-12 16:51   ` [PATCH v2 03/17] icecc.bbclass: Skip canadian-cross compiles Joshua Watt
2018-02-12 16:51   ` [PATCH v2 04/17] icecc-create-env: Reformat Joshua Watt
2018-02-12 16:52   ` [PATCH v2 05/17] icecc-create-env: Add /bin/true to environment Joshua Watt
2018-02-12 16:52   ` [PATCH v2 06/17] icecc-create-env: Use program interpreter for deps Joshua Watt
2018-02-12 16:52   ` [PATCH v2 07/17] icecc-create-env: Symlink alternate names Joshua Watt
2018-02-12 16:52   ` [PATCH v2 08/17] icecc-create-env: Archive directory Joshua Watt
2018-02-12 16:52   ` [PATCH v2 09/17] icecc-create-env: Fix executable rpaths Joshua Watt
2018-02-12 16:52   ` [PATCH v2 10/17] icecc-create-env: Add support for nativesdk Joshua Watt
2018-02-12 16:52   ` [PATCH v2 11/17] icecc-create-env: Allow multiple tool aliases Joshua Watt
2018-02-12 16:52   ` [PATCH v2 12/17] toolchain-shar-extract: Add post-relocate scripts Joshua Watt
2018-02-12 16:52   ` [PATCH v2 13/17] icecc-toolchain: Add SDK icecream setup Joshua Watt
2018-02-12 16:52   ` [PATCH v2 14/17] icecc.bbclass: Add Icecream support to SDK Joshua Watt
2018-02-12 16:52   ` [PATCH v2 15/17] icecc.bbclass: Disable caret workaround by default Joshua Watt
2018-02-12 16:52   ` [PATCH v2 16/17] icecc-toolchain: Disable caret workaround Joshua Watt
2018-02-12 16:52   ` [PATCH v2 17/17] elfutils: Use fallthrough attribute Joshua Watt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.