libglib2.0-0 fails to build using dpkg-buildpackage when added "-flto" to CFLAGS and LDFLAGS

Bug #856839 reported by matt_hargett
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
binutils (Ubuntu)
Fix Released
Low
Unassigned
gcc-4.6 (Ubuntu)
Invalid
Low
Unassigned
glib2.0 (Ubuntu)
Invalid
Low
Unassigned

Bug Description

when using apt-get source libglib2.0-0, and adding -flto to the CFLAGS and LDFLAGS, the build fails with this:

./.libs/libglib-2.0.so: undefined reference to `__open_too_many_args'
./.libs/libglib-2.0.so: undefined reference to `__open_missing_mode'

which are errors generated by FORTIFY_SOURCE. it's currently unknown if these are true positives from FORTIFY_SOURCE that are somehow missed without LTO, or are false positives due to codegen issues when enabling LTO.

Revision history for this message
Julian Taylor (jtaylor) wrote :

the build fails with glib 2.29.92-0ubuntu1 gcc-4.6 4.6.1-9ubuntu3 and binutils 2.21.53.20110810-0ubuntu3 with flto applied to compilation and linking stage:
dpkg-buildpackage config
APPEND CFLAGS -flto
APPEND LDFLAGS -flto

See the attached buildlog

It succeeds without -flto.

When building with -U_FORTIFY_SOURCE the linking failure is solved but one gets this error:
gcc -DHAVE_CONFIG_H -I. -I/tmp/glib2.0-2.29.92/./glib/tests -I../.. -g -I../.. -I../../glib -I/tmp/glib2.0-2.29.92/./glib -I/tmp/glib2.0-2.29.92/. -DSRCDIR=\""/tmp/glib2.0-2.29.92/./glib/tests"\" -DG_ENABLE_DEBUG -DG_DISABLE_SINGLE_INCLUDES -pthread -g -O2 -flto -U_FORTIFY_SOURCE -Wall -c /tmp/glib2.0-2.29.92/./glib/tests/mem-overflow.c
/tmp/glib2.0-2.29.92/./glib/tests/mem-overflow.c:137:1: sorry, unimplemented: gimple bytecode streams do not support the optimization attribute

Revision history for this message
Julian Taylor (jtaylor) wrote :
affects: binutils (Ubuntu) → glib2.0 (Ubuntu)
Changed in glib2.0 (Ubuntu):
importance: Undecided → Low
Changed in gcc-4.6 (Ubuntu):
importance: Undecided → Low
Changed in binutils (Ubuntu):
importance: Undecided → Low
status: New → Confirmed
Changed in gcc-4.6 (Ubuntu):
status: New → Confirmed
Changed in glib2.0 (Ubuntu):
status: New → Confirmed
Revision history for this message
Julian Taylor (jtaylor) wrote :

compiling with gcc 4.7 snapshot leads to this issue: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50490

Revision history for this message
Matthias Klose (doko) wrote :

fixed in binutils 2.21.53.20110810-0ubuntu5

Changed in binutils (Ubuntu):
status: Confirmed → Fix Released
Changed in gcc-4.6 (Ubuntu):
status: Confirmed → Invalid
Changed in glib2.0 (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.