Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 1 | //===- subzero/src/IceBrowserCompileServer.cpp - Browser compile server ---===// |
| 2 | // |
| 3 | // The Subzero Code Generator |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Andrew Scull | 9612d32 | 2015-07-06 14:53:25 -0700 | [diff] [blame] | 9 | /// |
| 10 | /// \file |
Jim Stichnoth | 92a6e5b | 2015-12-02 16:52:44 -0800 | [diff] [blame] | 11 | /// \brief Defines the browser-based compile server. |
Andrew Scull | 9612d32 | 2015-07-06 14:53:25 -0700 | [diff] [blame] | 12 | /// |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | // Can only compile this with the NaCl compiler (needs irt.h, and the |
| 16 | // unsandboxed LLVM build using the trusted compiler does not have irt.h). |
John Porto | 67f8de9 | 2015-06-25 10:14:17 -0700 | [diff] [blame] | 17 | #include "IceBrowserCompileServer.h" |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 18 | #include "IceRangeSpec.h" |
Jim Stichnoth | 816fd68 | 2016-02-16 05:47:32 -0800 | [diff] [blame] | 19 | |
John Porto | 44b3ce8 | 2016-02-26 13:10:55 -0800 | [diff] [blame] | 20 | #if PNACL_BROWSER_TRANSLATOR |
| 21 | |
Jim Stichnoth | 816fd68 | 2016-02-16 05:47:32 -0800 | [diff] [blame] | 22 | // Headers which are not properly part of the SDK are included by their path in |
| 23 | // the NaCl tree. |
| 24 | #ifdef __pnacl__ |
| 25 | #include "native_client/src/untrusted/nacl/pnacl.h" |
| 26 | #endif // __pnacl__ |
| 27 | |
John Porto | 67f8de9 | 2015-06-25 10:14:17 -0700 | [diff] [blame] | 28 | #include "llvm/Support/QueueStreamer.h" |
| 29 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 30 | #include <cstring> |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 31 | #include <fstream> |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 32 | #include <irt.h> |
| 33 | #include <irt_dev.h> |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 34 | #include <pthread.h> |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 35 | #include <thread> |
| 36 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 37 | namespace Ice { |
| 38 | |
| 39 | // Create C wrappers around callback handlers for the IRT interface. |
| 40 | namespace { |
| 41 | |
| 42 | BrowserCompileServer *gCompileServer; |
| 43 | struct nacl_irt_private_pnacl_translator_compile gIRTFuncs; |
| 44 | |
| 45 | void getIRTInterfaces() { |
| 46 | size_t QueryResult = |
| 47 | nacl_interface_query(NACL_IRT_PRIVATE_PNACL_TRANSLATOR_COMPILE_v0_1, |
| 48 | &gIRTFuncs, sizeof(gIRTFuncs)); |
| 49 | if (QueryResult != sizeof(gIRTFuncs)) |
| 50 | llvm::report_fatal_error("Failed to get translator compile IRT interface"); |
| 51 | } |
| 52 | |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 53 | // Allow pnacl-sz arguments to be supplied externally, instead of coming from |
| 54 | // the browser. This is meant to be used for debugging. |
| 55 | // |
Jim Stichnoth | a64156e | 2016-08-08 14:25:51 -0700 | [diff] [blame] | 56 | // NOTE: This functionality is only enabled in non-MINIMAL Subzero builds, for |
| 57 | // security/safety reasons. |
| 58 | // |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 59 | // If the SZARGFILE environment variable is set to a file name, arguments are |
| 60 | // read from that file, one argument per line. This requires setting 3 |
| 61 | // environment variables before starting the browser: |
| 62 | // |
| 63 | // NACL_ENV_PASSTHROUGH=NACL_DANGEROUS_ENABLE_FILE_ACCESS,NACLENV_SZARGFILE |
| 64 | // NACL_DANGEROUS_ENABLE_FILE_ACCESS=1 |
| 65 | // NACLENV_SZARGFILE=/path/to/myargs.txt |
| 66 | // |
| 67 | // In addition, Chrome needs to be launched with the "--no-sandbox" argument. |
| 68 | // |
| 69 | // If the SZARGLIST environment variable is set, arguments are extracted from |
| 70 | // that variable's value, separated by the '|' character (being careful to |
| 71 | // escape/quote special shell characters). This requires setting 2 environment |
| 72 | // variables before starting the browser: |
| 73 | // |
| 74 | // NACL_ENV_PASSTHROUGH=NACLENV_SZARGLIST |
| 75 | // NACLENV_SZARGLIST=arg |
| 76 | // |
| 77 | // This does not require the "--no-sandbox" argument, and is therefore much |
| 78 | // safer, but does require restarting the browser to change the arguments. |
| 79 | // |
| 80 | // If external arguments are supplied, the browser's NumThreads specification is |
| 81 | // ignored, to allow -threads to be specified as an external argument. Note |
| 82 | // that the browser normally supplies the "-O2" argument, so externally supplied |
| 83 | // arguments might want to provide an explicit -O argument. |
Jim Stichnoth | a64156e | 2016-08-08 14:25:51 -0700 | [diff] [blame] | 84 | // |
| 85 | // See Chrome's src/components/nacl/zygote/nacl_fork_delegate_linux.cc for the |
| 86 | // NACL_ENV_PASSTHROUGH mechanism. |
| 87 | // |
| 88 | // See NaCl's src/trusted/service_runtime/env_cleanser.c for the NACLENV_ |
| 89 | // mechanism. |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 90 | std::vector<std::string> getExternalArgs() { |
| 91 | std::vector<std::string> ExternalArgs; |
| 92 | if (BuildDefs::minimal()) |
| 93 | return ExternalArgs; |
| 94 | char ArgsFileVar[] = "SZARGFILE"; |
| 95 | char ArgsListVar[] = "SZARGLIST"; |
| 96 | if (const char *ArgsFilename = getenv(ArgsFileVar)) { |
| 97 | std::ifstream ArgsStream(ArgsFilename); |
| 98 | std::string Arg; |
| 99 | while (ArgsStream >> std::ws, std::getline(ArgsStream, Arg)) { |
| 100 | if (!Arg.empty() && Arg[0] == '#') |
| 101 | continue; |
| 102 | ExternalArgs.emplace_back(Arg); |
| 103 | } |
| 104 | if (ExternalArgs.empty()) { |
| 105 | llvm::report_fatal_error("Failed to read arguments from file '" + |
| 106 | std::string(ArgsFilename) + "'"); |
| 107 | } |
| 108 | } else if (const char *ArgsList = getenv(ArgsListVar)) { |
| 109 | // Leverage the RangeSpec tokenizer. |
| 110 | auto Args = RangeSpec::tokenize(ArgsList, '|'); |
| 111 | ExternalArgs.insert(ExternalArgs.end(), Args.begin(), Args.end()); |
| 112 | } |
| 113 | return ExternalArgs; |
| 114 | } |
| 115 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 116 | char *onInitCallback(uint32_t NumThreads, int *ObjFileFDs, |
Jan Voung | 9c1d386 | 2015-03-31 14:14:20 -0700 | [diff] [blame] | 117 | size_t ObjFileFDCount, char **CLArgs, size_t CLArgsLen) { |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 118 | if (ObjFileFDCount < 1) { |
| 119 | std::string Buffer; |
| 120 | llvm::raw_string_ostream StrBuf(Buffer); |
| 121 | StrBuf << "Invalid number of FDs for onInitCallback " << ObjFileFDCount |
| 122 | << "\n"; |
| 123 | return strdup(StrBuf.str().c_str()); |
| 124 | } |
| 125 | int ObjFileFD = ObjFileFDs[0]; |
| 126 | if (ObjFileFD < 0) { |
| 127 | std::string Buffer; |
| 128 | llvm::raw_string_ostream StrBuf(Buffer); |
| 129 | StrBuf << "Invalid FD given for onInitCallback " << ObjFileFD << "\n"; |
| 130 | return strdup(StrBuf.str().c_str()); |
| 131 | } |
Jan Voung | 9c1d386 | 2015-03-31 14:14:20 -0700 | [diff] [blame] | 132 | // CLArgs is almost an "argv", but is missing the argv[0] program name. |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 133 | std::vector<const char *> Argv; |
| 134 | constexpr static char ProgramName[] = "pnacl-sz.nexe"; |
Jan Voung | 9c1d386 | 2015-03-31 14:14:20 -0700 | [diff] [blame] | 135 | Argv.reserve(CLArgsLen + 1); |
| 136 | Argv.push_back(ProgramName); |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 137 | |
| 138 | bool UseNumThreadsFromBrowser = true; |
| 139 | auto ExternalArgs = getExternalArgs(); |
| 140 | if (ExternalArgs.empty()) { |
| 141 | for (size_t i = 0; i < CLArgsLen; ++i) { |
| 142 | Argv.push_back(CLArgs[i]); |
| 143 | } |
| 144 | } else { |
| 145 | for (auto &Arg : ExternalArgs) { |
| 146 | Argv.emplace_back(Arg.c_str()); |
| 147 | } |
| 148 | UseNumThreadsFromBrowser = false; |
Jan Voung | 9c1d386 | 2015-03-31 14:14:20 -0700 | [diff] [blame] | 149 | } |
| 150 | // NOTE: strings pointed to by argv are owned by the caller, but we parse |
| 151 | // here before returning and don't store them. |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 152 | gCompileServer->getParsedFlags(UseNumThreadsFromBrowser, NumThreads, |
| 153 | Argv.size(), Argv.data()); |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 154 | gCompileServer->startCompileThread(ObjFileFD); |
| 155 | return nullptr; |
| 156 | } |
| 157 | |
| 158 | int onDataCallback(const void *Data, size_t NumBytes) { |
| 159 | return gCompileServer->pushInputBytes(Data, NumBytes) ? 1 : 0; |
| 160 | } |
| 161 | |
| 162 | char *onEndCallback() { |
| 163 | gCompileServer->endInputStream(); |
| 164 | gCompileServer->waitForCompileThread(); |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 165 | // TODO(jvoung): Also return UMA data. |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 166 | if (gCompileServer->getErrorCode().value()) { |
Karl Schimpf | 2f67b92 | 2015-04-22 15:20:16 -0700 | [diff] [blame] | 167 | const std::string Error = gCompileServer->getErrorStream().getContents(); |
| 168 | return strdup(Error.empty() ? "Some error occurred" : Error.c_str()); |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 169 | } |
| 170 | return nullptr; |
| 171 | } |
| 172 | |
| 173 | struct nacl_irt_pnacl_compile_funcs SubzeroCallbacks { |
| 174 | &onInitCallback, &onDataCallback, &onEndCallback |
| 175 | }; |
| 176 | |
| 177 | std::unique_ptr<llvm::raw_fd_ostream> getOutputStream(int FD) { |
| 178 | if (FD <= 0) |
| 179 | llvm::report_fatal_error("Invalid output FD"); |
Jim Stichnoth | 5bff61c | 2015-10-28 09:26:00 -0700 | [diff] [blame] | 180 | constexpr bool CloseOnDtor = true; |
| 181 | constexpr bool Unbuffered = false; |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 182 | return std::unique_ptr<llvm::raw_fd_ostream>( |
| 183 | new llvm::raw_fd_ostream(FD, CloseOnDtor, Unbuffered)); |
| 184 | } |
| 185 | |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 186 | void fatalErrorHandler(void *UserData, const std::string &Reason, |
| 187 | bool GenCrashDialog) { |
Jan Voung | 871b97f | 2015-06-30 13:31:02 -0700 | [diff] [blame] | 188 | (void)GenCrashDialog; |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 189 | BrowserCompileServer *Server = |
| 190 | reinterpret_cast<BrowserCompileServer *>(UserData); |
| 191 | Server->setFatalError(Reason); |
Andrew Scull | 57e1268 | 2015-09-16 11:30:19 -0700 | [diff] [blame] | 192 | // Only kill the current thread instead of the whole process. We need the |
| 193 | // server thread to remain alive in order to respond with the error message. |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 194 | // We could also try to pthread_kill all other worker threads, but |
Andrew Scull | 57e1268 | 2015-09-16 11:30:19 -0700 | [diff] [blame] | 195 | // pthread_kill / raising signals is not supported by NaCl. We'll have to |
| 196 | // assume that the worker/emitter threads will be well behaved after a fatal |
| 197 | // error in other threads, and either get stuck waiting on input from a |
| 198 | // previous stage, or also call report_fatal_error. |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 199 | pthread_exit(0); |
| 200 | } |
| 201 | |
Jim Stichnoth | 816fd68 | 2016-02-16 05:47:32 -0800 | [diff] [blame] | 202 | /// Adapted from pnacl-llc's AddDefaultCPU() in srpc_main.cpp. |
| 203 | TargetArch getTargetArch() { |
| 204 | #if defined(__pnacl__) |
| 205 | switch (__builtin_nacl_target_arch()) { |
| 206 | case PnaclTargetArchitectureX86_32: |
| 207 | case PnaclTargetArchitectureX86_32_NonSFI: |
| 208 | return Target_X8632; |
| 209 | case PnaclTargetArchitectureX86_64: |
| 210 | return Target_X8664; |
| 211 | case PnaclTargetArchitectureARM_32: |
| 212 | case PnaclTargetArchitectureARM_32_NonSFI: |
| 213 | return Target_ARM32; |
| 214 | case PnaclTargetArchitectureMips_32: |
| 215 | return Target_MIPS32; |
| 216 | default: |
| 217 | llvm::report_fatal_error("no target architecture match."); |
| 218 | } |
| 219 | #elif defined(__i386__) |
| 220 | return Target_X8632; |
| 221 | #elif defined(__x86_64__) |
| 222 | return Target_X8664; |
| 223 | #elif defined(__arm__) |
| 224 | return Target_ARM32; |
| 225 | #else |
| 226 | // TODO(stichnot): Add mips. |
| 227 | #error "Unknown architecture" |
| 228 | #endif |
| 229 | } |
| 230 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 231 | } // end of anonymous namespace |
| 232 | |
Jim Stichnoth | eafb56c | 2015-06-22 10:35:22 -0700 | [diff] [blame] | 233 | BrowserCompileServer::~BrowserCompileServer() = default; |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 234 | |
| 235 | void BrowserCompileServer::run() { |
| 236 | gCompileServer = this; |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 237 | getIRTInterfaces(); |
| 238 | gIRTFuncs.serve_translate_request(&SubzeroCallbacks); |
| 239 | } |
| 240 | |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 241 | void BrowserCompileServer::getParsedFlags(bool UseNumThreadsFromBrowser, |
| 242 | uint32_t NumThreads, int argc, |
| 243 | const char *const *argv) { |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 244 | ClFlags::parseFlags(argc, argv); |
Karl Schimpf | d469994 | 2016-04-02 09:55:31 -0700 | [diff] [blame] | 245 | ClFlags::getParsedClFlags(ClFlags::Flags); |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 246 | // Set some defaults which aren't specified via the argv string. |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 247 | if (UseNumThreadsFromBrowser) |
| 248 | ClFlags::Flags.setNumTranslationThreads(NumThreads); |
Karl Schimpf | d469994 | 2016-04-02 09:55:31 -0700 | [diff] [blame] | 249 | ClFlags::Flags.setUseSandboxing(true); |
| 250 | ClFlags::Flags.setOutFileType(FT_Elf); |
| 251 | ClFlags::Flags.setTargetArch(getTargetArch()); |
| 252 | ClFlags::Flags.setInputFileFormat(llvm::PNaClFormat); |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) { |
Andrew Scull | 57e1268 | 2015-09-16 11:30:19 -0700 | [diff] [blame] | 256 | // If there was an earlier error, do not attempt to push bytes to the |
| 257 | // QueueStreamer. Otherwise the thread could become blocked. |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 258 | if (HadError.load()) |
| 259 | return true; |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 260 | return InputStream->PutBytes( |
| 261 | const_cast<unsigned char *>( |
| 262 | reinterpret_cast<const unsigned char *>(Data)), |
| 263 | NumBytes) != NumBytes; |
| 264 | } |
| 265 | |
Jim Stichnoth | 467ffe5 | 2016-03-29 15:01:06 -0700 | [diff] [blame] | 266 | void BrowserCompileServer::setFatalError(const std::string &Reason) { |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 267 | HadError.store(true); |
| 268 | Ctx->getStrError() << Reason; |
| 269 | // Make sure that the QueueStreamer is not stuck by signaling an early end. |
| 270 | InputStream->SetDone(); |
| 271 | } |
| 272 | |
| 273 | ErrorCode &BrowserCompileServer::getErrorCode() { |
| 274 | if (HadError.load()) { |
| 275 | // HadError means report_fatal_error is called. Make sure that the |
Andrew Scull | 57e1268 | 2015-09-16 11:30:19 -0700 | [diff] [blame] | 276 | // LastError is not EC_None. We don't know the type of error so just pick |
| 277 | // some error category. |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 278 | LastError.assign(EC_Translation); |
| 279 | } |
| 280 | return LastError; |
| 281 | } |
| 282 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 283 | void BrowserCompileServer::endInputStream() { InputStream->SetDone(); } |
| 284 | |
| 285 | void BrowserCompileServer::startCompileThread(int ObjFD) { |
| 286 | InputStream = new llvm::QueueStreamer(); |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 287 | bool LogStreamFailure = false; |
| 288 | int LogFD = STDOUT_FILENO; |
Jim Stichnoth | 6404504 | 2016-04-21 05:38:49 -0700 | [diff] [blame] | 289 | if (getFlags().getLogFilename() == "-") { |
| 290 | // Common case, do nothing. |
| 291 | } else if (getFlags().getLogFilename() == "/dev/stderr") { |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 292 | LogFD = STDERR_FILENO; |
| 293 | } else { |
| 294 | LogStreamFailure = true; |
| 295 | } |
| 296 | LogStream = getOutputStream(LogFD); |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 297 | LogStream->SetUnbuffered(); |
Jim Stichnoth | fd07ad0 | 2016-04-20 10:12:46 -0700 | [diff] [blame] | 298 | if (LogStreamFailure) { |
| 299 | *LogStream |
| 300 | << "Warning: Log file name must be either '-' or '/dev/stderr'\n"; |
| 301 | } |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 302 | EmitStream = getOutputStream(ObjFD); |
| 303 | EmitStream->SetBufferSize(1 << 14); |
Karl Schimpf | 2f67b92 | 2015-04-22 15:20:16 -0700 | [diff] [blame] | 304 | std::unique_ptr<StringStream> ErrStrm(new StringStream()); |
| 305 | ErrorStream = std::move(ErrStrm); |
Nicolas Capens | 3e37647 | 2016-09-13 11:35:57 -0400 | [diff] [blame] | 306 | ELFStream.reset(new ELFFileStreamer(*EmitStream.get())); |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 307 | Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(), |
Jim Stichnoth | 98ba006 | 2016-03-07 09:26:22 -0800 | [diff] [blame] | 308 | &ErrorStream->getStream(), ELFStream.get())); |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 309 | CompileThread = std::thread([this]() { |
Jan Voung | 2f7f2b7 | 2015-06-03 17:50:20 -0700 | [diff] [blame] | 310 | llvm::install_fatal_error_handler(fatalErrorHandler, this); |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 311 | Ctx->initParserThread(); |
Karl Schimpf | d469994 | 2016-04-02 09:55:31 -0700 | [diff] [blame] | 312 | this->getCompiler().run(ClFlags::Flags, *Ctx.get(), |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 313 | // Retain original reference, but the compiler |
| 314 | // (LLVM's MemoryObject) wants to handle deletion. |
| 315 | std::unique_ptr<llvm::DataStreamer>(InputStream)); |
| 316 | }); |
| 317 | } |
| 318 | |
| 319 | } // end of namespace Ice |
| 320 | |
John Porto | 44b3ce8 | 2016-02-26 13:10:55 -0800 | [diff] [blame] | 321 | #else // !PNACL_BROWSER_TRANSLATOR |
| 322 | |
| 323 | #include "llvm/Support/ErrorHandling.h" |
| 324 | |
| 325 | namespace Ice { |
| 326 | |
| 327 | BrowserCompileServer::~BrowserCompileServer() {} |
| 328 | |
| 329 | void BrowserCompileServer::run() { |
| 330 | llvm::report_fatal_error("no browser hookups"); |
| 331 | } |
| 332 | |
| 333 | ErrorCode &BrowserCompileServer::getErrorCode() { |
| 334 | llvm::report_fatal_error("no browser hookups"); |
| 335 | } |
| 336 | |
| 337 | } // end of namespace Ice |
| 338 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 339 | #endif // PNACL_BROWSER_TRANSLATOR |