Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 48588f9

Browse files
committed
Revert "Merge remote-tracking branch 'github/upstream-with-swift' into HEAD"
This reverts commit 362dfa5, reversing changes made to daa6759.
1 parent 362dfa5 commit 48588f9

File tree

9 files changed

+7
-127
lines changed

9 files changed

+7
-127
lines changed

README.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ Compiler-RT is open source software. You may freely distribute it under the
88
terms of the license agreement found in LICENSE.txt.
99

1010
================================
11+

lib/profile/InstrProfilingFile.c

+4-60
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <stdio.h>
1313
#include <stdlib.h>
1414
#include <string.h>
15-
#include <signal.h>
1615
#ifdef _MSC_VER
1716
/* For _alloca. */
1817
#include <malloc.h>
@@ -63,7 +62,6 @@ static const char *getPNSStr(ProfileNameSpecifier PNS) {
6362
}
6463

6564
#define MAX_PID_SIZE 16
66-
#define MAX_SIGNAL_HANDLERS 16
6765
/* Data structure holding the result of parsed filename pattern. */
6866
typedef struct lprofFilename {
6967
/* File name string possibly with %p or %h specifiers. */
@@ -85,14 +83,11 @@ typedef struct lprofFilename {
8583
* 2 profile data files. %1m is equivalent to %m. Also %m specifier
8684
* can only appear once at the end of the name pattern. */
8785
unsigned MergePoolSize;
88-
char ExitOnSignals[MAX_SIGNAL_HANDLERS];
89-
unsigned NumExitSignals;
9086
ProfileNameSpecifier PNS;
9187
} lprofFilename;
9288

9389
COMPILER_RT_WEAK lprofFilename lprofCurFilename = {0, 0, 0, 0, {0},
94-
{0}, 0, 0, 0, {0}, 0,
95-
PNS_unknown};
90+
{0}, 0, 0, 0, PNS_unknown};
9691

9792
static int getCurFilenameLength();
9893
static const char *getCurFilename(char *FilenameBuf, int ForceUseBuf);
@@ -291,19 +286,6 @@ static void truncateCurrentFile(void) {
291286
fclose(File);
292287
}
293288

