#718047 ia64, ld segfault on --as-needed

Package:
binutils
Source:
binutils
Description:
GNU assembler, linker and binary utilities
Submitter:
Mathieu Malaterre
Date:
2026-08-13 17:37:08 UTC
Severity:
normal
Tags:
#718047#5
Date:
2013-07-28 07:46:05 UTC
From:
To:
Package gdcm fails to build on ia64. Errors is:

Linking CXX shared library ../../bin/libvtkgdcm.so
cd /build/buildd-gdcm_2.2.4-1-ia64-JJJW9m/gdcm-2.2.4/obj-ia64-linux-gnu/Utilities/VTK && /usr/bin/cmake -E cmake_link_script CMakeFiles/vtkgdcm.dir/link.txt --verbose=1
/usr/bin/c++  -fPIC -g -O2 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -DNDEBUG  -Wno-deprecated  -Wl,--as-needed  -shared -Wl,-soname,libvtkgdcm.so.2.2 -o ../../bin/libvtkgdcm.so.2.2.4 CMakeFiles/vtkgdcm.dir/vtkGDCMTesting.cxx.o CMakeFiles/vtkgdcm.dir/vtkGDCMImageReader.cxx.o CMakeFiles/vtkgdcm.dir/vtkGDCMImageWriter.cxx.o CMakeFiles/vtkgdcm.dir/vtkGDCMMedicalImageProperties.cxx.o CMakeFiles/vtkgdcm.dir/vtkImageMapToWindowLevelColors2.cxx.o CMakeFiles/vtkgdcm.dir/vtkImageYBRToRGB.cxx.o CMakeFiles/vtkgdcm.dir/vtkImageRGBToYBR.cxx.o CMakeFiles/vtkgdcm.dir/vtkGDCMPolyDataReader.cxx.o CMakeFiles/vtkgdcm.dir/vtkGDCMPolyDataWriter.cxx.o CMakeFiles/vtkgdcm.dir/vtkRTStructSetProperties.cxx.o CMakeFiles/vtkgdcm.dir/vtkLookupTable16.cxx.o CMakeFiles/vtkgdcm.dir/vtkImageMapToColors16.cxx.o CMakeFiles/vtkgdcm.dir/vtkImageColorViewer.cxx.o CMakeFiles/vtkgdcm.dir/vtkGDCMThreadedImageReader2.cxx.o CMakeFiles/vtkgdcm.dir/vtkgdcmInstantiator.cxx.o ../../bin/libgdcmMSFF.so.2.2.4 /us
 r/lib/li
 bvtkCommon.so.5.8.0 /usr/lib/libvtkIO.so.5.8.0 /usr/lib/libvtkImaging.so.5.8.0 /usr/lib/libvtkRendering.so.5.8.0 -lpthread ../../bin/libgdcmDICT.so.2.2.4 ../../bin/libgdcmIOD.so.2.2.4 ../../bin/libgdcmDSED.so.2.2.4 ../../bin/libgdcmCommon.so.2.2.4 /usr/lib/libvtkIO.so.5.8.0 /usr/lib/libvtkImaging.so.5.8.0 /usr/lib/libvtkGraphics.so.5.8.0 /usr/lib/libvtkFiltering.so.5.8.0 /usr/lib/libvtkCommon.so.5.8.0 /usr/lib/libvtksys.so.5.8.0 -ldl -lm -Wl,-rpath-link,/build/buildd-gdcm_2.2.4-1-ia64-JJJW9m/gdcm-2.2.4/obj-ia64-linux-gnu/bin
