OLD | NEW |
1 // main.cc -- gold main function. | 1 // main.cc -- gold main function. |
2 | 2 |
3 // Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | 3 // Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
4 // Written by Ian Lance Taylor <iant@google.com>. | 4 // Written by Ian Lance Taylor <iant@google.com>. |
5 | 5 |
6 // This file is part of gold. | 6 // This file is part of gold. |
7 | 7 |
8 // This program is free software; you can redistribute it and/or modify | 8 // This program is free software; you can redistribute it and/or modify |
9 // it under the terms of the GNU General Public License as published by | 9 // it under the terms of the GNU General Public License as published by |
10 // the Free Software Foundation; either version 3 of the License, or | 10 // the Free Software Foundation; either version 3 of the License, or |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 | 128 |
129 static inline void | 129 static inline void |
130 write_debug_script(std::string, const char*, const char*) | 130 write_debug_script(std::string, const char*, const char*) |
131 { | 131 { |
132 } | 132 } |
133 | 133 |
134 #endif // !defined(DEBUG) | 134 #endif // !defined(DEBUG) |
135 | 135 |
136 // @LOCALMOD-SB-BEGIN | 136 // @LOCALMOD-SB-BEGIN |
137 // For the SRPC build, main() is defined in nacl_file.cc and runs the SRPC | 137 // For the in-browser sandboxed build, main() is defined in |
138 // main loop. gold_main() is called by the RPC handler. | 138 // nacl_file.cc and calls an IRT interface for handling the browser's |
| 139 // request. gold_main() is called by that request handler. |
139 #if defined(__native_client__) | 140 #if defined(__native_client__) |
140 int | 141 int |
141 gold_main(int argc, char** argv) | 142 gold_main(int argc, char** argv) |
142 #else | 143 #else |
143 | 144 |
144 int | 145 int |
145 main(int argc, char** argv) | 146 main(int argc, char** argv) |
146 #endif | 147 #endif |
147 // @LOCALMOD-SB-END | 148 // @LOCALMOD-SB-END |
148 { | 149 { |
149 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) | 150 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) |
150 setlocale(LC_MESSAGES, ""); | 151 setlocale(LC_MESSAGES, ""); |
151 #endif | 152 #endif |
152 #if defined (HAVE_SETLOCALE) | 153 #if defined (HAVE_SETLOCALE) |
153 setlocale(LC_CTYPE, ""); | 154 setlocale(LC_CTYPE, ""); |
154 #endif | 155 #endif |
155 bindtextdomain(PACKAGE, LOCALEDIR); | 156 bindtextdomain(PACKAGE, LOCALEDIR); |
156 textdomain(PACKAGE); | 157 textdomain(PACKAGE); |
157 | 158 |
158 program_name = argv[0]; | 159 program_name = argv[0]; |
159 | 160 |
160 // In libiberty; expands @filename to the args in "filename". | 161 // In libiberty; expands @filename to the args in "filename". |
161 // @LOCALMOD-SB: skip this in SRPC mode since the commandline we | 162 // @LOCALMOD-SB: skip this in sandboxed mode since the commandline we |
162 // build will likely not have @filename (and we can avoid hijacking | 163 // build will likely not have @filename (and we can avoid hijacking |
163 // the file open operation there). | 164 // the file open operation there). |
164 #if !defined(__native_client__) | 165 #if !defined(__native_client__) |
165 expandargv(&argc, &argv); | 166 expandargv(&argc, &argv); |
166 #endif | 167 #endif |
167 | 168 |
168 // This is used by write_debug_script(), which wants the unedited argv. | 169 // This is used by write_debug_script(), which wants the unedited argv. |
169 std::string args = collect_argv(argc, argv); | 170 std::string args = collect_argv(argc, argv); |
170 | 171 |
171 Errors errors(program_name); | 172 Errors errors(program_name); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 332 |
332 if (mapfile != NULL) | 333 if (mapfile != NULL) |
333 mapfile->close(); | 334 mapfile->close(); |
334 | 335 |
335 if (parameters->options().fatal_warnings() | 336 if (parameters->options().fatal_warnings() |
336 && errors.warning_count() > 0 | 337 && errors.warning_count() > 0 |
337 && errors.error_count() == 0) | 338 && errors.error_count() == 0) |
338 gold_error("treating warnings as errors"); | 339 gold_error("treating warnings as errors"); |
339 | 340 |
340 // @LOCALMOD-SB-BEGIN | 341 // @LOCALMOD-SB-BEGIN |
341 // This function is called via SRPC - we do not want it to exit | 342 // This function is called from an IPC request handler. We do not |
| 343 // want it to exit. |
342 #if defined(__native_client__) | 344 #if defined(__native_client__) |
343 return errors.error_count() > 0; | 345 return errors.error_count() > 0; |
344 #else | 346 #else |
345 // If the user used --noinhibit-exec, we force the exit status to be | 347 // If the user used --noinhibit-exec, we force the exit status to be |
346 // successful. This is compatible with GNU ld. | 348 // successful. This is compatible with GNU ld. |
347 gold_exit((errors.error_count() == 0 | 349 gold_exit((errors.error_count() == 0 |
348 || parameters->options().noinhibit_exec()) | 350 || parameters->options().noinhibit_exec()) |
349 ? GOLD_OK | 351 ? GOLD_OK |
350 : GOLD_ERR); | 352 : GOLD_ERR); |
351 #endif | 353 #endif |
352 // @LOCALMOD-SB-END | 354 // @LOCALMOD-SB-END |
353 } | 355 } |
OLD | NEW |