Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Segfault when using static __thread variables with gold linker in linux

Richard_G_4
Beginner
1,515 Views

Hi,

I get a Segmentation Fault when using the intel compiler with the Gold linker in binutils. I don't get a segfault when using g++ 4.7.2. I've tested icc 12.1.3, 13.1.1 and 14.0.0 20130728. I'm using RHEL5.

Build command line :

icc14 goldcrash.cpp -o goldcrash -B <path to gold ld> && ./goldcrash

 (replace <path to gold ld> with the installation of binutils 2.23.2

goldcrash.cpp :

[cpp]

struct Simple {

Simple():m_id(0) {}
int m_id;
int getID() { return m_id; }
};

int main(int argc, const char **argv)
{
Simple s;
static __thread int lastID = -1;
if (lastID != s.getID())
{
  lastID = s.getID();
}
return 0;
}

[/cpp]

Thanks!

0 Kudos
28 Replies
Richard_G_4
Beginner
417 Views

This is still causing segfaults with icc 14.0.2 and the latest binutils 2.24. I've had no reply from Intel support giving an ETA for a fix, our firm is moving to clang & gcc for development builds until this is fixed.

$ icc14 -o goldcrash goldcrash.cpp -B /spare/local/environ-infra/binutils/2.24/bin/gold -O0                                                        
$ ./goldcrash
Segmentation fault
$ icc14 --version
icc (ICC) 14.0.2 20140120
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

$ ll /spare/local/environ-infra/binutils/2.24/bin/gold
total 0
lrwxrwxrwx 1 rgeary infra 10 Feb  3 11:23 ld -> ../ld.gold
$ /spare/local/environ-infra/binutils/2.24/bin/gold/ld --version
GNU gold (GNU Binutils 2.24) 1.11
Copyright 2013 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.

$ cat goldcrash.cpp 
int main(int argc, const char **argv)
{
  static __thread int lastID = -1;
  lastID = 0;
  return 0;
}

 

0 Kudos
pbkenned1
Employee
417 Views

Hello Richard,

I'm sorry, I don't have an ETA yet on when this is planned to be fixed.  Thanks for the feedback, I will pass that along to the developers.

Patrick

0 Kudos
pbkenned1
Employee
417 Views

Hello Richard,

The developers are actively looking at this issue, although I do not yet have an ETA.  There seems to be something in our direct object generation that the gold linker doesn't like.  The problem can be worked around with -use-asm.

Patrick

0 Kudos
pbkenned1
Employee
417 Views

This issue is now targeted to be fixed in the next update to icc-14 (update #3), which should be available around the end of April (caveat: plans are always subject to change).

Patrick

0 Kudos
pbkenned1
Employee
417 Views

Resolved with icc-14.0.3.174. 

Patrick

0 Kudos
Richard_G_4
Beginner
417 Views

Thanks, fix confirmed in 14.0.3, but still present in icc 15 beta (15.0.0 20140318)

0 Kudos
pbkenned1
Employee
417 Views

The fix wasn't checked into the v15 branch until 4/2/2014, so it's not in the initial beta release.  I just checked, and it's fixed in beta update #1 (Version 15.0.0.040 Beta Build 20140428)

 

Patrick

0 Kudos
Richard_Geary
Beginner
417 Views

Confirmed fixed in beta 15.0.0.040, thanks!

0 Kudos
Reply