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

Port swift specific compiler-rt code to Windows #5

Closed
wants to merge 1 commit into from
Closed

Port swift specific compiler-rt code to Windows #5

wants to merge 1 commit into from

Conversation

hughbe
Copy link
Contributor

@hughbe hughbe commented Jan 25, 2017

Introduced in 2cf73dc

@vedantk

Copy link
Member

@vedantk vedantk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define a portable helper function in InstrProfilingUtil.{c,h} that can install a signal handler and issue a warning if it isn't successful. It'd be nice to use the 'lprof' prefix for consistency with the other helper functions in that file.

@hughbe
Copy link
Contributor Author

hughbe commented Jan 28, 2017

Thanks - I've pushed an update for this. I'll just trigger tests to make sure I haven't broken non-Windows platforms.

@hughbe
Copy link
Contributor Author

hughbe commented Jan 28, 2017

@swift-ci please test

@vedantk
Copy link
Member

vedantk commented Jan 29, 2017

LGTM.

@hughbe
Copy link
Contributor Author

hughbe commented Feb 2, 2017

@swift-ci Please smoke test

@hughbe
Copy link
Contributor Author

hughbe commented Feb 2, 2017

I guess testing doesn't work here... @shahmishal?

@vedantk
Copy link
Member

vedantk commented Feb 2, 2017

Ah, that's right. swift-{llvm, clang, compiler-rt} are not gated. Please run the 'check-profile' target on your dev machine and commit.

@shahmishal
Copy link
Member

@hughbe Only regular test works on here.

@swift-ci Please test

@hughbe
Copy link
Contributor Author

hughbe commented Feb 3, 2017

Looks like that doesn't do anything?

@hughbe
Copy link
Contributor Author

hughbe commented Feb 10, 2017

I've verified that this builds successfully on non-Windows platforms

fredriss pushed a commit that referenced this pull request Feb 11, 2017
Summary:
GET_CALLER_PC doesn't work properly on 31-bit s390, as pointers are 31-bit, the MSB bit can be set when the return address is copied into integer.
This causes e.g. errors like:
    #0 0xfdadb129  (<unknown module>)
    #1 0x7da5e1d1 in __asan::GetStackTraceWithPcBpAndContext(__sanitizer::BufferedStackTrace*, unsigned long, unsigned long, unsigned long, void*, bool) ../../../../../libsanitizer/asan/asan_stack.h:50
    #2 0x7da5e1d1 in __asan::ErrorGeneric::Print() ../../../../../libsanitizer/asan/asan_errors.cc:482
    #3 0x7db178d5 in __asan::ErrorDescription::Print() ../../../../../libsanitizer/asan/asan_errors.h:360
    #4 0x7db178d5 in __asan::ScopedInErrorReport::~ScopedInErrorReport() ../../../../../libsanitizer/asan/asan_report.cc:167
    #5 0x7db178d5 in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) ../../../../../libsanitizer/asan/asan_report.cc:397
    #6 0x7dadb14f in __interceptor_memcmp ../../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:626
    #7 0x400cf5 in main /home/jakub/gcc/gcc/testsuite/c-c++-common/asan/memcmp-1.c:14
    #8 0x7d807215 in __libc_start_main (/lib/libc.so.6+0x1a215)
    #9 0x4007ed  (/home/jakub/gcc/obj/gcc/testsuite/memcmp-1.exe+0x4007ed)

The actual return PC inside __interceptor_memcmp was 0x7dadb129 rather than 0xfdadb129.

Reviewers: koriakin, kcc

Reviewed By: kcc

Subscribers: kubamracek

Differential Revision: https://reviews.llvm.org/D29824

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294793 91177308-0d34-0410-b5e6-96231b3b80d8
@hughbe
Copy link
Contributor Author

hughbe commented Feb 22, 2017

@swift-ci please test

@hughbe
Copy link
Contributor Author

hughbe commented Feb 22, 2017

@swift-ci Please test

@hughbe
Copy link
Contributor Author

hughbe commented Feb 22, 2017

@shahmishal please test doesn't work here

@vedantk
Copy link
Member

vedantk commented Feb 22, 2017

@hughbe Would you like me to commit this for you?

@hughbe
Copy link
Contributor Author

hughbe commented Feb 23, 2017

Sure, thanks!

vedantk pushed a commit that referenced this pull request Feb 23, 2017
@vedantk
Copy link
Member

vedantk commented Feb 23, 2017

commit ac64ee6 (HEAD -> upstream-with-swift, origin/upstream-with-swift, origin/HEAD)
Author: Hugh Bellamy hughbellars@gmail.com
Date: Sat Jan 28 07:30:15 2017

Port swift specific compiler-rt code to Windows

https://github.com/apple/swift-compiler-rt/pull/5

@vedantk vedantk closed this Feb 23, 2017
fredriss pushed a commit that referenced this pull request Dec 21, 2017
Summary:
__builtin_clz used for Log calculation returns an undefined result
when argument is 0. I noticed that issue when was testing some fuzzers:

```
/src/libfuzzer/FuzzerTracePC.h:282:33: runtime error: shift exponent 450349 is too large for 32-bit type 'uint32_t' (aka 'unsigned int')
  #0 0x43d83f in operator() /src/libfuzzer/FuzzerTracePC.h:283:33
  #1 0x43d83f in void fuzzer::TracePC::CollectFeatures<fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*)::$_1>(fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*)::$_1) const /src/libfuzzer/FuzzerTracePC.h:290
  #2 0x43cbd4 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:445:7
  #3 0x43e5f1 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:706:5
  #4 0x43e9e1 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:739:3
  #5 0x432f8c in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:754:6
  #6 0x42ee18 in main /src/libfuzzer/FuzzerMain.cpp:20:10
  #7 0x7f17ffeb182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
  #8 0x407838 in _start (/out/rotate_fuzzer+0x407838)

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits, #sanitizers

Differential Revision: https://reviews.llvm.org/D41457

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321211 91177308-0d34-0410-b5e6-96231b3b80d8
vedantk added a commit to vedantk/apple-llvm-project that referenced this pull request Oct 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants