18c2ecf20Sopenharmony_ci#!/bin/sh 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 38c2ecf20Sopenharmony_ci# run gcc with ld options 48c2ecf20Sopenharmony_ci# used as a wrapper to execute link time optimizations 58c2ecf20Sopenharmony_ci# yes virginia, this is not pretty 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ciARGS="-nostdlib" 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciwhile [ "$1" != "" ] ; do 108c2ecf20Sopenharmony_ci case "$1" in 118c2ecf20Sopenharmony_ci -save-temps|-m32|-m64) N="$1" ;; 128c2ecf20Sopenharmony_ci -r) N="$1" ;; 138c2ecf20Sopenharmony_ci -[Wg]*) N="$1" ;; 148c2ecf20Sopenharmony_ci -[olv]|-[Ofd]*|-nostdlib) N="$1" ;; 158c2ecf20Sopenharmony_ci --end-group|--start-group) 168c2ecf20Sopenharmony_ci N="-Wl,$1" ;; 178c2ecf20Sopenharmony_ci -[RTFGhIezcbyYu]*|\ 188c2ecf20Sopenharmony_ci--script|--defsym|-init|-Map|--oformat|-rpath|\ 198c2ecf20Sopenharmony_ci-rpath-link|--sort-section|--section-start|-Tbss|-Tdata|-Ttext|\ 208c2ecf20Sopenharmony_ci--version-script|--dynamic-list|--version-exports-symbol|--wrap|-m) 218c2ecf20Sopenharmony_ci A="$1" ; shift ; N="-Wl,$A,$1" ;; 228c2ecf20Sopenharmony_ci -[m]*) N="$1" ;; 238c2ecf20Sopenharmony_ci -*) N="-Wl,$1" ;; 248c2ecf20Sopenharmony_ci *) N="$1" ;; 258c2ecf20Sopenharmony_ci esac 268c2ecf20Sopenharmony_ci ARGS="$ARGS $N" 278c2ecf20Sopenharmony_ci shift 288c2ecf20Sopenharmony_cidone 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ciexec $CC $ARGS 31