collect2: ld terminated with signal 11 [Segmentation fault]
/usr/bin/ld: BFD (GNU Binutils for Debian) 2.23.52.20130722 assertion fail elf64-ia64.c:2723
make[3]: *** [bin/libvtkgdcm.so.2.2.4] Error 1
make[3]: Leaving directory `/build/buildd-gdcm_2.2.4-1-ia64-JJJW9m/gdcm-2.2.4/obj-ia64-linux-gnu'

ref:
https://buildd.debian.org/status/fetch.php?pkg=gdcm&arch=ia64&ver=2.2.4-1&stamp=1374928496

#718047#14
Date:
2013-08-25 10:18:05 UTC
From:
To:
retitle 718047 ia64, ld segfault on --as-needed
found 718047 2.23.52.20130727-1
tags 718047 - sid jessie
thanks

ia64.

The gdcm package isn't the only one which is affected by that ld bug.
Another example is the iceweasel 17.0.8esr-1 package; ld crashes on
the test suite.

The bug is triggered by the --as-needed switch.

The problem is in bfd/elflink.c in the function elf_link_add_object_symbols().
When an input file is linked with the ---as-needed in effect, the
elf_link_add_object_symbols() function
(1) clones the symbol table;
(2) adds the new information
(3) restores the symbol table if it turns out that the new input is
*not* needed.

The problem is that on bullet (2) things are modified that aren't
restored on bullet (3).
The main problem is that elf_link_add_object_symbols() calls the
*bed->elf_backend_copy_indirect_symbol()
function both directly and in a nested way on some calls of
_bfd_elf_merge_symbol().
elf_backend_copy_indirect_symbol is elfNN_ia64_hash_copy_indirect() on
ia64 (in /bfd/elfnn-ia64.c).
elfNN_ia64_hash_copy_indirect() moves the info about the usage of
dynamic symbols from one symbol to another; it is an array of struct
elfNN_ia64_link_hash_entry in separately allocated memory.
It sets the ->info member of the symbol to NULL and adjusts the ->h
member of all dynamic symbols to the target symbol.
When elf_link_add_object_symbols() restores the symbol table (3), the
->info member (which was NULL) is set to the former array of dynamic
symbols, but the ->h members of the dynmaic symbols point to another
symbol.
The other symbol is deleted (freed memory); when the implementation
walks through the symbols in a later stage, the crash occurs. (The
failed assert is just a side effect.)

There is another thing which is modified on (2) but isn't restored on (3):
The bfd_elf_link_record_dynamic_symbol() function is called, which may
add a new string to the string table via _bfd_elf_strtab_add().
Since the string table isn't restored by elf_link_add_object_symbols
(3), the result is a failing assert on writing out the string table on
a later stage:
bfd/elf-strtab.c:273:
       BFD_ASSERT (tab->array[i]->refcount == 0);


I think we should talk with the upstream about the problem because I
don't have a good idea how to fix it at the moment.
Comments are appreciated.

Stephan

#718047#27
Date:
2013-09-03 06:35:18 UTC
From:
To:
affects 718047  + src:vxl
thanks

I think this also affects VXL:

https://buildd.debian.org/status/fetch.php?pkg=vxl&arch=ia64&ver=1.17.0-6&stamp=1378127208

Linking CXX shared library ../../../lib/libvipl.so
cd /«PKGBUILDDIR»/obj-ia64-linux-gnu/contrib/tbl/vipl &&
/usr/bin/cmake -E cmake_link_script CMakeFiles/vipl.dir/link.txt
--verbose=1
/usr/bin/c++  -fPIC -g -O2 -Wformat -Werror=format-security
-D_FORTIFY_SOURCE=2    -Wl,--as-needed  -shared
-Wl,-soname,libvipl.so.1.17 -o ../../../lib/libvipl.so.1.17.0
CMakeFiles/vipl.dir/filter/vipl_filter_abs.o
../../../lib/libvil.so.1.17.0 ../../../lib/libvil1.so.1.17.0
../../../lib/libvnl.so.1.17.0 ../../../lib/libvbl.so.1.17.0 -lgeotiff
../../../lib/libdcmtk.so.1.17.0 ../../../lib/libopenjpeg2.so.2.0.0
-ljpeg -ltiff -lpng -lz ../../../lib/libvcl.so.1.17.0 -lm
-Wl,-rpath,/«PKGBUILDDIR»/obj-ia64-linux-gnu/lib:
collect2: ld terminated with signal 11 [Segmentation fault]
make[3]: *** [lib/libvipl.so.1.17.0] Error 1
make[3]: Leaving directory `/«PKGBUILDDIR»/obj-ia64-linux-gnu'
make[2]: *** [contrib/tbl/vipl/CMakeFiles/vipl.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....

#718047#34
Date:
2013-09-17 08:56:15 UTC
From:
To:
filing this report with this severity, for a non-working non-default option
seems to be wrong.

not including the object files (including the shared objects) doesn't help,
these are missing in the upstream report as well.

#718047#43
Date:
2013-09-18 08:53:53 UTC
From:
To:
https://wiki.debian.org/qa.debian.org/FTBFS

This is also a recommended flag AFAIK:
https://wiki.debian.org/HardeningWalkthrough

I am missing your point here. Ideally what should I report upstream ?

Thanks.

#718047#54
Date:
2014-01-17 20:21:27 UTC
From:
To:
affects 718047 + src:ogre-1.9 src:openscenegraph
stop

This affects ogre-1.9 (see fix below [1]) and openscenegraph uploaded
recently [2].


[1] http://anonscm.debian.org/gitweb/?p=pkg-games/ogre-1.9.git;a=commitdiff;h=23eb0ca4fac15f5b300c82be130e729deda4cdc9#patch3

[2] https://buildd.debian.org/status/fetch.php?pkg=openscenegraph&arch=ia64&ver=3.2.0%7Erc1-2&stamp=1389850577

#718047#61
Date:
2014-09-12 15:59:58 UTC
From:
To:
IA64 has been removed from jessie. No way it is coming back. closing.

ref:
https://lists.debian.org/debian-devel-announce/2014/01/msg00009.html