X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=tools%2Fgen-musl-gcc.sh;h=7b80fda624e72335f070b041839860eb46b820f0;hb=27deb538896b5c3b8ceca206ec505ff834c97300;hp=1ef0550f12c45374d77e354cc4e8a882d78cc9a3;hpb=d30c331d1f3262223a99408ff2d49641a46ce409;p=musl diff --git a/tools/gen-musl-gcc.sh b/tools/gen-musl-gcc.sh index 1ef0550f..7b80fda6 100644 --- a/tools/gen-musl-gcc.sh +++ b/tools/gen-musl-gcc.sh @@ -29,6 +29,7 @@ for i ; do case "$skip$i" in -I|-L) skip=--- ; continue ;; -[cSE]|-M*) nolink=1 ;; +-shared|-nostartfiles|-nostdlib) nocrt=1 ;; -*) ;; *) havefile=1 ;; esac @@ -37,17 +38,21 @@ done [ "$havefile" ] || nolink=1 +[ "$nolink" ] && nocrt=1 + +[ "$nocrt" ] || set -- "$libc_start" "$libc_crt" "$@" "$libc_end" \ + [ "$nolink" ] || { tmp_specs=$HOME/.specs.tmp.$$ printf '*link_libgcc:\n\n\n' > "$tmp_specs" || exit 1 exec 3<"$tmp_specs" rm -f "$tmp_specs" -set -- -specs=/proc/self/fd/3 "$libc_start" "$libc_crt" "$@" "$libc_end" \ - -Wl,--start-group -lc -lgcc -lgcc_eh -Wl,--end-group \ +set -- -specs=/proc/self/fd/3 "$@" \ + -Wl,--as-needed -Wl,--start-group -lc -lgcc -lgcc_eh -Wl,--end-group \ -Wl,-dynamic-linker,"$ldso_pathname" -Wl,-nostdlib } -set -- -std=gnu99 -nostdinc -nostdlib $nosp \ +set -- -nostdinc -nostdlib $nosp \ -isystem "$libc_inc" -isystem "$gcc_inc" "$@" \ -L"$libc_lib" -L"$libgcc"