Commit Graph

6281 Commits

Author SHA1 Message Date
Evgeniy Stepanov f485c3ccbd [asan] Add a negative test for memcpy of long double.
llvm-svn: 151888
2012-03-02 10:42:10 +00:00
Alexander Potapenko 8e9d772c5a Force __asan_set_death_callback into the resulting binary.
llvm-svn: 151808
2012-03-01 14:39:21 +00:00
Timur Iskhodzhanov 972720e564 [ASan] Replace CRT .dll malloc with our implementation at asan_init() time
llvm-svn: 151715
2012-02-29 11:43:03 +00:00
Alexander Potapenko 7e07f56811 Introduce __asan_set_error_report_callback() to allow the client program post-process the error reports.
If the callback is set, Report() and Printf() print the reports into a buffer (together with stderr), which is then passed to the client.

llvm-svn: 151528
2012-02-27 14:06:48 +00:00
Evgeniy Stepanov d84e16e6a3 Replace some #ifdef(s) with plain if(s).
llvm-svn: 151526
2012-02-27 13:07:29 +00:00
Alexey Samsonov a1a3a2ffc3 AddressSanitizer: add some checks to AsanChunkFifoList::PushList
llvm-svn: 151521
2012-02-27 09:06:10 +00:00
Kostya Serebryany 6ad2115575 [asan] don't compile gtest with asan when building asan tests
llvm-svn: 151391
2012-02-24 20:49:36 +00:00
Timur Iskhodzhanov 0f9c9a5332 [ASan] Intercept CreateThread on Windows
llvm-svn: 151366
2012-02-24 15:28:43 +00:00
Alexey Samsonov 53e191e77e AddressSanitizer: quick fix - undef INT32_MIN etc to avoid macro redefinition
llvm-svn: 151165
2012-02-22 16:12:46 +00:00
Alexey Samsonov d6651509d0 AddressSanitizer: get rid of stdlib.h and add (smaller) stddef.h instead
llvm-svn: 151162
2012-02-22 14:07:06 +00:00
Timur Iskhodzhanov 36d297d27f [ASan] Intercept functions on Windows - first version
llvm-svn: 151161
2012-02-22 13:59:49 +00:00
Alexey Samsonov a5b3130e86 AddressSanitizer: get rid of limits.h, use constants for fixed size integral types instead.
llvm-svn: 151159
2012-02-22 12:54:04 +00:00
Evgeniy Stepanov abaf196be3 [asan] Remove mentions of pthread*_t from interceptors.
Some platforms do not define pthread_t in stdlib.h.

llvm-svn: 151158
2012-02-22 12:31:25 +00:00
Alexey Samsonov 2df8afa075 AddressSanitizer: fix Makefile.old - gtest should depend on libasan
llvm-svn: 151157
2012-02-22 11:59:44 +00:00
Timur Iskhodzhanov 94602b48ee [ASan] Fix style + suppress 'long' lint warnings
llvm-svn: 151149
2012-02-22 09:28:14 +00:00
Alexander Potapenko 2c0ed61c7a Move the contents of AsanProcMaps::Dump() into AsanDumpProcessMaps() for Posix systems.
Define AsanDumpProcessMaps as unimplemented on Windows.

This should fix the Windows build.

llvm-svn: 151147
2012-02-22 09:11:55 +00:00
Timur Iskhodzhanov 3a32ed913b [ASan] Fix a wrong filename mentioned in a comment
llvm-svn: 151145
2012-02-22 08:56:25 +00:00
Alexander Potapenko c259ab3cac Dump the process memory map if any of the mappings interleaves with the shadow.
llvm-svn: 151141
2012-02-22 08:27:32 +00:00
Alexander Potapenko fce2ca9f66 Add AsanProcMaps::Dump()
llvm-svn: 151139
2012-02-22 08:13:47 +00:00
Timur Iskhodzhanov a1c987ff38 [ASan] Add __asan_init to the list of C dynamic initializers to support /MD on Windows
llvm-svn: 151059
2012-02-21 16:24:23 +00:00
Alexander Potapenko 47038cae29 Fix the lib32 and lib64 targets.
llvm-svn: 151057
2012-02-21 14:11:52 +00:00
Timur Iskhodzhanov f2061453bd [ASan] Remove one FIXME - re-enable "free-not-malloced" reports on Windows
llvm-svn: 151051
2012-02-21 09:58:39 +00:00
Alexander Potapenko 0be25d562c Check that the FakeStack size is non-zero before looking into it.
Sometimes DescribeStackAddress is called before another thread's FakeStack is initialized, which could previously cause a check to fire.

llvm-svn: 151046
2012-02-21 08:45:41 +00:00
Alexey Samsonov 789456bf68 AddressSanitizer: Don't include GrandCentralDispatch headers in asan headers on Mac
llvm-svn: 151044
2012-02-21 08:30:57 +00:00
Alexey Samsonov 2d2f1711b7 AddressSanitizer: don't use /tmp for temporary file in output tests.
llvm-svn: 151042
2012-02-21 07:08:38 +00:00
Alexey Samsonov 0d0b406aba AddressSanitizer: use custom strtol/atoll functions
llvm-svn: 150812
2012-02-17 16:15:09 +00:00
Alexey Samsonov 8e7bfceb98 AddressSanitizer: fix lint
llvm-svn: 150802
2012-02-17 08:31:10 +00:00
Alexey Samsonov fbb50f19ad AddressSanitizer: revert r150683 - we can't get rid of headers that easily
llvm-svn: 150699
2012-02-16 17:00:45 +00:00
Evgeniy Stepanov 5d47e9164c [asan] Allocator tweaks for low memory systems.
llvm-svn: 150689
2012-02-16 13:35:11 +00:00
Alexey Samsonov ca37969c24 AddressSanitizer: don't include pthread.h and signal.h in interceptors on Mac
llvm-svn: 150683
2012-02-16 11:26:52 +00:00
Kostya Serebryany 10dbd68bd2 [asan] don't do AsanDie twice
llvm-svn: 150641
2012-02-16 00:40:18 +00:00
Alexey Samsonov 1e7e2370aa AddressSanitizer: don't include pthread.h in asan_interceptors.cc on Linux
llvm-svn: 150573
2012-02-15 09:14:26 +00:00
Alexey Samsonov 278c25f241 AddressSanitizer: simplify IntervalsAreSeparate function
llvm-svn: 150569
2012-02-15 08:27:34 +00:00
Timur Iskhodzhanov d2a9075de0 [ASan] Define an internal implementation of strchr to make stack OOB tests pass on Windows
llvm-svn: 150499
2012-02-14 19:33:04 +00:00
Evgeniy Stepanov 2ee5950dd0 [asan] Add lots of missing visibility attributes.
llvm-svn: 150479
2012-02-14 13:46:06 +00:00
Kostya Serebryany fcd535ba6c [asan] implement __asan_set_death_callback
llvm-svn: 150414
2012-02-13 21:24:29 +00:00
Alexander Potapenko 438447a7f3 Fix compilation on Mac.
llvm-svn: 150400
2012-02-13 17:14:31 +00:00
Alexander Potapenko 234d8c2168 Lint fix
llvm-svn: 150399
2012-02-13 17:11:19 +00:00
Alexander Potapenko 720aaefb8d Move the non-trivial implementation of AsanShadowRangeIsAvailable to asan_mac.cc
to avoid crashes on Linux and Win.

llvm-svn: 150398
2012-02-13 17:09:40 +00:00
Alexander Potapenko ef4521e239 Check whether the shadow memory range intersects with an existing mapping.
This should help to detect problems with ASLR or linker tricks early.

llvm-svn: 150391
2012-02-13 15:11:23 +00:00
Alexey Samsonov ea308d876b AddressSanitizer: re-enable lint for output tests
llvm-svn: 150386
2012-02-13 14:18:36 +00:00
Alexey Samsonov 54671b63be AddressSanitizer: fix llvm headers in output tests
llvm-svn: 150385
2012-02-13 14:05:07 +00:00
Alexey Samsonov 633c8be0ae AddressSanitizer: remove match_output.py, split expected output into OS-specific and OS-independent parts
llvm-svn: 150384
2012-02-13 13:59:24 +00:00
Evgeniy Stepanov c5d845dc09 [asan] Add a missing include.
llvm-svn: 150382
2012-02-13 12:37:56 +00:00
Evgeniy Stepanov 450c123218 [asan] Add a missing return.
It is technically reachable on Android, where pthread_exit is not
marked noreturn.

