gcc-ld 676 B

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