gcc-ld 711 B

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