llvm-svn: 150381
2012-02-13 12:36:44 +00:00
Alexey Samsonov 92a0b806a6 AddressSanitizer: Convert templates for output tests to FileCheck format and move them inside sources
llvm-svn: 150375
2012-02-13 12:21:58 +00:00
Evgeniy Stepanov b25d0d2318 [asan] Return type of index() is char*.
This is important for Android, where we can't keep system headers
from leaking into asan_interceptors.cc.

llvm-svn: 150374
2012-02-13 12:12:32 +00:00
Evgeniy Stepanov da7522b551 [asan] Disable signal&sigaction interceptors on Android.
llvm-svn: 150373
2012-02-13 12:04:36 +00:00
Evgeniy Stepanov 45fd36110b [asan] Default visibility for __asan_handle_no_return.
llvm-svn: 150372
2012-02-13 11:55:24 +00:00
Evgeniy Stepanov 56ae29f92d [asan] Fix a crash in GetCurrent() of an undead thread.
llvm-svn: 150371
2012-02-13 11:53:24 +00:00
Alexey Samsonov 6e6083f4b1 AddressSanitizer: fix path to FileCheck in makefiles
llvm-svn: 150368
2012-02-13 09:14:31 +00:00
Alexey Samsonov b30df37ebf AddressSanitizer: move output tests to a separate directory
llvm-svn: 150367
2012-02-13 08:50:21 +00:00
Alexey Samsonov f9affd3a0c AddressSanitizer: Use FileCheck instead of grep for pure C output tests
llvm-svn: 150366
2012-02-13 08:27:10 +00:00
Bob Wilson e67004e2f1 Back out some changes that accidentally committed.
llvm-svn: 150254
2012-02-10 16:41:46 +00:00
Bob Wilson ddd971564e Revert r150232 since it breaks the build when there's no ARM assembler.
llvm-svn: 150253
2012-02-10 16:36:49 +00:00
Timur Iskhodzhanov 7ce3e5bb8e [asan] The first version of the RTL for Windows, reviewed at http://codereview.appspot.com/5647052
llvm-svn: 150185
2012-02-09 17:20:14 +00:00
Timur Iskhodzhanov bc9bb3f581 Test commit + fix an obvious typo
llvm-svn: 150184
2012-02-09 16:29:41 +00:00
Alexey Samsonov 9654367cbc AddressSanitizer: move mach_override inside interception library
llvm-svn: 150171
2012-02-09 11:36:12 +00:00
Kostya Serebryany 0394da7bea [asan] unpoison the stack before every noreturn call. Fixes asan issue 37. rt part
llvm-svn: 150101
2012-02-08 21:33:27 +00:00
Alexey Samsonov 8489f2a564 AddressSanitizer: start factoring out interception machinery
llvm-svn: 150083
2012-02-08 19:52:01 +00:00
Alexander Potapenko 1da11ec357 Move the _ReturnAddress definition out of the __asan:: namespace
Patch by Timur Iskhodzhanov (timurrrr@google.com)

llvm-svn: 150075
2012-02-08 14:14:18 +00:00
Alexey Samsonov e725478e2f AddressSanitizer: replace all "real_X" calls with "REAL(X)"
llvm-svn: 150073
2012-02-08 13:45:31 +00:00
Alexander Potapenko 42cdb7e640 Typo fix: s/SNPrint/SNPrintf
llvm-svn: 150069
2012-02-08 11:45:09 +00:00
Kostya Serebryany 9716914b2d [asan] better warning messages for double-free bugs (provide allocation/deallocation stack traces)
llvm-svn: 150027
2012-02-08 00:42:29 +00:00
Kostya Serebryany f98fc08bc7 [asan] GET_CALLER_PC macro for Win. Patch by timurrrr@google.com
llvm-svn: 149994
2012-02-07 18:23:54 +00:00
Kostya Serebryany d61255638f [asan] print 'ALL TESTS PASSED' in makefile when running tests (convenience)
llvm-svn: 149990
2012-02-07 17:36:07 +00:00
Kostya Serebryany 614b53de1b [asan] don't crash if /proc/self/maps has enormous size (linux)
llvm-svn: 149944
2012-02-07 00:47:35 +00:00
Kostya Serebryany b5eb5a7a05 [asan] make sure the AsanThread object is destroyed if pthread_exit is called
llvm-svn: 149940
2012-02-07 00:27:15 +00:00
Kostya Serebryany 546ba363ea [asan] use raw syscalls for open/close on linux to avoid being intercepted
llvm-svn: 149892
2012-02-06 19:23:38 +00:00
Kostya Serebryany 9ff28d661d [asan] The first version of Windows malloc interceptors, patch by timurrrr@google.com
llvm-svn: 149875
2012-02-06 17:56:38 +00:00
Nick Kledzik 686f0d17a6 On Apple platforms, wire up compilerrt_abort() to log file and function info
llvm-svn: 149723
2012-02-03 23:53:40 +00:00
Nick Kledzik a2b846c000 Remove __attribute__((weak)) on function prototype. It has a different meaning on prototypes then it does on definitions. It is not needed on the prototype and causes build failures for static codegen
llvm-svn: 149720
2012-02-03 23:10:55 +00:00
Alexey Samsonov f9fef3d275 AddressSanitizer: simplify RoundUpToPowerOfTwo/clz; add a couple of CHECKs for real_X calls. Patch by timurrrr@google.com
llvm-svn: 149687
2012-02-03 08:50:16 +00:00
Alexey Samsonov 23e3b90319 AddressSanitizer: Replace __attribute__ with macro (for Win compatibility). Patch by timurrrr@google.com
llvm-svn: 149686
2012-02-03 08:37:19 +00:00
Alexey Samsonov 15965f9c3d AddressSanitizer: Add macro for definition/declaration of interceptors
llvm-svn: 149602
2012-02-02 10:39:40 +00:00
Alexander Potapenko c97434ecaf Disable wrapping memcpy() on Mac OS Lion, where it
actually falls back to memmove.
In this case we still need to initialize real_memcpy, so we set it to
real_memmove
We check for MACOS_VERSION_SNOW_LEOPARD, because currently only Snow
Leopard and Lion are supported.

llvm-svn: 149492
2012-02-01 10:07:52 +00:00
Alexander Potapenko f504602a0f Disables testing memcpy() on Mac OS 10.7,
where memcpy() in fact aliases memmove() and thus calling it with
overlapping parameters is not an error.

