load problem w/.text defined in discarded

i am trying to build tbb (intel’s thread building blocks v. 2.1), but I’m running into a linking error when I try to build the .so.

pgCC -fPIC -o libtbb.so.2 concurrent_hash_map.o concurrent_queue.o concurrent_vector.o itt_notify.o cache_aligned_allocator.o pipeline.o queuing_mutex.o queuing_rw_mutex.o spin_rw_mutex.o spin_mutex.o task.o tbb_misc.o mutex.o recursive_mutex.o tbb_thread.o concurrent_vector_v2.o concurrent_queue_v2.o spin_rw_mutex_v2.o -ldl -lpthread -lrt -shared -Wl,-soname=libtbb.so.2 -Wl,–version-script,tbb.def
/usr/bin/ld: __CPR122____TBB_store_with_release__tm__77_PQ3_3tbb8internal19context_list_node_tPQ3_3tbbJ41JJ50J__FRVZ1ZZ2Z_v' referenced in section .text’ of task.o: defined in discarded section `.gnu.linkonce.t.__TBB_LockByte__FRUc[__TBB_LockByte__FRUc]’ of task.o

/usr/bin/ld: __CPR122____TBB_store_with_release__tm__77_PQ3_3tbb8internal19context_list_node_tPQ3_3tbbJ41JJ50J__FRVZ1ZZ2Z_v' referenced in section .text’ of task.o: defined in discarded section `.gnu.linkonce.t.__TBB_LockByte__FRUc[__TBB_LockByte__FRUc]’ of task.o

/usr/bin/ld: __TBB_load_with_acquire__tm__2_b__FRCVZ1Z_Z1Z' referenced in section .text’ of task.o: defined in discarded section `.gnu.linkonce.t.__TBB_LockByte__FRUc[__TBB_LockByte__FRUc]’ of task.o

/usr/bin/ld: __CPR102____TBB_store_with_release__tm__57_PQ2_3tbb18task_group_contextPQ2_3tbbJ41J__FRVZ1ZZ2Z_v' referenced in section .text’ of task.o: defined in discarded section `.gnu.linkonce.t.__TBB_LockByte__FRUc[__TBB_LockByte__FRUc]’ of task.o

etc. etc. etc.

This is pgi 10.1.

pgCC 10.1-0 64-bit target on x86-64 Linux -tp penryn-64
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2010, STMicroelectronics, Inc. All Rights Reserved.

/usr/bin/ld --version
GNU ld version 2.15.92.0.2 20040927

any help would be appreciated.

i built and installed ld-2.20 and the problem goes away.

Somehow pgi thinks the .so that was finally built is virtually unreadable.
/local/mcatk/packages/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/local/vendor/pgi-10.1/linux86-64/10.1/lib/trace_init.o /usr/lib/gcc/x86_64-redhat-linux/3.4.6/crtbegin.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/local/vendor/pgi-10.1/linux86-64/10.1/lib/pgi.ld -L/local/mcatk/packages/src/tbb21_20080605oss/build/linux_em64t_pgi_cc4.3.3_libc2.3.4_kernel2.6.9_release -L/usr/X11R6/lib64 -L/opt/local/vendor/pgi-10.1/10.1/share_objects/lib64 -L/opt/local/vendor/pgi-10.1/linux86-64/10.1/lib -L/usr/lib64 -L/usr/lib/gcc/x86_64-redhat-linux/3.4.6 xvideo.o SeismicSimulation.o -ltbb -lpthread -lX11 -lXext -rpath /opt/local/vendor/pgi-10.1/10.1/share_objects/lib64 -rpath /opt/local/vendor/pgi-10.1/linux86-64/10.1/lib -o ./seismic -lstd -lC -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib/gcc/x86_64-redhat-linux/3.4.6/crtend.o /usr/lib64/crtn.o
SeismicSimulation.o: In function main': /local/mcatk/packages/src/tbb21_20080605oss/examples/parallel_for/seismic/./SeismicSimulation.cpp:349: undefined reference to tbb::task_scheduler_init::initialize( (int))’
SeismicSimulation.o:(.data+0x20): undefined reference to __T_Q2_3tbb4task' SeismicSimulation.cpp:(.data+0x2a0): undefined reference to tbb::task_group_context::__dt( (void))’
( plus a bunch more )

yet i can do an nm on libtbb.so and it has these symbols…
host 684> nm -C …/…/…/build/linux_em64t_pgi_cc4.3.3_libc2.3.4_kernel2.6.9_release/libtbb.so | grep tbb::__T_Q2_3tbb4task
00000000002267e0 d __T_Q2_3tbb4task

host 685> nm -C …/…/…/build/linux_em64t_pgi_cc4.3.3_libc2.3.4_kernel2.6.9_release/libtbb.so | grep tbb::task_group_context::__dt
0000000000013ab0 t tbb::task_group_context::__dt( (void))


what the heck is going on?!?

If i build pointing directly to the .o’s that formed the .so, it links fine, but there still seems to be some memory being corrupted somewhere.

Hi drnuke,

With PGI 2010, the PGI C++ compiler under went a major update in our front end. The change was necessary to enable better support for newer C++ extensions and BOOST. Unfortunately, these changes caused some incompatibilities with older linkers. We are aware the issue and should have a fix available soon. The work around, as you discovered, is to update your binutils.

I’ll need to investigate the shared library issue. I’ve built TBB in the past but needed make a few modifications since Intel hadn’t ported TBB for use with PGI. I’ll try to recreate your error and see I can find a solution.

  • Mat