| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: buildcmd,v 1.4 2008/04/21 14:43:50 joerg Exp $ | | 1 | # $NetBSD: buildcmd,v 1.5 2012/04/13 03:11:13 sbd 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 |
| @@ -55,27 +55,32 @@ case $arg in | | | @@ -55,27 +55,32 @@ case $arg in |
55 | ;; | | 55 | ;; |
56 | esac | | 56 | esac |
57 | ;; | | 57 | ;; |
58 | ###################################################################### | | 58 | ###################################################################### |
59 | # Preserve the -Wl,-Bstatic / -Wl,-Bdynamic arguments, but also | | 59 | # Preserve the -Wl,-Bstatic / -Wl,-Bdynamic arguments, but also |
60 | # duplicate them into the list of libraries. Someone may want to mix | | 60 | # duplicate them into the list of libraries. Someone may want to mix |
61 | # static and dynamic linking. | | 61 | # static and dynamic linking. |
62 | ###################################################################### | | 62 | ###################################################################### |
63 | -Wl,-Bdynamic|-Wl,-Bstatic) | | 63 | -Wl,-Bdynamic|-Wl,-Bstatic) |
64 | shquote "$arg"; arg="$shquoted" | | 64 | shquote "$arg"; arg="$shquoted" |
65 | cmd="$cmd $arg" | | 65 | cmd="$cmd $arg" |
66 | libs="$libs $arg" | | 66 | libs="$libs $arg" |
67 | ;; | | 67 | ;; |
68 | -l*) | | 68 | ###################################################################### |
| | | 69 | # Treat the '--as-needed' and '--no-as-needed' arguments to ld as if |
| | | 70 | # thay are librarys so that they still surround the given library. |
| | | 71 | # WARNING: this may not work if the wrapper reorders librarys. |
| | | 72 | ###################################################################### |
| | | 73 | -l*|--as-needed|--no-as-needed) |
69 | case $libs in | | 74 | case $libs in |
70 | *" "$arg) | | 75 | *" "$arg) |
71 | ;; | | 76 | ;; |
72 | *) | | 77 | *) |
73 | shquote "$arg"; arg="$shquoted" | | 78 | shquote "$arg"; arg="$shquoted" |
74 | libs="$libs $arg" | | 79 | libs="$libs $arg" |
75 | ;; | | 80 | ;; |
76 | esac | | 81 | esac |
77 | ;; | | 82 | ;; |
78 | ###################################################################### | | 83 | ###################################################################### |
79 | # Append $arg to $cmd to build up the command line to be executed. | | 84 | # Append $arg to $cmd to build up the command line to be executed. |
80 | ###################################################################### | | 85 | ###################################################################### |
81 | *) | | 86 | *) |