Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)

Clang 5 and VTune 2017/2018

Matthias_F_
Beginner
850 Views

Hi there,

I've been trying to figure out why VTune 2017 and 2018 seems to crash our software whenever I try to our attach to it using amplxe-cl. It turns out that *anything* compiled with clang 5 seems to crash VTune and the attached process with it (*).
Interestingly, VTune 2015 works fine -- and so do binaries created with clang 3.5.

The crash report is simple enough:

$ amplxe-cl -collect hotspots ./test-clang.out
amplxe: Collection started. To stop the collection, either press CTRL-C or enter from another console window: amplxe-cl -r /tmp/testeh/r000hs -command stop.
amplxe: Warning: Can't find 32-bit pin tool. 32-bit processes will not be profiled.
amplxe: Error: [Instrumentation Engine]: Source/pin/elfio/img_elf.cpp: ProcessSectionHeaders: 777: unknown section type 1879048193 for sec[18,.eh_frame] in /tmp/testeh/test-clang.out 
amplxe: Collection failed.
amplxe: Internal Error

The reported section type for .eh_frame is "X86_64_UNWIND", which is the type that clang 5 apparently uses (unless -fno-unwind-tables is used, it seems).

As this seems such a generic problem, I would expect that other users have experienced this problem as well. Have you been able to work around this? Or is this a bug that has already been fixed?

Cheers,
Matthias

(*) Exact versions used:
* VTune 2015 (working fine with clang 5): Intel(R) VTune(TM) Amplifier XE 2015 Update 2 (build 393444)
* VTune 2017 (not working with clang 5): Intel(R) VTune(TM) Amplifier XE 2017 Update 4 (build 518798)
* VTune 2018 (not working with clang 5): Intel(R) VTune(TM) Amplifier 2018 (build 525261)
* Clang 5: clang version 5.0.0 (tags/RELEASE_500/final)
* Clang 3.5: clang version 3.5.0 (tags/RELEASE_350/final)

Edit: links to related bug reports in elfutils and glibc:
https://bugzilla.redhat.com/show_bug.cgi?id=1335297
https://sourceware.org/bugzilla/show_bug.cgi?id=20079

0 Kudos
6 Replies
Matthias_F_
Beginner
850 Views

We found a somewhat surprising (and quirky) workaround: enabling -ffast-math seems to make clang use "PROGBITS" for the section type of .eh_frame -- not entirely sure why and what this means -- which makes VTune happy.

0 Kudos
Vladimir_R_Intel
Employee
850 Views

Hi Matthias,

could you please upload a simple reproducer for the bug? I think some "Hello world" application compiled with your compiler and your flags will be enough.

BR,

Vladimir

0 Kudos
Matthias_F_
Beginner
850 Views

Hi Vladimir,

thanks for your reply. Sure! Please see the exact compilation flags (none ;-)) and reproduction steps below. The the compiled binary is contained in the attached archive.

Cheers,
Matthias

helloworld.c:

#include <stdio.h>

int main() {
  printf("Hello world!\n");
}

 

Compilation, reproduction with error message, relevant section type header & version info:

$ clang helloworld.c -o helloworld
$ amplxe-cl -collect hotspots ./helloworld
amplxe: Collection started. To stop the collection, either press CTRL-C or enter from another console window: amplxe-cl -r /tmp/testeh/r003hs -command stop.
amplxe: Warning: Can't find 32-bit pin tool. 32-bit processes will not be profiled.
amplxe: Error: [Instrumentation Engine]: Source/pin/elfio/img_elf.cpp: ProcessSectionHeaders: 777: unknown section type 1879048193 for sec[18,.eh_frame] in /tmp/testeh/helloworld 
amplxe: Collection failed.
amplxe: Internal Error
$ readelf -S helloworld | grep '.eh_frame\>'
  [16] .eh_frame         X86_64_UNWIND    0000000000400670  00000670

$ amplxe-cl --version
Intel(R) VTune(TM) Amplifier 2018 (build 525261) Command Line Tool
Copyright (C) 2009-2017 Intel Corporation. All rights reserved.
$ clang --version
clang version 5.0.0 (tags/RELEASE_500/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ ld --version
GNU ld version 2.20.51.0.2-5.42.el6 20100205
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
$ uname -a
Linux tag 2.6.32-504.30.3.el6.x86_64 #1 SMP Wed Jul 15 10:13:09 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/centos-release
CentOS release 6.6 (Final)

 

0 Kudos
Vladimir_R_Intel
Employee
850 Views

Hi Matthias,

seems that your issue doesn't relate to clang-5 but relates to OS version. It should be fixed in newer AXE versions. You can try the AXE 2017 U5 (already public) and the AXE 2018 U1 which will become public very soon.

BR,

Vladimir

0 Kudos
Matthias_F_
Beginner
850 Views

Hi Vladimir,

thank you. I have just tried AXE 2017, Update 5. Unfortunately, this still crashes, with the same error message.

$ amplxe-cl --version
Intel(R) VTune(TM) Amplifier XE 2017 Update 5 (build 526192) Command Line Tool
Copyright (C) 2009-2017 Intel Corporation. All rights reserved.
$ amplxe-cl -collect hotspots ./helloworld
amplxe: Collection started. To stop the collection, either press CTRL-C or enter from another console window: amplxe-cl -r /tmp/testeh/r004hs -command stop.
__bionic_open_tzdata_path: couldn't find any tzdata when looking for Australia/Sydney!
__bionic_open_tzdata_path: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata_path: couldn't find any tzdata when looking for posixrules!
amplxe: Error: [Instrumentation Engine]: Source/pin/elfio/img_elf.cpp: ProcessSectionHeaders: 775: unknown section type 1879048193 for sec[18,.eh_frame] in /tmp/testeh/helloworld 
amplxe: Collection failed.
amplxe: Internal Error

 

Regarding version of the OS, could you specifically point out the version of which tool/library/system is relevant, so we could try to update that? I'd be surprised if our version of binutils broken, as readelf reads this section header without complaining.

Cheers,
Matthias
 

0 Kudos
Vladimir_R_Intel
Employee
850 Views

Hi Matthias,

sorry for my inattention. I thought that you observe the same issue as here: https://software.intel.com/en-us/forums/intel-vtune-amplifier-xe/topic/737100#comment-1907854

But you definitely have a different bug. I've reproduced it on my side using your binary, thank you for it. We'll consider the fix for future update.

As a workaround I can suggest to use advanced-hotspots.

BR,

Vladimir

0 Kudos
Reply