| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: arg-source,v 1.15 2007/09/19 13:08:19 rillig Exp $ | | 1 | # $NetBSD: arg-source,v 1.16 2015/11/20 05:49:24 richard Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2004 The NetBSD Foundation, Inc. | | 3 | # Copyright (c) 2004 The NetBSD Foundation, Inc. |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # This code is derived from software contributed to The NetBSD Foundation | | 6 | # This code is derived from software contributed to The NetBSD Foundation |
7 | # by Johnny C. Lam. | | 7 | # by Johnny C. Lam. |
8 | # | | 8 | # |
9 | # Redistribution and use in source and binary forms, with or without | | 9 | # Redistribution and use in source and binary forms, with or without |
10 | # modification, are permitted provided that the following conditions | | 10 | # modification, are permitted provided that the following conditions |
11 | # are met: | | 11 | # are met: |
12 | # 1. Redistributions of source code must retain the above copyright | | 12 | # 1. Redistributions of source code must retain the above copyright |
13 | # notice, this list of conditions and the following disclaimer. | | 13 | # notice, this list of conditions and the following disclaimer. |
14 | # 2. Redistributions in binary form must reproduce the above copyright | | 14 | # 2. Redistributions in binary form must reproduce the above copyright |
| @@ -78,57 +78,59 @@ while $test $# -gt 0; do | | | @@ -78,57 +78,59 @@ while $test $# -gt 0; do |
78 | IFS="$saved_IFS" | | 78 | IFS="$saved_IFS" |
79 | shquote "$o"; o="$shquoted" | | 79 | shquote "$o"; o="$shquoted" |
80 | new_args="$new_args -Wl,$o" | | 80 | new_args="$new_args -Wl,$o" |
81 | done | | 81 | done |
82 | IFS="$saved_IFS" | | 82 | IFS="$saved_IFS" |
83 | eval "set args $new_args \"\$@\""; shift | | 83 | eval "set args $new_args \"\$@\""; shift |
84 | $debug_log $wrapperlog " (arg-source) after-split: $*" | | 84 | $debug_log $wrapperlog " (arg-source) after-split: $*" |
85 | continue | | 85 | continue |
86 | ;; | | 86 | ;; |
87 | | | 87 | |
88 | ############################################################## | | 88 | ############################################################## |
89 | # Split "-Wl,-R/dir1:/dir2" into "-Wl,-R/dir1 -Wl,-R/dir2". | | 89 | # Split "-Wl,-R/dir1:/dir2" into "-Wl,-R/dir1 -Wl,-R/dir2". |
90 | # Same for -R and -Wl,-rpath and -Wl,-rpath-link. | | 90 | # Same for -R and -Wl,-rpath and -Wl,-rpath-link. |
| | | 91 | # (at the same time suppress the double dash in --rpath to -rpath) |
91 | ############################################################## | | 92 | ############################################################## |
92 | -R*:*|-Wl,-R*:*|\ | | 93 | -R*:*|-Wl,-R*:*|\ |
93 | -Wl,-rpath,*:*|-Wl,-rpath-link,*:*|-Wl,--rpath,*:*) | | 94 | -Wl,-rpath,*:*|-Wl,-rpath-link,*:*|-Wl,--rpath,*:*) |
94 | case $arg in | | 95 | case $arg in |
95 | -R*) R="-R" ;; | | 96 | -R*) R="-R" ;; |
96 | -Wl,-R*) R="-Wl,-R" ;; | | 97 | -Wl,-R*) R="-Wl,-R" ;; |
97 | -Wl,-rpath,*) R="-Wl,-rpath," ;; | | 98 | -Wl,-rpath,*) R="-Wl,-rpath," ;; |
98 | -Wl,-rpath-link,*) R="-Wl,-rpath-link," ;; | | 99 | -Wl,-rpath-link,*) R="-Wl,-rpath-link," ;; |
99 | -Wl,--rpath,*) R="-Wl,--rpath," ;; | | 100 | -Wl,--rpath,*) R="-Wl,-rpath," ;; |
100 | esac | | 101 | esac |
101 | list="${arg#$R}" | | 102 | list="${arg#$R}" |
102 | save_IFS="${IFS}"; IFS=":" | | 103 | save_IFS="${IFS}"; IFS=":" |
103 | for dir in $list; do | | 104 | for dir in $list; do |
104 | IFS="${save_IFS}" | | 105 | IFS="${save_IFS}" |
105 | append_queue argbuf "$R$dir" | | 106 | append_queue argbuf "$R$dir" |
106 | $debug_log $wrapperlog " (arg-source) push: $R$dir" | | 107 | $debug_log $wrapperlog " (arg-source) push: $R$dir" |
107 | done | | 108 | done |
108 | IFS="${save_IFS}" | | 109 | IFS="${save_IFS}" |
109 | ;; | | 110 | ;; |
110 | ############################################################## | | 111 | ############################################################## |
111 | # Merge and split "-Wl,-R -Wl,/dir1:/dir2" into | | 112 | # Merge and split "-Wl,-R -Wl,/dir1:/dir2" into |
112 | # "-Wl,-R/dir1 -Wl,-R/dir2". Same for -Wl,-rpath and | | 113 | # "-Wl,-R/dir1 -Wl,-R/dir2". Same for -Wl,-rpath and |
113 | # -Wl,-rpath-link. | | 114 | # -Wl,-rpath-link. |
| | | 115 | # (at the same time suppress the double dash in --rpath to -rpath) |
114 | ############################################################## | | 116 | ############################################################## |
115 | -Wl,-R|-Wl,-rpath|-Wl,-rpath-link|-Wl,--rpath) | | 117 | -Wl,-R|-Wl,-rpath|-Wl,-rpath-link|-Wl,--rpath) |
116 | nextarg="$1"; shift | | 118 | nextarg="$1"; shift |
117 | case $arg in | | 119 | case $arg in |
118 | -Wl,-R) R="-Wl,-R" ;; | | 120 | -Wl,-R) R="-Wl,-R" ;; |
119 | -Wl,-rpath) R="-Wl,-rpath," ;; | | 121 | -Wl,-rpath) R="-Wl,-rpath," ;; |
120 | -Wl,-rpath-link) R="-Wl,-rpath-link," ;; | | 122 | -Wl,-rpath-link) R="-Wl,-rpath-link," ;; |
121 | -Wl,--rpath) R="-Wl,--rpath," ;; | | 123 | -Wl,--rpath) R="-Wl,-rpath," ;; |
122 | esac | | 124 | esac |
123 | nextarg="${nextarg#-Wl,}" | | 125 | nextarg="${nextarg#-Wl,}" |
124 | case $nextarg in | | 126 | case $nextarg in |
125 | *:*) | | 127 | *:*) |
126 | save_IFS="${IFS}"; IFS=":" | | 128 | save_IFS="${IFS}"; IFS=":" |
127 | for dir in $nextarg; do | | 129 | for dir in $nextarg; do |
128 | IFS="${save_IFS}" | | 130 | IFS="${save_IFS}" |
129 | append_queue argbuf "$R$dir" | | 131 | append_queue argbuf "$R$dir" |
130 | $debug_log $wrapperlog " (arg-source) push: $R$dir" | | 132 | $debug_log $wrapperlog " (arg-source) push: $R$dir" |
131 | done | | 133 | done |
132 | IFS="${save_IFS}" | | 134 | IFS="${save_IFS}" |
133 | ;; | | 135 | ;; |
134 | *) | | 136 | *) |