llvm-svn: 149491
2012-02-01 09:47:40 +00:00
Kostya Serebryany 9160b5059b [asan] fix the wrong __WORDSIZE definition on Win x64, add ASAN_INTERFACE_FUNCTION_ATTRIBUTE. Patch by timurrrr@google.com
llvm-svn: 149395
2012-01-31 18:13:50 +00:00
Kostya Serebryany 7e7d0ca1a2 [asan] remove dead code
llvm-svn: 149392
2012-01-31 17:29:02 +00:00
Alexander Potapenko 81203bdb33 Implement GetMacosVersion() to obtain the OS X version at runtime.
llvm-svn: 149382
2012-01-31 13:19:18 +00:00
Kostya Serebryany ad1fccdb1c [asan] tests should not require the asan-rt to be built with debug info
llvm-svn: 149330
2012-01-31 01:56:58 +00:00
Kostya Serebryany bca91defcb [asan] new run-time flag: sleep_before_dying (asan Issue #31)
llvm-svn: 149306
2012-01-31 00:52:18 +00:00
Kostya Serebryany 9aca3b0d2f [asan] re-enable the test for ObjC initialization bug
llvm-svn: 149302
2012-01-30 23:55:46 +00:00
Kostya Serebryany 39ba3f724f [asan] fix issue 35: don't let the optimizer to optimize the test code away.
llvm-svn: 149296
2012-01-30 23:23:26 +00:00
Kostya Serebryany fed83c5755 [asan] ifdef/include cleanup
llvm-svn: 149281
2012-01-30 22:11:04 +00:00
Kostya Serebryany cf2c65aa8e [asan] add a test for __attribute__ no_address_safety_analysis
llvm-svn: 149278
2012-01-30 21:34:59 +00:00
Kostya Serebryany 510850c345 [asan] minor ifdef cleanup
llvm-svn: 149274
2012-01-30 20:55:02 +00:00
Alexey Samsonov 2dcef2d2a8 AddressSanitizer: Enforce default visibility for all libc interceptors
llvm-svn: 149247
2012-01-30 13:42:44 +00:00
Alexander Potapenko 81ebb0aafb Add a mask for "cmpb $imm, (%rdi)" on x86_64
llvm-svn: 149245
2012-01-30 12:49:00 +00:00
Anton Korobeynikov 28037ceacf Proper divmod implementation
llvm-svn: 149242
2012-01-30 10:21:51 +00:00
Anton Korobeynikov b047b04c4c Provide aeabi_mem* functions.
llvm-svn: 149241
2012-01-30 10:21:23 +00:00
Alexander Potapenko f519564d7c Make compiler-rt/trunk/lib/asan compileable with Visual Studio 2008 on Windows.
Patch by Timur Iskhodzhanov (timurrrr@google.com)

To test:
$ cl /c *.c*
in the asan directory.

The code fails to link if you omit the "/c" part but that's one of the
next steps,
as well as a few TODO's I've put into the Windows-specific code.

llvm-svn: 149130
2012-01-27 15:15:04 +00:00
Alexander Potapenko 13d95d5e5a Make compiler-rt/trunk/lib/asan compileable with g++.
Patch by Timur Iskhodzhanov (timurrrr@google.com)

The double-extern thing is
http://llvm.org/bugs/show_bug.cgi?id=11869

And the #include <string[s].h> are only needed on Mac (see comments in
the original code)
and also including them might make strchr/index conflict with the g++
system headers (which don't follow the man pages, ouch!)

llvm-svn: 149129
2012-01-27 10:52:37 +00:00
Alexander Potapenko fabfcd8bea Darwin-specific templates for the output tests.
These should fix the output tests on Mac.

llvm-svn: 149068
2012-01-26 17:40:18 +00:00
Alexander Potapenko 02a71626e3 More accurate atos execution which depends on the file type (EXECUTE, DYLIB) of the binary.
More Linux-like output on Mac (to match more output tests).

llvm-svn: 149064
2012-01-26 17:06:50 +00:00
Alexander Potapenko 98f0c713d9 Fix a bug in AsanProcMaps on Mac: on 64 bits the program was trying to read twice as many segment load commands as the binary actually contained.
llvm-svn: 149063
2012-01-26 17:01:20 +00:00
Alexander Potapenko 1f397fb87f Tune asan_symbolize.py to symbolize 64-bit binaries correctly.
Add the DEBUG flag to test_output.sh

llvm-svn: 148798
2012-01-24 10:44:44 +00:00
Kostya Serebryany 586ade114b [asan] use internal_strcmp before asan_init is done. *may* fix asan issue #30
llvm-svn: 148726
2012-01-23 21:20:05 +00:00
Kostya Serebryany f9418f9679 [asan] test that -fno-optimize-sibling-calls helps to get sane stack traces
llvm-svn: 148714
2012-01-23 18:44:34 +00:00
Alexander Potapenko 046ecc06be Wrap CFStringCreateCopy to prevent copying constant CF strings.
This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=10

llvm-svn: 148696
2012-01-23 10:09:54 +00:00
Alexander Potapenko f9392011c8 Add a test for CFStringCreateCopy.
Normally this function should not create copies of constant strings, but it does when the default CFAllocator
is replaced (e.g. under AddressSanitizer)

This test is related to http://code.google.com/p/address-sanitizer/issues/detail?id=10

llvm-svn: 148695
2012-01-23 10:06:14 +00:00
Evgeniy Stepanov 3f6840745c Make the Android TSD workaround more reliable.
By scanning the thread list backwards.

llvm-svn: 148476
2012-01-19 13:57:45 +00:00
Evgeniy Stepanov d296ad4e16 Workaround the self-cleaning TSD on Android.
llvm-svn: 148475
2012-01-19 13:37:31 +00:00
Alexander Potapenko 62b0d70e56 Remove a debugging Report() call.
llvm-svn: 148474
2012-01-19 13:34:15 +00:00
Alexander Potapenko 3825e9770b Minor fixes of the AsanProcMaps code on Mac:
-- make the load command scan linear (instead of quadratic)
 -- do not create a nested AsanProcMaps instance for each address lookup
 -- more comments

llvm-svn: 148472
2012-01-19 12:44:06 +00:00
Evgeniy Stepanov 84c44a8b8b EHABI-based stack trace on ARM.
The change removes the unused FLAG_fast_unwind, and forces EHABI-based unwind
on ARM, and fast (FP-based) unwind everywhere else.

llvm-svn: 148468
2012-01-19 11:34:18 +00:00
Alexey Samsonov 0ac73fc9f8 AddressSanitizer: return false instead of true for __asan_get_ownership(NULL)
llvm-svn: 148394
2012-01-18 15:26:55 +00:00
Alexander Potapenko 38da9a04f5 Delete sysinfo/* and all references to it.
llvm-svn: 148386
2012-01-18 11:42:30 +00:00
Alexander Potapenko 4257386879 Implement AsanProcMaps for Mac OS. The code from sysinfo/ is not needed anymore and should be cleaned up.
llvm-svn: 148385
2012-01-18 11:16:05 +00:00
Kostya Serebryany 5767f0f113 [asan] workaround for bug http://llvm.org/bugs/show_bug.cgi?id=11763. Do not bark on memcpy(a, a, size).
llvm-svn: 148318
2012-01-17 18:43:52 +00:00
Kostya Serebryany 86d4492627 [asan] fix ReadFileToBuffer to correctly handle files from /proc/ (asan issue 27)
llvm-svn: 148311
2012-01-17 18:00:07 +00:00
Alexey Samsonov 67d508d083 Revert commit 148304
llvm-svn: 148305
2012-01-17 14:01:15 +00:00
Alexey Samsonov 1e310295d0 AddressSanitizer: from this patch, ASan allocator returns false for __asan_get_ownership(NULL) and produce error reports for malloc_usable_size(NULL) and __asan_get_allocated_size(NULL)
llvm-svn: 148304
2012-01-17 13:31:54 +00:00
Alexander Potapenko 2b2e0721d7 Define the bounds of the branch allocator memory space for 32-bit apps.
llvm-svn: 148303
2012-01-17 09:38:54 +00:00
Alexey Samsonov 209c514a1d AddressSanitizer: add support for malloc_usable_size() function
llvm-svn: 148287
2012-01-17 06:39:10 +00:00
Alexey Samsonov 2d3a67b73b AddressSanitizer: create AsanThreadSummary together with AsanThread (in parent thread)
llvm-svn: 148286
2012-01-17 06:35:31 +00:00
Evgeniy Stepanov 1b65b17bf5 [asan] Implement GetObjectNameAndOffset on ARM.
llvm-svn: 148236
2012-01-16 12:45:07 +00:00
Alexey Samsonov 50bf956f29 AddressSanitizer: fix recently introduced lint errors and broken test on Mac.
llvm-svn: 148235
2012-01-16 12:38:09 +00:00
Evgeniy Stepanov 2227207c83 Disable posix_memalign test on Android.
llvm-svn: 148234
2012-01-16 12:19:51 +00:00
Alexander Potapenko bd53f597de This patch adds two methods, __asan_allocate_island and __asan_deallocate_island
and switches our interceptors to using them instead of the default
vm_allocate-based approach used by mach_override_ptr.

To simplify the code, a fixed memory mapping is used for the allocation pool --
note that we can't mmap an arbitrary chunk of memory, because the shadow memory hasn't been mapped yet
(for the reasons discussed in http://code.google.com/p/address-sanitizer/issues/detail?id=24, we cannot map the shadow earlier)

The patch drops the program startup time from several second to half a second,
which speeds up the execution of ASan tests noticeably.
Because of the virtual memory size occupied by the programs it's hard
to speed up the shutdown time, which would've also helped the tests.

llvm-svn: 148116
2012-01-13 16:13:58 +00:00
Alexander Potapenko 9301db4baa Add __asan_mach_override_ptr_custom, which allows to inject a custom memory allocator into mach_override_ptr().
llvm-svn: 148115
2012-01-13 15:31:37 +00:00
Alexander Potapenko 553c208d22 This patch moves the code reading /proc/self/environ into AsanGetEnv
in asan_linux.cc, because /proc is unavailable on Mac.
Instead the Mac version of AsanGetEnv iterates over the array of
environment variables obtained from _NSGetEnviron()

llvm-svn: 148114
2012-01-13 12:59:48 +00:00
Anton Korobeynikov 48cfd55c5d Add some basic mingw support.
Patch by Ruben Van Boxem! 

llvm-svn: 148048
2012-01-12 21:13:48 +00:00
Evgeniy Stepanov 837fe5bcc9 Call asan_init from .preinit_array.
Protected by an #ifdef, disabled by default.

llvm-svn: 147932
2012-01-11 08:17:19 +00:00
Alexey Samsonov 5d5fa5115a Test commit. Minor cleanup in AsanThread
llvm-svn: 147930
2012-01-11 08:07:51 +00:00
Kostya Serebryany 41cdb8614c [asan] remove OS-dependent headers from asan_internal.h
llvm-svn: 147919
2012-01-11 02:39:16 +00:00
Kostya Serebryany 0c8fa7b8ed [asan] remove OS-dependent includes from asan_interceptors.h
llvm-svn: 147916
2012-01-11 02:32:40 +00:00
Kostya Serebryany 1dd51b53b2 [asan] move TSD code into asan_posix.cc
llvm-svn: 147913
2012-01-11 02:21:06 +00:00
Kostya Serebryany 332923be32 [asan] get rid of the scary TSD destructor code. Now, we store the leaky AsanThreadSummary in TSD and never remove it from there.
llvm-svn: 147910
2012-01-11 02:03:16 +00:00
Kostya Serebryany 258d7b4182 [asan] hopefully fix the build on MacOS 10.6 (the code did work on 10.7, where I tested it)
llvm-svn: 147896
2012-01-10 23:36:59 +00:00
Kostya Serebryany a82f0d4950 [asan] move OS-dependent code away from asan_lock.h
llvm-svn: 147878
2012-01-10 21:24:40 +00:00
Kostya Serebryany edb4a8a128 [asan] don't include unistd.h in the headers
llvm-svn: 147811
2012-01-09 23:11:26 +00:00
Kostya Serebryany 3a55cfacf1 [asan] temporary reinstate string.h/strings.h. Removal of those caused a Mac build failulre which I failed to observe before the commit
llvm-svn: 147810
2012-01-09 22:45:05 +00:00
Kostya Serebryany d9cb2f13b3 [asan] don't include string.h and strings.h
llvm-svn: 147809
2012-01-09 22:36:51 +00:00
Kostya Serebryany 65518014e2 [asan] don't use strstr/strncat from libc, use our own versions instead
llvm-svn: 147807
2012-01-09 22:20:49 +00:00
Kostya Serebryany 3ab81d1f26 [asan] fix mac build once more
llvm-svn: 147796
2012-01-09 19:50:06 +00:00
Kostya Serebryany 3e559e87a4 [asan]: fix typo from previous commit
llvm-svn: 147793
2012-01-09 19:41:15 +00:00
Kostya Serebryany ba41e8d2c5 [asan]: fix mac build
llvm-svn: 147792
2012-01-09 19:35:11 +00:00
Kostya Serebryany 5be458ccfd [asan] refactoring: move some common linux/mac code to asan_posix.cc
llvm-svn: 147788
2012-01-09 19:18:27 +00:00
Kostya Serebryany 9fd01e5ea5 [asan] refactoring: move all interceptors to a single file
llvm-svn: 147784
2012-01-09 18:53:15 +00:00
Kostya Serebryany 3f4b9bb4a0 [asan] do not use new/delete for the internal thread structure
llvm-svn: 147674
2012-01-06 19:44:11 +00:00
Kostya Serebryany 25d6c1b3c3 [asan] move more code into OS-specific files
llvm-svn: 147671
2012-01-06 19:11:09 +00:00
Kostya Serebryany adebf0caf5 [asan] cleanup: remove the SIGILL-related code (rt part)
llvm-svn: 147665
2012-01-06 18:02:04 +00:00
Kostya Serebryany 2b08718bba [asan] move more stuff to OS-specific files
llvm-svn: 147647
2012-01-06 02:12:25 +00:00
Rafael Espindola a0fbaeebe6 Fix build on minix. Patch by Ben Gras!
llvm-svn: 147632
2012-01-05 23:59:42 +00:00
Kostya Serebryany 3b7fb102c4 [asan] use dl_iterate_phdr for pre-symbolization on linux instead of parsing /proc/self/maps
llvm-svn: 147628
2012-01-05 23:50:34 +00:00
Kostya Serebryany 78d87d3b4b [asan] move {linux,mac}-specific code from asan_thread.cc to asan_{linux,mac}.cc; also add asan_procmaps.h which I forgot to add on previous commit.
llvm-svn: 147586
2012-01-05 01:07:27 +00:00
Kostya Serebryany cd271f5440 [asan] implement our own /proc/self/maps reader and use it on linux instead of sysinfo.h
llvm-svn: 147581
2012-01-05 00:44:33 +00:00
Kostya Serebryany cc1d7893d6 [asan] remove objdump-based tests in favour of much simpler LLVM-ish tests
llvm-svn: 147514
2012-01-04 02:08:46 +00:00
Bob Wilson bf9a62dcad Fix missing include of int_lib.h and ppc ifdef for FreeBSD.
Patch provided by Ed Schouten!

llvm-svn: 147458
2012-01-03 18:59:25 +00:00
Kostya Serebryany 10a6b304e1 [asan] build asan-rt with -funwind-tables
llvm-svn: 147341
2011-12-29 17:29:20 +00:00
Kostya Serebryany d2d043be45 [asan] force the __asan_unregister_globals to reside in the runtime library
llvm-svn: 147329
2011-12-28 23:35:46 +00:00
Kostya Serebryany a772096156 [asan] refactoring: don't #include <sys/mman.h> in non-os-specific files
llvm-svn: 147328
2011-12-28 23:28:54 +00:00
Kostya Serebryany 6c4bd806fa [asan] use custom libc-free getenv; a bit of refactoring around mmap calls
llvm-svn: 147326
2011-12-28 22:58:01 +00:00
Kostya Serebryany 5bdf7dcb2d [asan] missing PTHREAD_DESTRUCTOR_ITERATIONS on Android. patch by eugeni.stepanov@gmail.com
llvm-svn: 147322
2011-12-28 20:47:21 +00:00
Kostya Serebryany bab78de8a3 [asan] discover main thread stack limits without pthread. patch by eugeni.stepanov@gmail.com
llvm-svn: 147321
2011-12-28 20:34:30 +00:00
Kostya Serebryany 2b87e403c4 [asan] no ucontext on Android. patch by eugeni.stepanov@gmail.com
llvm-svn: 147320
2011-12-28 20:22:21 +00:00
Kostya Serebryany 76eca5e53a [asan] enable memset/memcpy/memmove interceptors in asan-rt (in addition to those in the compiler module)
llvm-svn: 147319
2011-12-28 19:55:30 +00:00
Kostya Serebryany e4a84c4f1f [asan] better message for parameter overlap bugs
llvm-svn: 147317
2011-12-28 19:24:31 +00:00
Kostya Serebryany 50bc2a71b2 [asan] interceptor for strcat. Patch by samsonov@google.com
llvm-svn: 147316
2011-12-28 19:08:49 +00:00
Kostya Serebryany 6579e355c0 [asan] interceptor for memcmp. Patch by samsonov@google.com
llvm-svn: 147315
2011-12-28 18:56:42 +00:00
Kostya Serebryany 809632e28e [asan] interceptors for strcasecmp and strncasecmp. patch by samsonov@google.com
llvm-svn: 147304
2011-12-28 02:24:50 +00:00
Kostya Serebryany 8b981c2564 The code instrumented with ASan may have its own instance of the
mach_override library.
In this case chances are that functions from it will be called from
mach_override_ptr() during ASan initialization.
This may lead to crashes (if those functions are instrumented) or
incorrect behavior (if the implementations differ).

The attached patch renames mach_override_ptr() into
__asan_mach_override_ptr() and makes the rest of the mach_override
internals hidden.
The corresponding AddressSanitizer bug is
http://code.google.com/p/address-sanitizer/issues/detail?id=22

Patch by glider@google.com

llvm-svn: 147303
2011-12-28 01:08:14 +00:00
Kostya Serebryany 46c70d33d7 [asan] make sure __asan_report_* functions are not inlined (so that they are not optimized away and are kept in the resulting library). Patch by glider@google.com
llvm-svn: 147302
2011-12-28 00:59:39 +00:00
Kostya Serebryany 5469986da0 [asan] remove the test for cfree. 'man cfree' says: 'This function should never be used.' and this function is not found on many OSes we support.
llvm-svn: 147301
2011-12-27 23:42:55 +00:00
Kostya Serebryany dd1386f882 new() has slightly different signature on Android. This patch adds the
llvm-svn: 147300
2011-12-27 23:11:09 +00:00
Kostya Serebryany db32f967b9 [asan] rely on __has_feature(address_sanitizer) instead of the ADDRESS_SANITIZER macro
llvm-svn: 147297
2011-12-27 21:57:12 +00:00
Kostya Serebryany 1b82c281f3 [asan] make sure frame pointers are not omitted when running asan output tests
llvm-svn: 147293
2011-12-27 19:52:54 +00:00
Kostya Serebryany 6bb2f1d5b5 Recently the GCD tests started failing because of the invalid size of
FakeStack on the worker threads.
This patch moves the AsanThread initialization into a separate
procedure that's called when AsanThread objects are called for worker
threads.
Patch by glider@google.com

llvm-svn: 146752
2011-12-16 19:13:35 +00:00
Kostya Serebryany 6d37656c1a [asan] revert r146529: we do need to build asan-rt as a shared library. Will need to find a different way to modify preinit_array
llvm-svn: 146703
2011-12-15 23:08:00 +00:00
Kostya Serebryany 7ce9686921 [asan] added a test to check that a global-buffer-overflow mentioned the module name; revert incorrect change in the test runner
llvm-svn: 146701
2011-12-15 22:57:32 +00:00
Kostya Serebryany 9366d42e91 [asan] fix a bug (issue 19) where dlclose and the following mmap caused a false positive. run-time part.
llvm-svn: 146687
2011-12-15 21:55:34 +00:00
Kostya Serebryany e8a7d2aef8 [asan] regression test for asan issue 19, currently fails.
llvm-svn: 146681
2011-12-15 20:38:14 +00:00
Kostya Serebryany 7fb33a3d40 [asan] poison the internal asan heap memory, just in case. Change Printf to Report when debugging globals.
llvm-svn: 146663
2011-12-15 17:41:30 +00:00
Kostya Serebryany 9bd5208965 [asan] insert __asan_init into ".preinit_array" section. Linux-only.
llvm-svn: 146529
2011-12-14 00:19:03 +00:00
Kostya Serebryany e85da73553 [asan] fix the test runner to detect build breakages; add a test for -pie
llvm-svn: 146528
2011-12-14 00:05:22 +00:00
Kostya Serebryany 1d337a5e06 [asan] fix some more format warnings in sysinfo/sysinfo.cc
llvm-svn: 146526
2011-12-13 23:34:59 +00:00
Kostya Serebryany d47a91ad2a [asan] canonicalise the output for double-free and wrong-free. fixes asan issue 18
llvm-svn: 146501
2011-12-13 19:16:36 +00:00
Kostya Serebryany 0698b852ed [asan] fix asan-rt interceptors on Snow Leopard. Patch by glider@google.com
llvm-svn: 146263
2011-12-09 18:18:54 +00:00
Kostya Serebryany 72fde3727e [asan] make use-after-return mode more robust: allow to call instrumented functions while reporting an error
llvm-svn: 146231
2011-12-09 01:49:31 +00:00
Kostya Serebryany 7487a0ae1f [asan] fix output test to not require debug symbols in asan run-time
llvm-svn: 146212
2011-12-09 00:18:21 +00:00
Kostya Serebryany 7c01c1af19 [asan] better test for use-after-return mode
llvm-svn: 146203
2011-12-08 23:30:48 +00:00
Kostya Serebryany 9b5673cf5a [asan] fresh version of mach_override; added mach_override/README.txt. Patch by glider@google.com
llvm-svn: 146166
2011-12-08 19:14:07 +00:00
Kostya Serebryany 9752158954 [asan] update the soon-to-be-depricated asan makefile to use the new path for asan-rt (affects only linux)
llvm-svn: 146162
2011-12-08 18:46:33 +00:00
Kostya Serebryany b50a539eba [asan] move build-time config options from makefile to source (otherwise we need config options in all makefiles)
llvm-svn: 146161
2011-12-08 18:30:42 +00:00
Kostya Serebryany f0d799a6bc [asan] fix the error message for 16-byte accesses (it previously printed 'unknown-crash')
llvm-svn: 146075
2011-12-07 21:30:20 +00:00
Kostya Serebryany ca207f0473 [asan] minor cleanup
llvm-svn: 145966
2011-12-06 21:10:15 +00:00
Kostya Serebryany 8b815e1a08 [asan] GCD tests on Mac: prevent optimization and enable. Patch by glider@google.com
llvm-svn: 145953
2011-12-06 19:10:48 +00:00
Kostya Serebryany 8b277533b6 [asan] remove format warnings in sysinfo/sysinfo.cc
llvm-svn: 145886
2011-12-06 01:08:31 +00:00
Kostya Serebryany ab7940f6e1 [asan]: test a pure C file with -faddress-sanitizer; lint fixes
llvm-svn: 145848
2011-12-05 20:44:30 +00:00
Kostya Serebryany 0e069e2aa9 [asan] add the test for bug 11468
llvm-svn: 145839
2011-12-05 19:20:57 +00:00
Kostya Serebryany 49a182fa12 [asan] always collect malloc statstics (removed FLAG_stats)
llvm-svn: 145838
2011-12-05 19:17:53 +00:00
Kostya Serebryany 92ebcadfe4 [asan] cleanup memset/memmove/memcpy interceptors and enable them on Mac. Patch by samsonov@google.com
llvm-svn: 145826
2011-12-05 18:56:29 +00:00
Kostya Serebryany 93927f9e01 [asan] don't require __cxa_throw to be present in the process. This is the last dependency on libstdc++
llvm-svn: 145821
2011-12-05 17:56:32 +00:00
Kostya Serebryany 551a1739b8 [asan] get rid of some more dependency on libstdc++
llvm-svn: 145743
2011-12-03 02:23:25 +00:00
Kostya Serebryany 26c5df4733 [asan] micro-benchmark for use-after-return fake stack
llvm-svn: 145739
2011-12-03 01:44:48 +00:00
Kostya Serebryany b89f2a6e78 [asan] put back -O2 which was lost quite some time ago and caused noticeable perf drop in malloc-intensive apps. doh.
llvm-svn: 145723
2011-12-02 23:04:12 +00:00
Kostya Serebryany e4bada2c94 [asan] get rid of std::map. No STL and almost no libstdc++ left.
llvm-svn: 145706
2011-12-02 21:02:20 +00:00
Kostya Serebryany c5be44aaa2 [asan] quick fix for mac build, second attempt. Sorry for spam.
llvm-svn: 145694
2011-12-02 18:52:35 +00:00
Kostya Serebryany 196cd6af90 [asan] quick fix for mac build
llvm-svn: 145692
2011-12-02 18:48:20 +00:00
Kostya Serebryany 2d27cdf621 [asan] minimize the use of STL. One bit is still left.
llvm-svn: 145691
2011-12-02 18:42:04 +00:00
Daniel Dunbar 2003d39f7c build: Add ModuleName per-subdir variable as a way to organize the different
sets of functions/objects into high level groups. Currently we have "builtins"
(the main compiler-rt code), "profile", and "asan".
 - Use this to define CommonFunctions and ArchFunctions to only reference the
   builtins functions.

llvm-svn: 145674
2011-12-02 02:42:07 +00:00
Daniel Dunbar 4e3a11ba57 lib/asan: Fix possible type mismatches.
llvm-svn: 145664
2011-12-02 01:36:38 +00:00
Daniel Dunbar 9c665e36d4 lib/asan: Attempt to ensure __WORDSIZE gets defined, it is not always set by
Darwin's stdint.h for example.

llvm-svn: 145663
2011-12-02 01:32:27 +00:00
Kostya Serebryany 70e163b507 add/update LICENSE.TXT files for the third_party code used by asan
llvm-svn: 145659
2011-12-02 01:12:36 +00:00
Daniel Dunbar cf7fb02388 build/asan: Better fix for ASAN i386 build on Darwin, this causes us to see the
non-standard struct names.

llvm-svn: 145658
2011-12-02 00:52:55 +00:00
Daniel Dunbar 8a5fd211ab build/asan: Fix ASAN build for i386, for reasons I don't really understand we
get the DARWIN_UNIX03 definition on x86_64 but not on i386.

llvm-svn: 145657
2011-12-02 00:45:48 +00:00
Daniel Dunbar 12024d00a7 asan: Fill in integration with compiler-rt/make build.
llvm-svn: 145648
2011-12-01 23:35:56 +00:00
Daniel Dunbar 5dc7770bf7 asan: Suppress a -Wbitwise-op-parentheses.
llvm-svn: 145647
2011-12-01 23:35:51 +00:00
Daniel Dunbar fc4a4a3cbc asan: #if 0 out some unused functions (we build with -Werror).
llvm-svn: 145645
2011-12-01 23:35:47 +00:00
Kostya Serebryany 5dfa4da0b9 [asan] flatten the asan-rt build slightly
llvm-svn: 145631
2011-12-01 21:40:52 +00:00
Kostya Serebryany f318e29102 test asan at -O0
llvm-svn: 145532
2011-11-30 22:27:30 +00:00
Kostya Serebryany 15dd3f2500 Refactor shadow poisoning done by asan-rt, no funtionality changes; patch by samsonov@google.com
llvm-svn: 145505
2011-11-30 18:50:23 +00:00
Kostya Serebryany 9d1eee9e2a fix asan-rt build on Mac. Patch by glider@google.com
llvm-svn: 145496
2011-11-30 17:33:13 +00:00
Kostya Serebryany 019b76f5fd AddressSanitizer run-time library. Not yet integrated with the compiler-rt build system, but can be built using the old makefile. See details in README.txt
llvm-svn: 145463
2011-11-30 01:07:02 +00:00
Daniel Dunbar e2ed5fb636 lib/int_util: My refactoring to allow shared utility code had a fatal flaw when
multiple .a files would end up with duplicate strong definitions. This could
cause link failures in certain scenarios when both definitions got loaded.
 - The best solution I see for this (aside from not factoring out the utility
   code) is to mark the definitions weak. Better solutions appreciated!

llvm-svn: 145427
2011-11-29 19:44:14 +00:00
Daniel Dunbar fb16114782 lib: Import GCDA profiling support from LLVM.
- I'm in the process of moving this here but it will live in both places until
   the ancilliary support is ready.
 - Currently unused.

llvm-svn: 144865
2011-11-17 00:12:10 +00:00
Daniel Dunbar 82f9c199e8 lib/int_math: Some versions of GCC don't provide __builtin_isfinite. Support
them.

llvm-svn: 144810
2011-11-16 18:56:55 +00:00
Daniel Dunbar 960d55e9ff lib/ppc: Fix a refacto.
llvm-svn: 144809
2011-11-16 18:56:53 +00:00
Daniel Dunbar 2139c52d33 lib: Finish int_math.h definitions using compiler builtins and eliminate
implementation use of <math.h>.

llvm-svn: 144786
2011-11-16 07:33:06 +00:00
Daniel Dunbar ddf1890a5e lib: Starting thinning out the dependency on math.h by using compiler builtins
where available.

llvm-svn: 144785
2011-11-16 07:33:00 +00:00
Daniel Dunbar b151274d3d lib: Remove uses of complex.h which does not appear to be required.
llvm-svn: 144754
2011-11-16 01:19:32 +00:00
Daniel Dunbar 490a270f18 lib/gcc_personality_v0: Remove an unnecessary include.
llvm-svn: 144753
2011-11-16 01:19:29 +00:00
Daniel Dunbar 5ed39314ce lib: Eliminate direct include of stdlib.h from files that used to (potentially)
need it for compilerrt_abort().

llvm-svn: 144752
2011-11-16 01:19:26 +00:00
Daniel Dunbar 2b88e03404 lib: Add support for library wide utility functions, and make compilerrt_abort()
a real boy.
 - The utility module needs to be included into every produced library, because
   we don't have enough dependency tracking to know exactly which other modules
   might require the utilities.

llvm-svn: 144751
2011-11-16 01:19:19 +00:00
Daniel Dunbar 2f9c1404dd lib/{ppc,x86_64}: Fixup a number of files to include int_lib.h instead of
directly including system headers.

llvm-svn: 144750
2011-11-16 01:19:16 +00:00
Daniel Dunbar 7557f0248a lib: Remove math.h from int_lib.h, which doesn't appear to be required.
llvm-svn: 144749
2011-11-16 01:19:12 +00:00
Daniel Dunbar 7205b23e79 lib: Include float.h in int_lib.h, and eliminate duplicate includes from a number of source files.
llvm-svn: 144739
2011-11-16 00:20:36 +00:00
Daniel Dunbar fd1fb8515f lib: Include stdbool.h in int_lib.h, and eliminate duplicate includes from a number of source files.
llvm-svn: 144671
2011-11-15 19:02:22 +00:00
Daniel Dunbar cc675f410e lib: Rename endianness.h to int_endianness.h (for consistency) and tidy up a bit.
llvm-svn: 144669
2011-11-15 18:56:21 +00:00
Daniel Dunbar ad4f982879 lib: Split out int_types.h, for readability.
llvm-svn: 144668
2011-11-15 18:56:13 +00:00
Daniel Dunbar b6f75f73fd lib: Integrate abi.h into int_lib.h, there aren't good enough reasons for this extra complexity.
llvm-svn: 144660
2011-11-15 18:34:44 +00:00
Bob Wilson 7184d9fc33 Change ARM vfp assembly functions to use unified syntax.
llvm-svn: 138332
2011-08-23 16:40:18 +00:00
Bob Wilson 66cdd22ff4 Refactor DEFINE_COMPILERRT_FUNCTION.
llvm-svn: 138277
2011-08-22 21:49:47 +00:00
Joerg Sonnenberger 8b068943a4 Don't redeclare sr.
llvm-svn: 136424
2011-07-28 23:15:41 +00:00
Joerg Sonnenberger cf2996dc22 Don't redeclare sr.
llvm-svn: 136377
2011-07-28 19:47:33 +00:00
Eric Christopher 1d1809437e Implement mulo<mode>4 for use in signed overflow checking.
Fixes rdar://9219742 and rdar://9218244

llvm-svn: 133284
2011-06-17 20:17:05 +00:00
Anton Korobeynikov 3c5199042a Add some macro magic: user __USER_LABEL_PREFIX__ instead of hardcoding it for each platform
llvm-svn: 129818
2011-04-19 21:22:14 +00:00
Anton Korobeynikov 4322a7d2c6 More fixes for missed includes
llvm-svn: 129807
2011-04-19 20:50:32 +00:00
Anton Korobeynikov 147ecfad82 Add missed include
llvm-svn: 129804
2011-04-19 20:45:29 +00:00
Anton Korobeynikov 0529d4da93 Add missed files from my last commit.
llvm-svn: 129777
2011-04-19 18:14:19 +00:00
Anton Korobeynikov e63da933eb Move abi bits to separate header. Force AAPCS for EABI in accordance with ARM RTABI.
llvm-svn: 129769
2011-04-19 17:52:09 +00:00
Anton Korobeynikov 75e3c1993c Add ARM EABI function aliases to routines
llvm-svn: 129768
2011-04-19 17:51:24 +00:00
Anton Korobeynikov bdadd87c4d Make use of LOCAL_LABEL macro
llvm-svn: 129767
2011-04-19 17:50:42 +00:00
Anton Korobeynikov 1653610449 Get rid of darwin'isms. Provide convenient macro for assembler local lables.
llvm-svn: 129766
2011-04-19 17:50:09 +00:00
Nick Kledzik e7e288c805 don't add version info for static library
llvm-svn: 129489
2011-04-14 00:40:20 +00:00
Nick Kledzik aa60d6ac01 fix typo
llvm-svn: 129389
2011-04-12 21:22:48 +00:00
Nick Kledzik 191c2804e7 <rdar://problem/9185449> update version info for arm
llvm-svn: 129386
2011-04-12 21:11:47 +00:00
Daniel Dunbar 4c70f3e6ac Revert "Split single & double comparison routines into separate implementation
files," for now, I missed some necesary updates.

llvm-svn: 128296
2011-03-25 18:45:39 +00:00
Daniel Dunbar 1102c9ae58 Split single & double comparison routines into separate implementation files,
for consistency.

llvm-svn: 128282
2011-03-25 15:52:51 +00:00
Daniel Dunbar f3798a397d compiler-rt: Split subdf3 and subsf3 out of add implementations, for
consistency.

llvm-svn: 128038
2011-03-21 23:30:19 +00:00
Stephen Canon 32acbef33f slight re-arrangement to maybe pick up one cycle on dual-issue ARM cores
llvm-svn: 128003
2011-03-21 17:35:26 +00:00
Stephen Canon 5abb5c14c4 Carefully written implementations of the 32-bit integer divide and modulus functions for ARM. These are still using a naive digit-by-digit algorithm, but the core loop has been carefully written.
llvm-svn: 127882
2011-03-18 16:35:02 +00:00
Nick Kledzik 47a823b281 <rdar://problem/8914924> implement udivmodsi4 and divmodsi4 for ARM
llvm-svn: 127778
2011-03-17 00:09:13 +00:00
Chris Lattner 15bc34c7c2 don't compile modsi3 into an infinite loop, patch by Matt Johnson!
llvm-svn: 127429
2011-03-10 22:11:46 +00:00
Nick Kledzik fc1586cf9f <rdar://problem/9091300> update Apple packaging of compiler-rt
llvm-svn: 127057
2011-03-05 02:15:16 +00:00
Nick Kledzik 9f1bd06ae9 Add missing <stdint.h> to build properly on Solaris. Patch by Joakim Johansson
llvm-svn: 123006
2011-01-07 19:09:06 +00:00
Howard Hinnant 5b791f6e64 license change
llvm-svn: 119397
2010-11-16 22:13:33 +00:00
Stephen Canon 5f0e6e7b92 Adds an extra explicit cast to fix Bug 7931 and removes codepaths that were never used
llvm-svn: 111269
2010-08-17 19:13:45 +00:00
Nick Kledzik cceb1f2e67 add assembly implementation of modsi3 so compiler does not have to special case a - (a / b) * b optimization
llvm-svn: 109492
2010-07-27 06:24:32 +00:00
Stephen Canon 8770d3d367 Fix error in rep_clz on non-LP64 targets. Patch by Christoph Gerum
llvm-svn: 109416
2010-07-26 18:17:00 +00:00
Stephen Canon df69264765 Hand-tuning of single-precision soft-float comparison routines for ARM
llvm-svn: 107891
2010-07-08 17:45:05 +00:00
Nick Kledzik 9445ef8f4a fix arvm5 builds
llvm-svn: 107588
2010-07-04 18:29:01 +00:00
Stephen Canon 644ab08dec Initial implementation of double-precision soft-float division, moved a couple utility functions from the multiplications into the utility header
llvm-svn: 107586
2010-07-04 16:53:39 +00:00
Stephen Canon 9ae6fd58c4 Single-precision soft-float division
llvm-svn: 107579
2010-07-04 06:15:44 +00:00
Stephen Canon 909f6c7bc4 Further cleanup of ARM bswap implementations, thanks to John Tytgat
llvm-svn: 107576
2010-07-03 21:47:50 +00:00
Stephen Canon b84e7dc80e Marginally smaller implementations of bswap for ARMv4, ARMv5 that avoid the need to establish a frame
llvm-svn: 107555
2010-07-03 01:00:49 +00:00
Stephen Canon 7973295a19 Renamed unsigned->float routines to match GCC convention
llvm-svn: 107554
2010-07-03 00:56:03 +00:00
Nick Kledzik 209ac43b76 ARM before armv6 did not supprt 'rev' instruction
llvm-svn: 107548
2010-07-03 00:12:47 +00:00
Stephen Canon 04b97967dd [unsigned] int -> float soft-float conversions for single- and double-precision
llvm-svn: 107535
2010-07-02 23:05:46 +00:00
Stephen Canon 4be0d7ead9 float- and double-to-integer soft-float conversions for compiler-rt
llvm-svn: 107524
2010-07-02 22:10:58 +00:00
Stephen Canon e9946d0d3f ... and one more fix to remove some warnings in the new double -> float conversion
llvm-svn: 107409
2010-07-01 18:02:15 +00:00
Stephen Canon 74eaf1f66c Correction to previous commit which mistakenly included older versions of some files; now includes the correct LLVM license header
llvm-svn: 107408
2010-07-01 17:58:24 +00:00
Stephen Canon b1fdde1d01 Adding soft-float comparisons, addition, subtraction, multiplication and negation
llvm-svn: 107400
2010-07-01 15:52:42 +00:00
Nick Kledzik c6cacf9858 sjlj based personality requires a different name
llvm-svn: 103330
2010-05-07 23:44:20 +00:00
Nick Kledzik 8e7ebea0b9 add explicit alignment directives to assure arm code is 4-byte aligned
llvm-svn: 102030
2010-04-21 22:36:23 +00:00
Nick Kledzik 5b0a0629a3 add include of int_lib.h to match change to use compilerrt_abort()
llvm-svn: 101396
2010-04-15 20:37:56 +00:00
Nick Kledzik b3d3ec7091 <rdar://problem/7813254> check enable_execute_stack implementation
llvm-svn: 100036
2010-03-31 19:52:01 +00:00
Daniel Dunbar 587b1d419d Add new build option KERNEL_USE, which compiles with -mkernel and gets propogated to CFLAGS. Use this to call panic() instead of abort() when enabled.
llvm-svn: 100015
2010-03-31 17:00:48 +00:00
Daniel Dunbar f287008791 Use a private compilerrt_abort() define instead of calling abort directly.
- Fiddling with abort directly is annoying given the way we use system includes, although it would be nice to fix this so we could make sure calling abort directly is verboten.

llvm-svn: 100014
2010-03-31 17:00:45 +00:00
Nick Kledzik debb901045 add __sync_synchronize. Needed by compiler when emitting thumb1 with -fno-builtin
llvm-svn: 95132
2010-02-02 21:34:04 +00:00
Nick Kledzik ac02b5a09c fix return type of _Unwind_Exception.exception_cleanup
llvm-svn: 93983
2010-01-20 06:13:20 +00:00
Daniel Dunbar 4c43c2bc73 Split up switch.S and save_restore_d8_d15.S to follow one function per file convention.
llvm-svn: 93815
2010-01-19 00:01:10 +00:00
Daniel Dunbar f665b32a70 Add a VISIBILITY_HIDDEN option, which can be used to make all compiler-rt function definitions hidden/private extern.
llvm-svn: 93790
2010-01-18 22:19:34 +00:00
Daniel Dunbar 64a198d060 Unbreak symbol mangling in .s files, at least for Darwin/Linux.
llvm-svn: 93789
2010-01-18 22:19:25 +00:00
Daniel Dunbar ef89858e47 Add DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED for use in .S files -- restFP and saveFP don't get USER_LABEL_PREFIX prepended for some reason.
llvm-svn: 93788
2010-01-18 22:19:20 +00:00
Daniel Dunbar 6bcbef6230 Rename subdir 'Target' variable to 'Implementation' to be less overloaded.
llvm-svn: 93718
2010-01-18 06:49:09 +00:00
Daniel Dunbar 56e0eb9fc9 Simplify subdirectory makefiles, and be more robust by checking that they define the appropriate variables.
llvm-svn: 93714
2010-01-18 06:48:33 +00:00
Nick Kledzik 64eecd2de5 Fix copy/paste error. http://llvm.org/bugs/show_bug.cgi?id=572
llvm-svn: 93297
2010-01-13 05:30:28 +00:00
Rafael Espindola 393cb7c22d Use __USER_LABEL_PREFIX__ so that we don't add a _ prefix on ELF.
llvm-svn: 86542
2009-11-09 14:27:04 +00:00
Edward O'Callaghan 8f40ca3b8f Fix x86/x64 on Linux, Credit to Rafael Espindola.
llvm-svn: 86075
2009-11-04 23:52:51 +00:00
Edward O'Callaghan a8fa825177 Fix DragonFly BSD define in compiler-rt.
llvm-svn: 85726
2009-11-01 18:25:55 +00:00
Nick Kledzik d4b78d38d4 add __save_vfp_d8_d15_regs and __restore_vfp_d8_d15_regs for ARM
llvm-svn: 85531
2009-10-29 22:31:39 +00:00
Edward O'Callaghan a55dd008ad Update CMake build system with target arch source file lists.
llvm-svn: 85448
2009-10-29 00:07:46 +00:00
Daniel Dunbar 9ff9371bb7 Switch to using DEFINE_COMPILERRT_[PRIVATE_]FUNCTION to define function symbols inside .S files.
llvm-svn: 85264
2009-10-27 17:50:21 +00:00
Daniel Dunbar 7d50478889 Add assembly.h for use in .S files.
llvm-svn: 85263
2009-10-27 17:49:50 +00:00
Daniel Dunbar 805c49408f Update some .S file headers.
llvm-svn: 85262
2009-10-27 17:49:19 +00:00
Daniel Dunbar 247687360f Remove duplicate copy of int_lib.h, and update test script to find copy inside lib/.
Also, fix some brokenness in the test script w.r.t REMOTE.

llvm-svn: 85260
2009-10-27 17:48:46 +00:00
Shantonu Sen 33f6acbbf1 1) Remove cmake-specific #define usage from the exported
Block.h/Block_private.h headers, since clients won't know what to
set. These are moved into runtime.c as appropriate

2) Use cmake checks for CAS builtins, instead of guessing based on GCC
#defines (which aren't set by clang and llvm-gcc anyway)

3) "#pragma mark" isn't supported by FSF gcc, so "#if 0" it out. It
should still show up in IDEs that support it

4) Fix some compiler warnings. GCC 4.3.3 seems super strict about
%p. function pointers can't be cast to void * either.

5) Avoid a warning for apple_versioning.c that "ISO C does not allow
empty files"

llvm-svn: 82504
2009-09-22 00:49:12 +00:00
Nick Kledzik e80d44c943 update make rules so libcompiler-rt can be built for armv6 the Apple way
llvm-svn: 82185
2009-09-18 00:09:05 +00:00
Nick Kledzik 4efa121e40 add support for __switch* needed for switch statements in thumb codegen
llvm-svn: 82184
2009-09-18 00:07:52 +00:00
Nick Kledzik ad160c0330 add conversion functions and test cases for ARM
llvm-svn: 81809
2009-09-14 23:26:56 +00:00
Edward O'Callaghan 2e2d1a87f9 Update cmake files for arm support hooks.
llvm-svn: 81760
2009-09-14 12:45:07 +00:00
Nick Kledzik 0f312a09b2 fix typo in comment
llvm-svn: 81686
2009-09-13 18:34:39 +00:00
Nick Kledzik 9130011d5f add comparison functions for ARM
llvm-svn: 81597
2009-09-12 01:23:48 +00:00
Nick Kledzik b9c6e4a189 start adding implementation of arm *vfp routines with test cases
llvm-svn: 81558
2009-09-11 20:02:01 +00:00
Daniel Dunbar c91aeac18b Stub out structure for building armv{6,7} libs.
llvm-svn: 81482
2009-09-10 23:50:10 +00:00
Daniel Dunbar 85922561ee Unbreak building of assembly files (broken by my .s -> .S rename).
- Noticed & patched by Nick Kledzik.

 - This may expose portability issues in the .S files, if so we should either
   disable them on non-Darwin, or even better make them portable.

llvm-svn: 81476
2009-09-10 23:27:45 +00:00
Edward O'Callaghan 665671ec89 Fix some files that got left behind in early changeset to unnamed unions fix. Credit to Roman Divacky.
llvm-svn: 80913
2009-09-03 09:12:20 +00:00
Edward O'Callaghan 19db729ab4 Add support for ellcc, Credit to Richard Pennington.
llvm-svn: 79332
2009-08-18 11:54:44 +00:00
Edward O'Callaghan ea0bd0d0a4 Fix pre-processor mistake for BSDs in endianness.h
llvm-svn: 79330
2009-08-18 11:07:59 +00:00
Edward O'Callaghan 40268af91e Temporary define HAVE_SYSCONF until cmake checks are done.
llvm-svn: 78546
2009-08-10 01:02:16 +00:00
Edward O'Callaghan 2dbae9c334 Fix a FIXME for configure check for HAVE_SYSCONF.
llvm-svn: 78545
2009-08-10 00:56:46 +00:00
Nuno Lopes 1586376f2e fix build on linux
llvm-svn: 78538
2009-08-09 18:59:21 +00:00
Edward O'Callaghan ccf48131d0 Refactor to remove un-named struct gnu extension usage. Now ISO C89 and C99 compliant. Comment trailing endifs
llvm-svn: 78537
2009-08-09 18:41:02 +00:00
Edward O'Callaghan f8ba5e9e6e Optimized versions now buildable on Solaris.
llvm-svn: 78457
2009-08-08 04:43:56 +00:00
Edward O'Callaghan 032ab6f978 Fix signedness warning in mprotect call, Clean up and improve endianness.h header.
llvm-svn: 78451
2009-08-08 02:31:50 +00:00
Edward O'Callaghan 5583632adf Code style and Readability fixes. Credit to Craig van Vliet.
llvm-svn: 78403
2009-08-07 20:30:09 +00:00
Edward O'Callaghan 7a6cb5febf Refactor test suit endianness pre-processor code. More style and readability fixes, start labling endif's
llvm-svn: 78234
2009-08-05 19:57:20 +00:00
Edward O'Callaghan dabf71f171 Next batch of C++ to C comment style changes. Also improve and factor out endianness pre-processor code.
llvm-svn: 78226
2009-08-05 19:06:50 +00:00
Edward O'Callaghan 4856eef437 Fixup C++ style comments are not allowed in ISO C90 to classic C style.
llvm-svn: 78152
2009-08-05 04:02:56 +00:00
Edward O'Callaghan df72046277 Start porting compiler-rt testsuit to Solaris with new build system. Fix some C++ style comments which are not allowed in ISO C90.
llvm-svn: 78143
2009-08-05 01:47:29 +00:00
Edward O'Callaghan 30009e7121 Refactor out common pre-processor code.
llvm-svn: 78037
2009-08-04 03:30:10 +00:00
Edward O'Callaghan 7578f80b0c Fix newlinew warning in floatundidf.c , Bulkout CMake system more, complete port to AuroraUX and Solaris.
llvm-svn: 77958
2009-08-03 05:59:48 +00:00
Edward O'Callaghan 43fb93ab2f A few CMake formating fixes for compiler-rt.
llvm-svn: 77937
2009-08-03 02:15:06 +00:00
Edward O'Callaghan 6912ed0f36 Initial import of CMake type build system. Just like the rest of llvm..
llvm-svn: 77933
2009-08-03 01:08:25 +00:00
Eli Friedman 30bd27bf7d Misc compiler-rt fixes. Clarify neg implementations to show what is
actually happening.  Fix mod implementation so it doesn't get 
optimized to a recursive call.  Make x86-32 non-SSE2 shift 
implementation use shld/shrd instead of emulating it (the only x86 processor
where the emulation might be remotely close to justifiable is the Pentium 4).

llvm-svn: 74756
2009-07-03 02:26:38 +00:00
Daniel Dunbar c6cd62b351 Add missing include for getpagesize, and fix a typo.
llvm-svn: 74588
2009-07-01 06:06:42 +00:00
Daniel Dunbar 86bb32b138 Fix a Darwinism, .s files meant to be preprocessed should be named .S.
llvm-svn: 74587
2009-07-01 06:04:03 +00:00
Daniel Dunbar f118402877 Use getpagesize() on non-Darwin platforms.
- Presumably we will eventually need configure magic for this stuff.

llvm-svn: 74586
2009-07-01 06:02:53 +00:00
Daniel Dunbar fd089990f7 Initial import of compiler-rt.
-

llvm-svn: 74292
2009-06-26 16:47:03 +00:00