8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 1) #!/bin/sh
b24413180f560 (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100 2) # SPDX-License-Identifier: GPL-2.0
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 3) # run gcc with ld options
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 4) # used as a wrapper to execute link time optimizations
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 5) # yes virginia, this is not pretty
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 6)
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 7) ARGS="-nostdlib"
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 8)
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 9) while [ "$1" != "" ] ; do
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 10) case "$1" in
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 11) -save-temps|-m32|-m64) N="$1" ;;
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 12) -r) N="$1" ;;
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 13) -[Wg]*) N="$1" ;;
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 14) -[olv]|-[Ofd]*|-nostdlib) N="$1" ;;
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 15) --end-group|--start-group)
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 16) N="-Wl,$1" ;;
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 17) -[RTFGhIezcbyYu]*|\
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 18) --script|--defsym|-init|-Map|--oformat|-rpath|\
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 19) -rpath-link|--sort-section|--section-start|-Tbss|-Tdata|-Ttext|\
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 20) --version-script|--dynamic-list|--version-exports-symbol|--wrap|-m)
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 21) A="$1" ; shift ; N="-Wl,$A,$1" ;;
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 22) -[m]*) N="$1" ;;
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 23) -*) N="-Wl,$1" ;;
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 24) *) N="$1" ;;
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 25) esac
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 26) ARGS="$ARGS $N"
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 27) shift
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 28) done
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 29)
8564ed2b38881 (Andi Kleen 2014-02-08 09:01:14 +0100 30) exec $CC $ARGS