# load problem w/.text defined in discarded

**URL:** <https://forums.developer.nvidia.com/t/load-problem-w-text-defined-in-discarded/131592>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [February 23, 2010, 4:46pm UTC](https://forums.developer.nvidia.com/t/load-problem-w-text-defined-in-discarded/131592 "2010-02-23T16:46:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![drnuke](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@drnuke](https://forums.developer.nvidia.com/u/drnuke)\
**Post date:** [February 23, 2010, 4:46pm UTC](https://forums.developer.nvidia.com/t/load-problem-w-text-defined-in-discarded/131592/1 "2010-02-23T16:46:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![drnuke](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@drnuke](https://forums.developer.nvidia.com/u/drnuke)\
**Post date:** [February 23, 2010, 6:32pm UTC](https://forums.developer.nvidia.com/t/load-problem-w-text-defined-in-discarded/131592/2 "2010-02-23T18:32:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![drnuke](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@drnuke](https://forums.developer.nvidia.com/u/drnuke)\
**Post date:** [February 23, 2010, 9:31pm UTC](https://forums.developer.nvidia.com/t/load-problem-w-text-defined-in-discarded/131592/3 "2010-02-23T21:31:08Z")

</div>

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?!?

---

<div class="post-metadata">

**Author:** ![drnuke](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@drnuke](https://forums.developer.nvidia.com/u/drnuke)\
**Post date:** [February 23, 2010, 10:06pm UTC](https://forums.developer.nvidia.com/t/load-problem-w-text-defined-in-discarded/131592/4 "2010-02-23T22:06:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [February 24, 2010, 6:18pm UTC](https://forums.developer.nvidia.com/t/load-problem-w-text-defined-in-discarded/131592/5 "2010-02-24T18:18:30Z")

</div>

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
