Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(887)

Side by Side Diff: ports/pnacl-llvm-src/nacl.patch

Issue 1607793004: Update pnacl toolchain version (Closed) Base URL: https://chromium.googlesource.com/webports.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ports/pnacl-llvm-src/README.nacl ('k') | ports/pnacl-llvm-src/pkg_info » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 diff --git a/Makefile.rules b/Makefile.rules
2 --- a/Makefile.rules
3 +++ b/Makefile.rules
4 @@ -1200,6 +1200,7 @@ ifdef EXPORTED_SYMBOL_FILE
5 $(LibName.SO): $(NativeExportsFile)
6 endif
7
8 +ifeq ($(ENABLE_SHARED),1)
9 ifdef LINK_LIBS_IN_SHARED
10 ifdef LOADABLE_MODULE
11 SharedLibKindMessage := "Loadable Module"
12 @@ -1217,6 +1218,7 @@ $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
13 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
14 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
15 endif
16 +endif
17
18 clean-local::
19 ifneq ($(strip $(LibName.SO)),)
20 @@ -1239,6 +1241,7 @@ endif
21 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
22 DestSharedAlias := $(DestSharedLibDir)/$(BaseAliasName.SO)
23
24 +ifeq ($(ENABLE_SHARED),1)
25 install-local:: $(DestSharedLib)
26
27 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
28 @@ -1257,6 +1260,7 @@ ifdef SHARED_ALIAS
29 endif
30 endif
31 endif
32 +endif
33
34 #---------------------------------------------------------
35 # Library Targets:
36 @@ -1265,9 +1269,13 @@ endif
37 #---------------------------------------------------------
38 ifndef NO_BUILD_ARCHIVE
39 ifndef BUILD_ARCHIVE
40 +ifeq ($(ENABLE_SHARED),1)
41 ifndef LOADABLE_MODULE
42 BUILD_ARCHIVE = 1
43 endif
44 +else
45 +BUILD_ARCHIVE = 1
46 +endif
47 endif
48 endif
49
50 diff --git a/include/llvm/Support/TargetRegistry.h b/include/llvm/Support/Target Registry.h
51 --- a/include/llvm/Support/TargetRegistry.h
52 +++ b/include/llvm/Support/TargetRegistry.h
53 @@ -814,7 +814,7 @@ namespace llvm {
54 // @LOCALMOD-BEGIN
55 // Prune out the .s printer for the sandboxed translator,
56 // by preventing an InstPrinter from being used at all.
57 - #if !defined(__native_client__)
58 + #if !defined(PNACL_BROWSER_TRANSLATOR)
59 T.MCInstPrinterCtorFn = Fn;
60 #endif
61 // @LOCALMOD-END
62 diff --git a/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp b/lib/Execu tionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
63 --- a/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
64 +++ b/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
65 @@ -34,7 +34,8 @@ RTDyldMemoryManager::~RTDyldMemoryManager() {}
66
67 // Determine whether we can register EH tables.
68 #if (defined(__GNUC__) && !defined(__ARM_EABI__) && !defined(__ia64__) && \
69 - !defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__))
70 + !defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
71 + !defined(__pnacl__))
72 #define HAVE_EHTABLE_SUPPORT 1
73 #else
74 #define HAVE_EHTABLE_SUPPORT 0
1 diff --git a/lib/Support/Host.cpp b/lib/Support/Host.cpp 75 diff --git a/lib/Support/Host.cpp b/lib/Support/Host.cpp
2 --- a/lib/Support/Host.cpp 76 --- a/lib/Support/Host.cpp
3 +++ b/lib/Support/Host.cpp 77 +++ b/lib/Support/Host.cpp
4 @@ -168,7 +168,7 @@ static bool GetX86CpuIDAndInfoEx(unsigned value, unsigned su bleaf, 78 @@ -183,7 +183,7 @@ static bool GetX86CpuIDAndInfoEx(unsigned value, unsigned su bleaf,
5 } 79 }
6 80
7 static bool OSHasAVXSupport() { 81 static bool GetX86XCR0(unsigned *rEAX, unsigned *rEDX) {
8 -#if defined(__GNUC__) 82 -#if defined(__GNUC__)
9 +#if defined(__GNUC__) && !defined(__native_client__) 83 +#if defined(__GNUC__) && !defined(__native_client__)
10 // Check xgetbv; this uses a .byte sequence instead of the instruction 84 // Check xgetbv; this uses a .byte sequence instead of the instruction
11 // directly because older assemblers do not include support for xgetbv and 85 // directly because older assemblers do not include support for xgetbv and
12 // there is no easy way to conditionally compile based on the assembler used. 86 // there is no easy way to conditionally compile based on the assembler used.
87 diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
88 --- a/lib/Support/Unix/Path.inc
89 +++ b/lib/Support/Unix/Path.inc
90 @@ -67,7 +67,8 @@ namespace sys {
91 namespace fs {
92 #if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \
93 defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) || \
94 - defined(__linux__) || defined(__CYGWIN__) || defined(__DragonFly__)
95 + defined(__linux__) || defined(__CYGWIN__) || defined(__DragonFly__) || \
96 + defined(__native_client__)
97 static int
98 test_dir(char ret[PATH_MAX], const char *dir, const char *bin)
99 {
100 @@ -171,6 +172,11 @@ std::string getMainExecutable(const char *argv0, void *Main Addr) {
101 // @LOCALMOD-BEGIN
102 #elif defined(__native_client__)
103 // Nothing.
104 +#if !defined(PNACL_BROWSER_TRANSLATOR)
105 + char exe_path[MAXPATHLEN];
106 + if (getprogpath(exe_path, argv0) != NULL)
107 + return exe_path;
108 +#endif
109 // @LOCALMOD-END
110 #else
111 #error GetMainExecutable is not implemented on this host yet.
112 @@ -192,13 +198,13 @@ std::error_code current_path(SmallVectorImpl<char> &result ) {
113 result.clear();
114 // @LOCALMOD-START NaCl doesn't have paths, and the translator returns an
115 // error for getcwd below. Return a dummy path instead.
116 -#if defined(__native_client__)
117 +#if defined(PNACL_BROWSER_TRANSLATOR)
118 result.reserve(2);
119 result.set_size(2);
120 result[0] = '/';
121 result[1] = '\0';
122 return std::error_code();
123 -#else // !defined(__native_client__)
124 +#else // !defined(PNACL_BROWSER_TRANSLATOR)
125 // @LOCALMOD-END
126 const char *pwd = ::getenv("PWD");
127 llvm::sys::fs::file_status PWDStatus, DotStatus;
128 diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc
129 --- a/lib/Support/Unix/Process.inc
130 +++ b/lib/Support/Unix/Process.inc
131 @@ -61,7 +61,9 @@ using namespace llvm;
132 using namespace sys;
133
134 static std::pair<TimeValue, TimeValue> getRUsageTimes() {
135 -#if defined(HAVE_GETRUSAGE)
136 +// @LOCALMOD-BEGIN
137 +#if defined(HAVE_GETRUSAGE) && !defined(__native_client__)
138 +// @LOCALMOD-END
139 struct rusage RU;
140 ::getrusage(RUSAGE_SELF, &RU);
141 return std::make_pair(
142 diff --git a/lib/Support/Unix/Program.inc b/lib/Support/Unix/Program.inc
143 --- a/lib/Support/Unix/Program.inc
144 +++ b/lib/Support/Unix/Program.inc
145 @@ -16,6 +16,11 @@
146 //=== is guaranteed to work on *all* UNIX variants.
147 //===----------------------------------------------------------------------===/ /
148
149 +// @LOCALMOD-BEGIN
150 +#if defined(__native_client__) && !defined(PNACL_BROWSER_TRANSLATOR)
151 +#include <spawn.h>
152 +#endif
153 +// @LOCALMOD-END
154 #include "Unix.h"
155 #include "llvm/ADT/StringExtras.h"
156 #include "llvm/Config/config.h"
157 @@ -187,6 +192,15 @@ static bool Execute(ProcessInfo &PI, StringRef Program, con st char **args,
158 return false;
159 }
160
161 +// @LOCALMOD-BEGIN
162 +#if defined(__native_client__) && !defined(PNACL_BROWSER_TRANSLATOR)
163 + int child = spawnve(P_NOWAIT, Program.begin(), (char**) args, (char**) envp);
164 + if (child < 0) {
165 + MakeErrMsg(ErrMsg, "Couldn't spawn");
166 + return false;
167 + }
168 +#else
169 +// @LOCALMOD-END
170 // If this OS has posix_spawn and there is no memory limit being implied, use
171 // posix_spawn. It is more efficient than fork/exec.
172 #ifdef HAVE_POSIX_SPAWN
173 @@ -312,6 +326,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, cons t char **args,
174 default:
175 break;
176 }
177 +#endif
178
179 PI.Pid = child;
180
181 @@ -324,8 +339,10 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned Secon dsToWait,
182 bool WaitUntilTerminates, std::string *ErrMsg) {
183 // @LOCALMOD-BEGIN
184 #if defined(HAVE_SYS_WAIT_H) && !defined(PNACL_BROWSER_TRANSLATOR)
185 - // @LOCALMOD-END
186 +#if !defined(__native_client__)
187 struct sigaction Act, Old;
188 +#endif
189 + // @LOCALMOD-END
190 assert(PI.Pid && "invalid pid to wait on, process not started?");
191
192 int WaitPidOptions = 0;
193 @@ -333,6 +350,9 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned Second sToWait,
194 if (WaitUntilTerminates) {
195 SecondsToWait = 0;
196 } else if (SecondsToWait) {
197 +// @LOCALMOD-BEGIN
198 +#if !defined(__native_client__)
199 +// @LOCALMOD-END
200 // Install a timeout handler. The handler itself does nothing, but the
201 // simple fact of having a handler at all causes the wait below to return
202 // with EINTR, unlike if we used SIG_IGN.
203 @@ -341,6 +361,9 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned Second sToWait,
204 sigemptyset(&Act.sa_mask);
205 sigaction(SIGALRM, &Act, &Old);
206 alarm(SecondsToWait);
207 +// @LOCALMOD-BEGIN
208 +#endif
209 +// @LOCALMOD-END
210 } else if (SecondsToWait == 0)
211 WaitPidOptions = WNOHANG;
212
213 @@ -358,12 +381,18 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned Seco ndsToWait,
214 return WaitResult;
215 } else {
216 if (SecondsToWait && errno == EINTR) {
217 +// @LOCALMOD-BEGIN
218 +#if !defined(__native_client__)
219 +// @LOCALMOD-END
220 // Kill the child.
221 kill(PI.Pid, SIGKILL);
222
223 // Turn off the alarm and restore the signal handler
224 alarm(0);
225 sigaction(SIGALRM, &Old, nullptr);
226 +// @LOCALMOD-BEGIN
227 +#endif
228 +// @LOCALMOD-END
229
230 // Wait for child to die
231 if (wait(&status) != ChildPid)
232 @@ -381,11 +410,17 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned Seco ndsToWait,
233 }
234 }
235
236 +// @LOCALMOD-BEGIN
237 +#if !defined(__native_client__)
238 +// @LOCALMOD-END
239 // We exited normally without timeout, so turn off the timer.
240 if (SecondsToWait && !WaitUntilTerminates) {
241 alarm(0);
242 sigaction(SIGALRM, &Old, nullptr);
243 }
244 +// @LOCALMOD-BEGIN
245 +#endif
246 +// @LOCALMOD-END
247
248 // Return the proper exit status. Detect error conditions
249 // so we can return -1 for them and set ErrMsg informatively.
250 @@ -455,11 +490,13 @@ llvm::sys::writeFileWithEncoding(StringRef FileName, Strin gRef Contents,
251 }
252
253 bool llvm::sys::argumentsFitWithinSystemLimits(ArrayRef<const char*> Args) {
254 +// @LOCALMOD-BEGIN
255 #if defined(__native_client__)
256 static long ArgMax = -1;
257 #else // !__native_client__
258 static long ArgMax = sysconf(_SC_ARG_MAX);
259 #endif // __native_client__
260 +// @LOCALMOD-END
261
262 // System says no practical limit.
263 if (ArgMax == -1)
264 diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc
265 --- a/lib/Support/Unix/Signals.inc
266 +++ b/lib/Support/Unix/Signals.inc
267 @@ -50,7 +50,9 @@
268
269 using namespace llvm;
270
271 +#if !defined(__native_client__)
272 static RETSIGTYPE SignalHandler(int Sig); // defined below.
273 +#endif
274
275 static ManagedStatic<SmartMutex<true> > SignalsMutex;
276
277 @@ -121,15 +123,15 @@ static void RegisterHandlers() {
278 for (auto S : KillSigs) RegisterHandler(S);
279 }
280
281 -static void UnregisterHandlers() {
282 #if !defined(__native_client__)
283 +static void UnregisterHandlers() {
284 // Restore all of the signal handlers to how they were before we showed up.
285 for (unsigned i = 0, e = NumRegisteredSignals; i != e; ++i)
286 sigaction(RegisteredSignalInfo[i].SigNo,
287 &RegisteredSignalInfo[i].SA, nullptr);
288 NumRegisteredSignals = 0;
289 -#endif // (__native_client__)
290 }
291 +#endif // (__native_client__)
292
293
294 /// RemoveFilesToRemove - Process the FilesToRemove list. This function
295 @@ -164,6 +166,7 @@ static void RemoveFilesToRemove() {
296 }
297 }
298
299 +#if !defined(__native_client__)
300 // SignalHandler - The signal handler that runs.
301 static RETSIGTYPE SignalHandler(int Sig) {
302 // Restore the signal behavior to default, so that the program actually
303 @@ -172,12 +175,10 @@ static RETSIGTYPE SignalHandler(int Sig) {
304 // instead of recursing in the signal handler.
305 UnregisterHandlers();
306
307 -#if !defined(__native_client__)
308 // Unmask all potentially blocked kill signals.
309 sigset_t SigMask;
310 sigfillset(&SigMask);
311 sigprocmask(SIG_UNBLOCK, &SigMask, nullptr);
312 -#endif
313
314 {
315 unique_lock<SmartMutex<true>> Guard(*SignalsMutex);
316 @@ -214,6 +215,7 @@ static RETSIGTYPE SignalHandler(int Sig) {
317 raise(Sig);
318 #endif
319 }
320 +#endif
321
322 void llvm::sys::RunInterruptHandlers() {
323 sys::SmartScopedLock<true> Guard(*SignalsMutex);
324 diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
325 --- a/tools/gold/gold-plugin.cpp
326 +++ b/tools/gold/gold-plugin.cpp
327 @@ -154,14 +154,20 @@ static ld_plugin_status claim_file_hook(const ld_plugin_in put_file *file,
328 static ld_plugin_status all_symbols_read_hook(void);
329 static ld_plugin_status cleanup_hook(void);
330
331 +// @LOCALMOD-BEGIN
332 +#if defined(__native_client__)
333 +extern "C" ld_plugin_status LLVMgold_onload(ld_plugin_tv *tv);
334 +ld_plugin_status LLVMgold_onload(ld_plugin_tv *tv) {
335 +#else
336 extern "C" ld_plugin_status onload(ld_plugin_tv *tv);
337 ld_plugin_status onload(ld_plugin_tv *tv) {
338 +#endif
339 +// @LOCALMOD-END
340 InitializeAllTargetInfos();
341 InitializeAllTargets();
342 InitializeAllTargetMCs();
343 InitializeAllAsmParsers();
344 InitializeAllAsmPrinters();
345 -
346 // We're given a pointer to the first transfer vector. We read through them
347 // until we find one where tv_tag == LDPT_NULL. The REGISTER_* tagged values
348 // contain pointers to functions that we need to call to register our own
349 diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
350 --- a/tools/lli/lli.cpp
351 +++ b/tools/lli/lli.cpp
352 @@ -386,7 +386,15 @@ static void addCygMingExtraModule(ExecutionEngine *EE,
353 //===----------------------------------------------------------------------===/ /
354 // main Driver function
355 //
356 +// @LOCALMOD-BEGIN
357 +#if defined(__native_client__)
358 +extern char **environ;
359 +int main(int argc, char **argv) {
360 + char * const *envp = environ;
361 +#else
362 int main(int argc, char **argv, char * const *envp) {
363 +#endif
364 +// @LOCALMOD-END
365 sys::PrintStackTraceOnErrorSignal();
366 PrettyStackTraceProgram X(argc, argv);
367
368 diff --git a/unittests/Bitcode/NaClMungeWriteErrorTests.cpp b/unittests/Bitcode/ NaClMungeWriteErrorTests.cpp
369 --- a/unittests/Bitcode/NaClMungeWriteErrorTests.cpp
370 +++ b/unittests/Bitcode/NaClMungeWriteErrorTests.cpp
371 @@ -180,6 +180,7 @@ TEST(NaClMungeWriteErrorTests, CantWriteBadAbbrevIndex) {
372 ExpectedDumpedBitcode);
373 }
374
375 +#ifdef GTEST_HAS_DEATH_TEST
376 // Show that writing out an illegal abbreviation index, causes the
377 // parser to fail.
378 TEST(MyNaClMungerWriteErrorTests, DieOnWriteBadAbbreviationIndex) {
379 @@ -199,6 +200,7 @@ TEST(MyNaClMungerWriteErrorTests, DieOnWriteBadAbbreviationI ndex) {
380 "LLVM ERROR\\: Unable to continue"
381 ".*");
382 }
383 +#endif
384
385 // Show what happens when we use more local abbreviations than specified in the
386 // corresponding enclosing block.
387 diff --git a/unittests/Makefile b/unittests/Makefile
388 --- a/unittests/Makefile
389 +++ b/unittests/Makefile
390 @@ -7,6 +7,14 @@
391 #
392 ##===----------------------------------------------------------------------===# #
393
394 +ifeq ($(HOST_OS),NativeClient)
395 +all:
396 + echo skipping
397 +
398 +install:
399 + echo skipping
400 +else
401 +
402 LEVEL = ..
403
404 PARALLEL_DIRS = ADT Analysis Bitcode CodeGen DebugInfo ExecutionEngine IR \
405 @@ -17,3 +25,5 @@ include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
406
407 clean::
408 $(Verb) $(RM) -f *Tests
409 +
410 +endif
OLDNEW
« no previous file with comments | « ports/pnacl-llvm-src/README.nacl ('k') | ports/pnacl-llvm-src/pkg_info » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698