Skip to content

Backport fix profiler building with MinGW GCC #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2020

Conversation

mati865
Copy link

@mati865 mati865 commented Aug 26, 2020

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

@cuviper
Copy link
Member

cuviper commented Aug 26, 2020

Can you also file an LLVM backport bug blocking release-11.0.0?

@cuviper cuviper merged commit 4d40ae5 into rust-lang:rustc/11.0-2020-08-20 Aug 26, 2020
@mati865
Copy link
Author

mati865 commented Aug 26, 2020

It's already very late for backports and this doesn't fix the issue entirely when building with GCC.

Thanks to this patch one can link to profiler library built by GCC without errors to check on the CI if binaries are properly instrumented.

But instrumented binary will crash like this:

Backtrace
Process 8324 launched: 'D:\Projekty\rust\build\x86_64-pc-windows-gnu\test\run-make-fulldeps\instrument-coverage\instrume
nt-coverage\testprog.exe' (x86_64)
Process 8324 stopped
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x1400ad4d0: Access violation reading location 0x
00000012
    frame #0: 0x00000001400ad4d0 testprog.exe`initializeValueProfRuntimeRecord(Data=0x00000001400e5030, SiteCountArray=0
x0000000000000000) at InstrProfilingValue.c:332:14
   329            Nodes ? RTRecord.NodesKind[I][J] : INSTR_PROF_NULLPTR;
   330        while (Site) {
   331          C++;
-> 332          Site = Site->Next;
   333        }
   334        if (C > UCHAR_MAX)
   335          C = UCHAR_MAX;
(lldb) bt
* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x1400ad4d0: Access violation reading location 0x
00000012
  * frame #0: 0x00000001400ad4d0 testprog.exe`initializeValueProfRuntimeRecord(Data=0x00000001400e5030, SiteCountArray=0
x0000000000000000) at InstrProfilingValue.c:332:14
    frame #1: 0x00000001400af05e testprog.exe`writeOneValueProfData(VPDataReader=0x00000001400d8560, Data=0x00000001400e
5030, BufferIO=0x00000001400d8540) at InstrProfilingWriter.c:146:25
    frame #2: 0x00000001400ae2e4 testprog.exe`lprofWriteDataImpl at InstrProfilingWriter.c:227:9
    frame #3: 0x00000001400ae262 testprog.exe`lprofWriteDataImpl(Writer=0x000000000014fd70, DataBegin=<unavailable>, Dat
aEnd=0x00000001400e51c0, CountersBegin=0x00000001400e4008, CountersEnd=0x00000001400e4048, VPDataReader=0x00000001400d85
60, NamesBegin="", NamesEnd="", SkipNameDataWrite=0) at InstrProfilingWriter.c:299
    frame #4: 0x00000001400adfd0 testprog.exe`lprofWriteData(Writer=0x000000000014fd70, VPDataReader=0x00000001400d8560,
 SkipNameDataWrite=0) at InstrProfilingWriter.c:248:10
    frame #5: 0x00000001400ac373 testprog.exe`__llvm_profile_write_file at InstrProfilingFile.c:346:12
    frame #6: 0x00000001400ac223 testprog.exe`__llvm_profile_write_file at InstrProfilingFile.c:935

That single test worked fine with profiler build by Clang so I don't think there is much gain in blocking LLVM 11 release on it.

@mati865 mati865 deleted the mingw-profiler-fix branch August 26, 2020 18:09
cuviper pushed a commit that referenced this pull request Sep 22, 2020
cuviper pushed a commit that referenced this pull request Oct 14, 2020
cuviper pushed a commit that referenced this pull request Jan 7, 2021
vext01 added a commit to vext01/llvm-project that referenced this pull request Jul 11, 2023
72: A couple of misc bits in ykllvm r=ltratt a=vext01



Co-authored-by: Edd Barrett <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants