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