Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_B_19
Beginner
71 Views

error: ld: bad codegen, pointer diff in EH_frame1 to global weak symbol

Hi. First off, thanks for all the help that you offer through this forum. In the past, I've found the responses to be both helpful and polite. Second, the problem below occurs on Mac OSX 10.7.2, running icpc version12.1.0 20110811.
\\
Consider the following short code:
#include
int main() {
std::cout << "hello world\\n";
}
\\
If I compile with: icpc icctest.cpp, there is no problem. All runs well.
\\
But, if I compile with icpc -g icctest.cpp, I get the following warning:
\\
no debug symbols in executable (-arch x86_64)
\\
That, by itself, if no big deal. In fact, the executable runs.
\\
However, for more complicated projects, if I compile without debugging information, all works fine. But as soon as I add the -g flag (or the -debug full flag), I get the following error:
\\
ld: bad codegen, pointer diff in EH_frame1 to global weak symbol SOME_SYMBOL_NAME for architecture x86_64
\\
Thus, the build fails.
\\
This happens even if I am not linking to external libraries; the symbols are from some header-only libraries. And itdoes not happen with g++. It is only with the Intel compilers.
\\
After some deep digging online, it seems like this might be related to debugging symbols being placed in a .dSYM directory. I've never really noticed that directory before. But when I go into the directory, and eventually get to the DWARF directory in there, I get:
\\
nm a.out
nm: object: a.out malformed object (section contents at offset 0 with a size of 160, overlaps Mach-O headers at offset 0 with a size of 1952)
\\
There will be a similar message for the simple Hello World example above, as well as some of the more complicated projects.
\\
I have found some references to changing XCode options to avoid placing debugging symbols in the dSYM directory, but since I usually work on a command line, that does not help me much.
So I am now at a loss as to what to do next. Any ideas? Thanks in advance.
\\
Michael
0 Kudos
1 Reply
Michael_B_19
Beginner
71 Views

I just realized that my developer tools were XCode 4.1. I upgraded to XCode 4.2.1, also also upgraded to icc 12.1.2 20111207. Now the error message is as follows:
$ icpc -g -xHost -m64 icctest.cpp
final section layout:
__TEXT/__text addr=0x100001340, size=0x000018F0, fileOffset=0x00001340, type=1
__TEXT/__stubs addr=0x100002C30, size=0x00000048, fileOffset=0x00002C30, type=27
__TEXT/__stub_helper addr=0x100002C78, size=0x00000088, fileOffset=0x00002C78, type=31
__TEXT/__cstring addr=0x100002D00, size=0x000009E7, fileOffset=0x00002D00, type=12
__TEXT/__eh_frame addr=0x1000036E8, size=0x00000910, fileOffset=0x000036E8, type=18
__DATA/__program_vars addr=0x100004000, size=0x00000028, fileOffset=0x00004000, type=29
__DATA/__got addr=0x100004028, size=0x00000030, fileOffset=0x00004028, type=28
__DATA/__nl_symbol_ptr addr=0x100004058, size=0x00000010, fileOffset=0x00004058, type=28
__DATA/__la_symbol_ptr addr=0x100004068, size=0x00000060, fileOffset=0x00004068, type=26
__DATA/__mod_init_func addr=0x1000040C8, size=0x00000008, fileOffset=0x000040C8, type=32
__DATA/.comment addr=0x1000040D0, size=0x00000026, fileOffset=0x000040D0, type=0
__DATA/__debug_frame addr=0x1000040F6, size=0x00000078, fileOffset=0x000040F6, type=0
__DATA/__data addr=0x100004180, size=0x00000368, fileOffset=0x00004180, type=0
__DATA/__common addr=0x1000044E8, size=0x00000020, fileOffset=0x00000000, type=24
__DATA/__bss addr=0x100004520, size=0x00000444, fileOffset=0x00000000, type=24
__DWARFA/__debug_info addr=0x100005000, size=0x000195E9, fileOffset=0x00005000, type=0
__DWARFA/__debug_line addr=0x10001E5E9, size=0x000003DE, fileOffset=0x0001E5E9, type=0
__DWARFA/__debug_abbrev addr=0x10001E9C7, size=0x00000417, fileOffset=0x0001E9C7, type=0
ld: 32-bit absolute address out of range (0x10001E9C7 max is 4GB): from .debug_info_seg + 0x00000006 (0x100005000) to anon@0x00019A82 (0x10001E9C7) in .debug_info_seg from /var/folders/jf/24ry58qj0hd2n_qshf0qh2200000gp/T//icpc8FJSKo.o for architecture x86_64
Again, this happens with icpc, but not with g++ 4.6.1.
Reply