294-
static void exitSignalHandler(int sig) {
295-
(void)sig;
296-
exit(0);
297-
}
298-
299-
static void installExitSignalHandlers(void) {
300-
unsigned I;
301-
for (I = 0; I < lprofCurFilename.NumExitSignals; ++I) {
302-
lprofInstallSignalHandler(lprofCurFilename.ExitOnSignals[I],
303-
exitSignalHandler);
304-
}
305-
}
306-
307289
static const char *DefaultProfileName = "default.profraw";
308290
static void resetFilenameToDefault(void) {
309291
if (lprofCurFilename.FilenamePat && lprofCurFilename.OwnsFilenamePat) {
@@ -314,25 +296,14 @@ static void resetFilenameToDefault(void) {
314296
lprofCurFilename.PNS = PNS_default;
315297
}
316298

317-
static int isDigit(char C) { return C >= '0' && C <= '9'; }
318-
319-
static int isNonZeroDigit(char C) { return C >= '1' && C <= '9'; }
320-
321299
static int containsMergeSpecifier(const char *FilenamePat, int I) {
322300
return (FilenamePat[I] == 'm' ||
323-
(isNonZeroDigit(FilenamePat[I]) &&
301+
(FilenamePat[I] >= '1' && FilenamePat[I] <= '9' &&
324302
/* If FilenamePat[I] is not '\0', the next byte is guaranteed
325303
* to be in-bound as the string is null terminated. */
326304
FilenamePat[I + 1] == 'm'));
327305
}
328306

329-
static int containsExitOnSignalSpecifier(const char *FilenamePat, int I) {
330-
if (!isNonZeroDigit(FilenamePat[I]))
331-
return 0;
332-
return (FilenamePat[I + 1] == 'x') ||
333-
(isDigit(FilenamePat[I + 1]) && FilenamePat[I + 2] == 'x');
334-
}
335-
336307
/* Parses the pattern string \p FilenamePat and stores the result to
337308
* lprofcurFilename structure. */
338309
static int parseFilenamePattern(const char *FilenamePat,
@@ -341,7 +312,6 @@ static int parseFilenamePattern(const char *FilenamePat,
341312
char *PidChars = &lprofCurFilename.PidChars[0];
342313
char *Hostname = &lprofCurFilename.Hostname[0];
343314
int MergingEnabled = 0;
344-
char SignalNo;
345315

346316
/* Clean up cached prefix and filename. */
347317
if (lprofCurFilename.ProfilePathPrefix)
@@ -394,22 +364,6 @@ static int parseFilenamePattern(const char *FilenamePat,
394364
lprofCurFilename.MergePoolSize = FilenamePat[I] - '0';
395365
I++; /* advance to 'm' */
396366
}
397-
} else if (containsExitOnSignalSpecifier(FilenamePat, I)) {
398-
if (lprofCurFilename.NumExitSignals == MAX_SIGNAL_HANDLERS) {
399-
PROF_WARN("%%x specifier has been specified too many times in %s.\n",
400-
FilenamePat);
401-
return -1;
402-
}
403-
/* Grab the signal number. */
404-
SignalNo = FilenamePat[I] - '0';
405-
I++; /* advance to either another digit, or 'x' */
406-
if (FilenamePat[I] != 'x') {
407-
SignalNo = (SignalNo * 10) + (FilenamePat[I] - '0');
408-
I++; /* advance to 'x' */
409-
}
410-
lprofCurFilename.ExitOnSignals[lprofCurFilename.NumExitSignals] =
411-
SignalNo;
412-
++lprofCurFilename.NumExitSignals;
413367
}
414368
}
415369

@@ -453,7 +407,6 @@ static void parseAndSetFilename(const char *FilenamePat,
453407
}
454408

455409
truncateCurrentFile();
456-
installExitSignalHandlers();
457410
}
458411

459412
/* Return buffer length that is required to store the current profile
@@ -462,24 +415,18 @@ static void parseAndSetFilename(const char *FilenamePat,
462415
#define SIGLEN 24
463416
static int getCurFilenameLength() {
464417
int Len;
465-
unsigned I;
466418
if (!lprofCurFilename.FilenamePat || !lprofCurFilename.FilenamePat[0])
467419
return 0;
468420

469421
if (!(lprofCurFilename.NumPids || lprofCurFilename.NumHosts ||
470-
lprofCurFilename.MergePoolSize || lprofCurFilename.NumExitSignals))
422+
lprofCurFilename.MergePoolSize))
471423
return strlen(lprofCurFilename.FilenamePat);
472424

473425
Len = strlen(lprofCurFilename.FilenamePat) +
474426
lprofCurFilename.NumPids * (strlen(lprofCurFilename.PidChars) - 2) +
475427
lprofCurFilename.NumHosts * (strlen(lprofCurFilename.Hostname) - 2);
476428
if (lprofCurFilename.MergePoolSize)
477429
Len += SIGLEN;
478-
for (I = 0; I < lprofCurFilename.NumExitSignals; ++I) {
479-
Len -= 3; /* Drop the '%', signal number, and the 'x'. */
480-
if (lprofCurFilename.ExitOnSignals[I] >= 10)
481-
--Len; /* Drop the second digit of the signal number. */
482-
}
483430
return Len;
484431
}
485432

@@ -496,7 +443,7 @@ static const char *getCurFilename(char *FilenameBuf, int ForceUseBuf) {
496443
return 0;
497444

498445
if (!(lprofCurFilename.NumPids || lprofCurFilename.NumHosts ||
499-
lprofCurFilename.MergePoolSize || lprofCurFilename.NumExitSignals)) {
446+
lprofCurFilename.MergePoolSize)) {
500447
if (!ForceUseBuf)
501448
return lprofCurFilename.FilenamePat;
502449

@@ -529,9 +476,6 @@ static const char *getCurFilename(char *FilenameBuf, int ForceUseBuf) {
529476
J += S;
530477
if (FilenamePat[I] != 'm')
531478
I++;
532-
} else if (containsExitOnSignalSpecifier(FilenamePat, I)) {
533-
while (FilenamePat[I] != 'x')
534-
++I;
535479
}
536480
/* Drop any unknown substitutions. */
537481
} else

lib/profile/InstrProfilingUtil.c

-19
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <sys/utsname.h>
2424
#endif
2525

26-
#include <signal.h>
2726
#include <stdlib.h>
2827
#include <string.h>
2928

