# link failure: defined in discarded section

**URL:** <https://forums.developer.nvidia.com/t/link-failure-defined-in-discarded-section/131217>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [February 19, 2009, 10:26pm UTC](https://forums.developer.nvidia.com/t/link-failure-defined-in-discarded-section/131217 "2009-02-19T22:26:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bphilip](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bphilip](https://forums.developer.nvidia.com/u/bphilip)\
**Post date:** [February 19, 2009, 10:26pm UTC](https://forums.developer.nvidia.com/t/link-failure-defined-in-discarded-section/131217/1 "2009-02-19T22:26:27Z")

</div>

Hi:

I am trying to link a C++ code on an Ubuntu linux which does have a large number of template instantiations. If I use g++ (4.2.3) on linux then the code links just fine. Using pgCC 7.2-3 the code gives me the link errors  
listed at the botom. Here are the compile and link lines:

mpicxx -g -DMPICH\_IGNORE\_CXX\_SEEK -DMPICH\_SKIP\_MPICXX -DNDIM=3 -g -DMPICH\_IGNORE\_CXX\_SEEK -DMPICH\_SKIP\_MPICXX -I. -I/packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/include -I/packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/include -I/packages/petsc/petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/include -I/packages/petsc/petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/include/private -I/packages/hypre/hypre-2.0.0-mpich2-1.0.6p1-pgi-7.2-3-debug/include -I/packages/hdf/hdf5-1.6.7-mpich2-1.0.6p1-pgi-7.2-3-debug/include -I/packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/include -DNDIM=3 -I/netscratch/bphilip/projects/utils/include -c testInterpolation.C -o testInterpolation.o

mpicxx -g -DMPICH\_IGNORE\_CXX\_SEEK -DMPICH\_SKIP\_MPICXX -DNDIM=3 -L/packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/petsc/petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/hypre/hypre-2.0.0-mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/hdf/hdf5-1.6.7-mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/lib -R /packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/nh/vendor/Linux/pgi/Ubuntu8.04-AMD64/PGI\_Server-7.2-3/linux86-64/7.2-3/lib -R /nh/vendor/Linux/pgi/Ubuntu8.04-AMD64/PGI\_Server-7.2-3/linux86-64/7.2-3/lib -L/usr/lib64 -R /usr/lib64 -L/usr/lib/gcc/x86\_64-linux-gnu/4.2.3 -R /usr/lib/gcc/x86\_64-linux-gnu/4.2.3 testInterpolation.o BogusTagAndInitStrategy.o  
/netscratch/bphilip/projects/utils/lib/libAMRUtils3d.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_appu.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_algs.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_solv.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_geom.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_mesh.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_math\_std.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_pdat\_std.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_xfer.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_hier.a /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI.a -L/packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/petsc/petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/hypre/hypre-2.0.0-mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/hdf/hdf5-1.6.7-mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/lib -R /packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/lib -L/nh/vendor/Linux/pgi/Ubuntu8.04-AMD64/PGI\_Server-7.2-3/linux86-64/7.2-3/lib -R /nh/vendor/Linux/pgi/Ubuntu8.04-AMD64/PGI\_Server-7.2-3/linux86-64/7.2-3/lib -L/usr/lib64 -R /usr/lib64 -L/usr/lib/gcc/x86\_64-linux-gnu/4.2.3 -R /usr/lib/gcc/x86\_64-linux-gnu/4.2.3 -lpetsccontrib -lpetscksp -lpetscsnes -lpetscdm -lpetscts -lpetscmat -lpetscvec -lpetsc -lHYPRE\_sstruct\_ls -lHYPRE\_sstruct\_mv -lHYPRE\_struct\_ls -lHYPRE\_struct\_mv -lHYPRE\_parcsr\_ls -lHYPRE\_DistributedMatrixPilutSolver -lHYPRE\_ParaSails -lHYPRE\_Euclid -lHYPRE\_MatrixMatrix -lHYPRE\_DistributedMatrix -lHYPRE\_IJ\_mv -lHYPRE\_parcsr\_mv -lHYPRE\_seq\_mv -lHYPRE\_krylov -lHYPRE\_utilities -lhdf5 -llapack -lblas -lz -ldl -lSM -lICE -lX11 -L/usr/lib/gcc/x86\_64-linux-gnu/4.2.3 -L/usr/lib64 -L/nh/vendor/Linux/pgi/Ubuntu8.04-AMD64/PGI\_Server-7.2-3/linux86-64/7.2-3/lib -L/packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/lib -lmpichf90 -lmpich -lpthread -lrt -lpgf90 -lpgf90\_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lnspgc -lpgc -lm -lgcc -o testInterpolation

The output of mpicxx -show is:  
pgCC -I/packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/include -L/packages/mpi/mpich2-1.0.6p1-pgi-7.2-3-debug/lib -lmpichcxx -lmpich -lpthread -lrt

The output of ld -v is:  
GNU ld (GNU Binutils for Ubuntu) 2.18.0.20080103

The link errors I get are:

`.gnu.linkonce.t. __CPR236__ getReverseRotationIdentifier __Q3_6SAMRAI4hier40MultiblockPatchHierarchy__ tm __9_XCiL_1_3SFQ4_J33JJ40J36MultiblockPatchHierarchy__ tm__5_XZ1Z18RotationIdentifier_QJ90JMRAIJ40JJ104JJ142J' referenced in section `.data’ of /netscratch/bphilip/projects/utils/lib/libAMRUtils3d.a(RefinementBoundaryInterpolation-template-inst.o): defined in discarded section `.gnu.linkonce.t.__CPR236 __getReverseRotationIdentifier__ Q3_6SAMRAI4hier40MultiblockPatchHierarchy __tm__ 9_XCiL_1_3SFQ4_J33JJ40J36MultiblockPatchHierarchy __tm__ 5_XZ1Z18RotationIdentifier_QJ90JMRAIJ40JJ104JJ142J' of /netscratch/bphilip/projects/utils/lib/libAMRUtils3d.a(RefinementBoundaryInterpolation-template-inst.o) `.gnu.linkonce.t.\_\_CPR236\_\_getReverseRotationIdentifier\_\_Q3\_6SAMRAI4hier40MultiblockPatchHierarchy\_\_tm\_\_9\_XCiL\_1\_3SFQ4\_J33JJ40J36MultiblockPatchHierarchy\_\_tm\_\_5\_XZ1Z18RotationIdentifier\_QJ90JMRAIJ40JJ104JJ142J’ referenced in section `.data' of /netscratch/bphilip/projects/utils/lib/libAMRUtils3d.a(HierarchyBoundaryFragments.o): defined in discarded section `.gnu.linkonce.t.\_\_CPR236\_\_getReverseRotationIdentifier\_\_Q3\_6SAMRAI4hier40MultiblockPatchHierarchy\_\_tm\_\_9\_XCiL\_1\_3SFQ4\_J33JJ40J36MultiblockPatchHierarchy\_\_tm\_\_5\_XZ1Z18RotationIdentifier\_QJ90JMRAIJ40JJ104JJ142J’ of /netscratch/bphilip/projects/utils/lib/libAMRUtils3d.a(HierarchyBoundaryFragments.o)  
`.gnu.linkonce.t. __CPR236__ getReverseRotationIdentifier __Q3_6SAMRAI4hier40MultiblockPatchHierarchy__ tm __9_XCiL_1_3SFQ4_J33JJ40J36MultiblockPatchHierarchy__ tm__5_XZ1Z18RotationIdentifier_QJ90JMRAIJ40JJ104JJ142J' referenced in section `.data’ of /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_algs.a(tbox\_\_Pointer-algs\_\_HyperbolicLevelIntegrator-NDIM3.o): defined in discarded section `.gnu.linkonce.t.__CPR236 __getReverseRotationIdentifier__ Q3_6SAMRAI4hier40MultiblockPatchHierarchy __tm__ 9_XCiL_1_3SFQ4_J33JJ40J36MultiblockPatchHierarchy __tm__ 5_XZ1Z18RotationIdentifier_QJ90JMRAIJ40JJ104JJ142J' of /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d_algs.a(tbox __Pointer-algs__ HyperbolicLevelIntegrator-NDIM3.o) `.gnu.linkonce.t.\_\_CPR236\_\_getReverseRotationIdentifier\_\_Q3\_6SAMRAI4hier40MultiblockPatchHierarchy\_\_tm\_\_9\_XCiL\_1\_3SFQ4\_J33JJ40J36MultiblockPatchHierarchy\_\_tm\_\_5\_XZ1Z18RotationIdentifier\_QJ90JMRAIJ40JJ104JJ142J’ referenced in section `.data' of /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d_pdat_std.a(tbox __Pointer-pdat__ CellDataFactory-NDIM_double3.o): defined in discarded section `.gnu.linkonce.t.\_\_CPR236\_\_getReverseRotationIdentifier\_\_Q3\_6SAMRAI4hier40MultiblockPatchHierarchy\_\_tm\_\_9\_XCiL\_1\_3SFQ4\_J33JJ40J36MultiblockPatchHierarchy\_\_tm\_\_5\_XZ1Z18RotationIdentifier\_QJ90JMRAIJ40JJ104JJ142J’ of /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_pdat\_std.a(tbox\_\_Pointer-pdat\_\_CellDataFactory-NDIM\_double3.o)  
`.gnu.linkonce.t. __CPR236__ getReverseRotationIdentifier __Q3_6SAMRAI4hier40MultiblockPatchHierarchy__ tm __9_XCiL_1_3SFQ4_J33JJ40J36MultiblockPatchHierarchy__ tm__5_XZ1Z18RotationIdentifier_QJ90JMRAIJ40JJ104JJ142J' referenced in section `.data’ of /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_pdat\_std.a(tbox\_\_Pointer-pdat\_\_CellDataFactory-NDIM\_int3.o): defined in discarded section `.gnu.linkonce.t.\_\_CPR236\_\_getReverseRotationIdentifier\_\_Q3\_6SAMRAI4hier40MultiblockPatchHierarchy\_\_tm\_\_9\_XCiL\_1\_3SFQ4\_J33JJ40J36MultiblockPatchHierarchy\_\_tm\_\_5\_XZ1Z18RotationIdentifier\_QJ90JMRAIJ40JJ104JJ142J’ of /packages/samrai/SAMRAI-v2.3.0-petsc-dev-mpich2-1.0.6p1-pgi-7.2-3-debug/lib/libSAMRAI3d\_pdat\_std.a(tbox\_\_Pointer-pdat\_\_CellDataFactory-NDIM\_int3.o)

I would appreciate your help!

---

<div class="post-metadata">

**Author:** ![Deborah\_Caruso](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Deborah\_Caruso](https://forums.developer.nvidia.com/u/Deborah_Caruso)\
**Post date:** [February 19, 2009, 11:57pm UTC](https://forums.developer.nvidia.com/t/link-failure-defined-in-discarded-section/131217/2 "2009-02-19T23:57:18Z")

</div>

bphilip -

We have seen this bug before(filed as FS4013). Some versions of the gnu linker seem  
to get confused when handling the references from the .data sections into the  
.linkonce sections.

These references are valid code, and they happen often with our implementation of  
C++ templates. g++ may not run into this problem because their internal implemetation is slightly different.

If you can update to a newer version of g++ , you may see this gnu linker bug disappear.

---

<div class="post-metadata">

**Author:** ![bphilip](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bphilip](https://forums.developer.nvidia.com/u/bphilip)\
**Post date:** [February 20, 2009, 3:38pm UTC](https://forums.developer.nvidia.com/t/link-failure-defined-in-discarded-section/131217/3 "2009-02-20T15:38:16Z")

</div>

Deborah:

Thanks for your response. Are you suggesting I update my version of g++ or my version of binutils?

Bobby

---

<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 20, 2009, 9:51pm UTC](https://forums.developer.nvidia.com/t/link-failure-defined-in-discarded-section/131217/4 "2009-02-20T21:51:46Z")

</div>

Hi Bobby,

I asked Deb and she meant for you to try updating your binutils.

- Mat

---

<div class="post-metadata">

**Author:** ![Deborah\_Caruso](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Deborah\_Caruso](https://forums.developer.nvidia.com/u/Deborah_Caruso)\
**Post date:** [April 9, 2009, 11:06pm UTC](https://forums.developer.nvidia.com/t/link-failure-defined-in-discarded-section/131217/5 "2009-04-09T23:06:23Z")

</div>

We’ve found the issue, and it should be fixed for the next release.

C++ templated functions that contained large switch statements caused  
the error for newer version of the gnu linker.  
We have fixed our method of generation to be compatible with gnu’s new  
requirements.

Thank you for your patience.  
-Deborah Caruso
