| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: buildcmd,v 1.6 2012/04/13 06:36:08 wiz Exp $ | | 1 | # $NetBSD: buildcmd,v 1.7 2015/04/25 22:15:38 tnn 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 |
| @@ -58,29 +58,30 @@ case $arg in | | | @@ -58,29 +58,30 @@ case $arg in |
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 | ###################################################################### | | 68 | ###################################################################### |
69 | # Treat the '--as-needed' and '--no-as-needed' arguments to ld as if | | 69 | # Treat the '--as-needed' and '--no-as-needed' arguments to ld as if |
70 | # thay are libraries so that they still surround the given library. | | 70 | # thay are libraries so that they still surround the given library. |
| | | 71 | # Same for '-Wl,--whole-archive' and '-Wl,--no-whole-archive'. |
71 | # WARNING: this may not work if the wrapper reorders libraries. | | 72 | # WARNING: this may not work if the wrapper reorders libraries. |
72 | ###################################################################### | | 73 | ###################################################################### |
73 | -l*|--as-needed|--no-as-needed) | | 74 | -l*|--as-needed|--no-as-needed|-Wl,--whole-archive|-Wl,--no-whole-archive) |
74 | case $libs in | | 75 | case $libs in |
75 | *" "$arg) | | 76 | *" "$arg) |
76 | ;; | | 77 | ;; |
77 | *) | | 78 | *) |
78 | shquote "$arg"; arg="$shquoted" | | 79 | shquote "$arg"; arg="$shquoted" |
79 | libs="$libs $arg" | | 80 | libs="$libs $arg" |
80 | ;; | | 81 | ;; |
81 | esac | | 82 | esac |
82 | ;; | | 83 | ;; |
83 | ###################################################################### | | 84 | ###################################################################### |
84 | # Append $arg to $cmd to build up the command line to be executed. | | 85 | # Append $arg to $cmd to build up the command line to be executed. |
85 | ###################################################################### | | 86 | ###################################################################### |
86 | *) | | 87 | *) |