Skip to content

Commit

Permalink
cc-wrapper/ld-wrapper: Minor speedup in string concatenation
Browse files Browse the repository at this point in the history
There is still a O(n) pattern match in ld-wrapper, so we should
probably rewrite that code to use associative arrays.
  • Loading branch information
edolstra committed Jul 24, 2017
1 parent 6669a3b commit aa4a92d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkgs/build-support/cc-wrapper/cc-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ while [ $n -lt ${#params[*]} ]; do
nonFlagArgs=1
elif [ "$p" = -m32 ]; then
if [ -e @out@/nix-support/dynamic-linker-m32 ]; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
NIX_LDFLAGS+=" -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
n=$((n + 1))
Expand Down Expand Up @@ -111,9 +111,9 @@ fi

if [[ "$isCpp" = 1 ]]; then
if [[ "$cppInclude" = 1 ]]; then
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE ${NIX_CXXSTDLIB_COMPILE-@default_cxx_stdlib_compile@}"
NIX_CFLAGS_COMPILE+=" ${NIX_CXXSTDLIB_COMPILE-@default_cxx_stdlib_compile@}"
fi
NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK $NIX_CXXSTDLIB_LINK"
NIX_CFLAGS_LINK+=" $NIX_CXXSTDLIB_LINK"
fi

LD=@ldPath@/ld
Expand Down
6 changes: 3 additions & 3 deletions pkgs/build-support/cc-wrapper/ld-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if [ "$NIX_DONT_SET_RPATH" != 1 ]; then
case $libPath in
*\ $path\ *) return 0 ;;
esac
libPath="$libPath $path "
libPath+=" $path "
}

addToRPath() {
Expand All @@ -90,12 +90,12 @@ if [ "$NIX_DONT_SET_RPATH" != 1 ]; then
case $rpath in
*\ $1\ *) return 0 ;;
esac
rpath="$rpath $1 "
rpath+=" $1 "
}

libs=""
addToLibs() {
libs="$libs $1"
libs+=" $1"
}

rpath=""
Expand Down

0 comments on commit aa4a92d

Please sign in to comment.