@@ -271,24 +270,6 @@ COMPILER_RT_VISIBILITY const char *lprofFindLastDirSeparator(const char *Path) {
271270
return Sep;
272271
}
273272

274-
COMPILER_RT_VISIBILITY void lprofInstallSignalHandler(int sig,
275-
void (*handler)(int)) {
276-
#ifdef _WIN32
277-
void (*err)(int) = signal(sig, handler);
278-
if (err == SIG_ERR)
279-
PROF_WARN("Unable to install an exit signal handler for %d (errno = %d).\n",
280-
sig, errno);
281-
#else
282-
struct sigaction sigact;
283-
memset(&sigact, 0, sizeof(sigact));
284-
sigact.sa_handler = handler;
285-
int err = sigaction(sig, &sigact, NULL);
286-
if (err)
287-
PROF_WARN("Unable to install an exit signal handler for %d (errno = %d).\n",
288-
sig, err);
289-
#endif
290-
}
291-
292273
COMPILER_RT_VISIBILITY int lprofSuspendSigKill() {
293274
#if defined(__linux__)
294275
int PDeachSig = 0;

lib/profile/InstrProfilingUtil.h

-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ int lprofGetHostName(char *Name, int Len);
5959
unsigned lprofBoolCmpXchg(void **Ptr, void *OldV, void *NewV);
6060
void *lprofPtrFetchAdd(void **Mem, long ByteIncr);
6161

62-
void lprofInstallSignalHandler(int sig, void(*handler)(int));
63-
6462
/* Temporarily suspend SIGKILL. Return value of 1 means a restore is needed.
6563
* Other return values mean no restore is needed.
6664
*/

lib/tsan/rtl/tsan_rtl_thread.cc

+2-6
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,10 @@ void ThreadStart(ThreadState *thr, int tid, tid_t os_id, bool workerthread) {
275275
void ThreadFinish(ThreadState *thr) {
276276
ThreadCheckIgnore(thr);
277277
StatInc(thr, StatThreadFinish);
278-
if (thr->stk_addr && thr->stk_size) {
279-
MemoryResetRange(thr, /*pc=*/ 1, thr->stk_addr, thr->stk_size);
278+
if (thr->stk_addr && thr->stk_size)
280279
DontNeedShadowFor(thr->stk_addr, thr->stk_size);
281-
}
282-
if (thr->tls_addr && thr->tls_size) {
283-
MemoryResetRange(thr, /*pc=*/ 1, thr->tls_addr, thr->tls_size);
280+
if (thr->tls_addr && thr->tls_size)
284281
DontNeedShadowFor(thr->tls_addr, thr->tls_size);
285-
}
286282
thr->is_dead = true;
287283
ctx->thread_registry->FinishThread(thr->tid);
288284
}

test/lit.common.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ if re.match(r'^x86_64.*-linux', config.target_triple):
101101
if config.have_zlib == "1":
102102
config.available_features.add("zlib")
103103

104-
if lit.util.isMacOSTriple(config.target_triple):
105-
config.available_features.add('darwin')
106-
107104
# Use ugly construction to explicitly prohibit "clang", "clang++" etc.
108105
# in RUN lines.
109106
config.substitutions.append(

test/lsan/lit.common.cfg

-5
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,3 @@ if re.search('mthumb', config.target_cflags) is not None:
7878
config.unsupported = True
7979

8080
config.suffixes = ['.c', '.cc', '.cpp', '.mm']
81-
82-
# Apple-Clang: Disable LSan
83-
if config.host_os == 'Darwin':
84-
lit_config.note('Disabling LSan tests on Darwin')
85-
config.unsupported = True

test/profile/instrprof-exit-on-signal.c

-26
This file was deleted.

test/sanitizer_common/lit.common.cfg

-6
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,3 @@ config.suffixes = ['.c', '.cc', '.cpp']
7070

7171
if config.host_os not in ['Linux', 'Darwin', 'NetBSD', 'FreeBSD']:
7272
config.unsupported = True
73-
74-
# Apple-internal: Disable LSan sanitizer_common tests
75-
# because AppleClang doesn't support LSan (rdar://problem/47381908).
76-
if config.tool_name == 'lsan' and config.host_os == 'Darwin':
77-
lit_config.note('LSan sanitizer_common tests disabled')
78-
config.unsupported = True

0 commit comments

Comments
 (0)