Bug 35531 - Assembler failure while compiling libgcc
Summary: Assembler failure while compiling libgcc
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 36878 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-10 21:17 UTC by Bob Friesenhahn
Modified: 2010-12-09 01:41 UTC (History)
4 users (show)

See Also:
Host: i386-pc-solaris2.10
Target: i386-pc-solaris2.10
Build: i386-pc-solaris2.10
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Friesenhahn 2008-03-10 21:17:58 UTC
On an AMD64 (Opteron) system, the Solaris 10 assembler does not like what GCC produces.  This system has all patches applied for Solaris 10 U4. GCC 4.2.1 works very well on it.

Configured like:
/home/bfriesen/src/gnu/gcc-4.3.0/configure -program-suffix='-4.3.0' --enable-threads --enable-version-specific-runtime-libs --enable-languages='c,c++'

When compiling libgcc2.c this warning is produced for each compile:
"/tmp/bfriesen/ccK2JBM6.s", line 402 : Warning: Illegal subtraction - symbols from different sections: ".LFB2", ".DOT-1"

/home/bfriesen/build/gcc-4.3.0/./gcc/xgcc -B/home/bfriesen/build/gcc-4.3.0/./gcc/ -B/usr/local/i386-pc-solaris2.10/bin/ -B/usr/local/i386-pc-solaris2.10/lib/ -isystem /usr/local/i386-pc-solaris2.10/include -isystem /usr/local/i386-pc-solaris2.10/sys-include -g -fkeep-inline-functions -m64 -O2  -O2 -g -O2   -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED   -I. -I. -I../../.././gcc -I/home/bfriesen/src/gnu/gcc-4.3.0/libgcc -I/home/bfriesen/src/gnu/gcc-4.3.0/libgcc/. -I/home/bfriesen/src/gnu/gcc-4.3.0/libgcc/../gcc -I/home/bfriesen/src/gnu/gcc-4.3.0/libgcc/../include  -DHAVE_CC_TLS -o _gcov.o -MT _gcov.o -MD -MP -MF _gcov.dep -DL_gcov -c /home/bfriesen/src/gnu/gcc-4.3.0/libgcc/../gcc/libgcov.c
Assembler: libgcov.c
        "/tmp/bfriesen/ccZ3Azge.s", line 1936 : Syntax error
        Near line: "    repz cmpsb"
        "/tmp/bfriesen/ccZ3Azge.s", line 2976 : Warning: Illegal subtraction - symbols from different sections: ".LFB3", ".DOT-21"
        "/tmp/bfriesen/ccZ3Azge.s", line 2985 : Warning: Illegal subtraction - symbols from different sections: ".LFB5", ".DOT-22"
        "/tmp/bfriesen/ccZ3Azge.s", line 2994 : Warning: Illegal subtraction - symbols from different sections: ".LFB24", ".DOT-23"
        "/tmp/bfriesen/ccZ3Azge.s", line 3003 : Warning: Illegal subtraction - symbols from different sections: ".LFB22", ".DOT-24"
        "/tmp/bfriesen/ccZ3Azge.s", line 3032 : Warning: Illegal subtraction - symbols from different sections: ".LFB2", ".DOT-25"
        "/tmp/bfriesen/ccZ3Azge.s", line 3051 : Warning: Illegal subtraction - symbols from different sections: ".LFB4", ".DOT-26"
        "/tmp/bfriesen/ccZ3Azge.s", line 3070 : Warning: Illegal subtraction - symbols from different sections: ".LFB8", ".DOT-27"
        "/tmp/bfriesen/ccZ3Azge.s", line 3095 : Warning: Illegal subtraction - symbols from different sections: ".LFB18", ".DOT-28"
        "/tmp/bfriesen/ccZ3Azge.s", line 3120 : Warning: Illegal subtraction - symbols from different sections: ".LFB9", ".DOT-29"
        "/tmp/bfriesen/ccZ3Azge.s", line 3145 : Warning: Illegal subtraction - symbols from different sections: ".LFB12", ".DOT-30"
        "/tmp/bfriesen/ccZ3Azge.s", line 3170 : Warning: Illegal subtraction - symbols from different sections: ".LFB11", ".DOT-31"
        "/tmp/bfriesen/ccZ3Azge.s", line 3193 : Warning: Illegal subtraction - symbols from different sections: ".LFB10", ".DOT-32"
        "/tmp/bfriesen/ccZ3Azge.s", line 3216 : Warning: Illegal subtraction - symbols from different sections: ".LFB13", ".DOT-33"
        "/tmp/bfriesen/ccZ3Azge.s", line 3239 : Warning: Illegal subtraction - symbols from different sections: ".LFB14", ".DOT-34"
        "/tmp/bfriesen/ccZ3Azge.s", line 3266 : Warning: Illegal subtraction - symbols from different sections: ".LFB16", ".DOT-35"
        "/tmp/bfriesen/ccZ3Azge.s", line 3285 : Warning: Illegal subtraction - symbols from different sections: ".LFB15", ".DOT-36"
        "/tmp/bfriesen/ccZ3Azge.s", line 3304 : Warning: Illegal subtraction - symbols from different sections: ".LFB17", ".DOT-37"
        "/tmp/bfriesen/ccZ3Azge.s", line 3327 : Warning: Illegal subtraction - symbols from different sections: ".LFB7", ".DOT-38"
        "/tmp/bfriesen/ccZ3Azge.s", line 3350 : Warning: Illegal subtraction - symbols from different sections: ".LFB6", ".DOT-39"
        "/tmp/bfriesen/ccZ3Azge.s", line 3377 : Warning: Illegal subtraction - symbols from different sections: ".LFB21", ".DOT-40"
        "/tmp/bfriesen/ccZ3Azge.s", line 3410 : Warning: Illegal subtraction - symbols from different sections: ".LFB23", ".DOT-41"
gmake[5]: *** [_gcov.o] Error 1
gmake[5]: Leaving directory `/scratch/bfriesen/build/gcc-4.3.0/i386-pc-solaris2.10/amd64/libgcc'
Comment 1 Andrew Pinski 2008-03-10 21:22:42 UTC
I think even Sun recommends you use the GNU Assembler for x86_64 Solaris.
Comment 2 Bob Friesenhahn 2008-03-10 21:49:24 UTC
It seems (according to gcc -v) that GCC 4.2.1 re-configured itself to use:

/scratch/bfriesen/build/gcc-4.2.1/configure --program-suffix=-4.2.1 --enable-shared --enable-threads --enable-version-specific-runtime-libs --disable-nls --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-cpu=opteron --enable-languages=c,c++

so I just tried configuring with

/home/bfriesen/src/gnu/gcc-4.3.0/configure --program-suffix=-4.3.0 --enable-shared --enable-threads --enable-version-specific-runtime-libs --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-cpu=opteron --enable-languages=c,c++

and did get farther, but the final link fails like

/bin/bash /home/bfriesen/src/gnu/gcc-4.3.0/libgcc/../mkinstalldirs amd64
mkdir amd64
/home/bfriesen/build/gcc-4.3.0/./gcc/xgcc -B/home/bfriesen/build/gcc-4.3.0/./gcc/ -B/usr/local/i386-pc-solaris2.10/bin/ -B/usr/local/i386-pc-solaris2.10/lib/ -isystem /usr/local/i386-pc-solaris2.10/include -isystem /usr/local/i386-pc-solaris2.10/sys-include -O2  -O2 -g -O2   -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -shared -nodefaultlibs -Wl,-h,libgcc_s.so.1 -Wl,-z,text -Wl,-z,defs -Wl,-M,libgcc.map -o amd64/libgcc_s.so.1.tmp -g -fkeep-inline-functions -m64 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o unwind-dw2_s.o unwind-dw2-fde_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o -lc && rm -f amd64/libgcc_s.so && if [ -f amd64/libgcc_s.so.1 ]; then mv -f amd64/libgcc_s.so.1 amd64/libgcc_s.so.1.backup; else true; fi && mv amd64/libgcc_s.so.1.tmp amd64/libgcc_s.so.1 && ln -s libgcc_s.so.1 amd64/libgcc_s.so
ld: fatal: unwind table: file /home/bfriesen/build/gcc-4.3.0/./gcc/amd64/crtend.o: section .eh_frame: bad cie version 0: offset 0xfffffd7fffdfb220
Comment 3 Bob Friesenhahn 2008-03-10 23:05:48 UTC
By using 'as' and 'ld' from binutils-2.18, I have achieved a successful compile.  Using gas and the system linker was not sufficient since it resulted in the same error.  Based on past experience, I don't have a lot of faith in GNU ld under Solaris.  Has it substantially improved?

The final configuration incantation is:
/home/bfriesen/src/gnu/gcc-4.3.0/configure --program-suffix=-4.3.0 --enable-shared --enable-threads --enable-version-specific-runtime-libs --with-gnu-as --with-as=/usr/local/lib/binutils-2.18/bin/as --with-ld=/usr/local/lib/binutils-2.18/bin/ld --enable-languages=c,c++
Comment 4 Andrew Pinski 2008-03-10 23:20:38 UTC
I always hear the opposite way around, that is the Sun's assembler and linker are not that good.
Comment 5 Uroš Bizjak 2008-03-11 11:17:14 UTC
Any way, it is not gcc that fails here.
Comment 6 Bob Friesenhahn 2008-03-11 15:51:07 UTC
The previous GCC releases worked "out of the box" but 4.3.0 does not.  Give this, how can this bug report be "invalid"?  The configuration for Solaris 10 on x86 hardware has clearly degraded as compared to former releases.
Comment 7 Andrew Pinski 2008-03-11 15:53:36 UTC
http://gcc.gnu.org/install/specific.html#ix86-x-solaris210

It is recommended that you configure GCC to use the GNU assembler in /usr/sfw/bin/gas but the Sun linker, using the options --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld.

Comment 8 Uroš Bizjak 2008-03-11 16:20:09 UTC
(In reply to comment #7)
> http://gcc.gnu.org/install/specific.html#ix86-x-solaris210
> 
> It is recommended that you configure GCC to use the GNU assembler in
> /usr/sfw/bin/gas but the Sun linker, using the options --with-gnu-as
> --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld.

It looks that the documentation needs to be updated.


Comment 9 Bob Friesenhahn 2008-03-11 16:35:57 UTC
A documentation update will be suffient provided that binutils 'ld' adequately supports Solaris now.  However, I notice that there are may be some issues with code built/linked with the Sun linker and the binutils linker.  In particular, a static-linked Perl interpreter fails to dynamically load its own modules if it is built using 4.3.0, but works with 4.2.1 (which uses Sun linker).  I am not sure why this is yet. Perhaps the needed symbols are not entirely resolved.

I will be doing more testing today.
Comment 10 Andrew Pinski 2008-07-19 21:32:20 UTC
*** Bug 36878 has been marked as a duplicate of this bug. ***
Comment 11 marek.rouchal 2009-07-01 11:58:05 UTC
(In reply to comment #2)
> and did get farther, but the final link fails like
> ...
> ld: fatal: unwind table: file
> /home/bfriesen/build/gcc-4.3.0/./gcc/amd64/crtend.o: section .eh_frame: bad cie
> version 0: offset 0xfffffd7fffdfb220

I saw this, too with gcc-4.3.2 on Solaris 10 x86. The issue is described also in Bug 33100, which seems to be fixed in gcc-4.3.3. Furthermore, the linker error is supposed to be fixed with a Sun/Solaris patch: 139574-03 for SPARC and 139575-03 for x86 (quoted from Bug 33100).

-Marek
Comment 12 Bob Friesenhahn 2009-07-01 16:42:04 UTC
It seems that bugs gradually get fixed.  I am successfully using GCC 4.3.3 on the same system configure like:

/home/bfriesen/src/gnu/gcc-4.3.3/configure LDFLAGS='-L/usr/local/lib -R/usr/local/lib' --program-suffix=-4.3.3 --enable-shared --enable-threads --enable-version-specific-runtime-libs --with-gnu-as --with-as=/usr/local/lib/binutils-2.19/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-cpu=opteron --enable-languages=c,c++,fortran

Notice that I am using 'as' from a recent binutils release rather than the one which comes with Solaris.

Unfortunately, GCC 4.4.0 is not so luckly since it once again does not work with Solaris ld.  If GCC does not work with Solaris ld, then I can't use it.

Bob
Comment 13 Sean McGovern 2010-12-07 20:06:27 UTC
Since I have had successful builds of both 4.5.x and 4.6.x of gcc using current GNU binutils (2.20.1.x) and Sun ld, can this bug be closed?
Comment 14 Bob Friesenhahn 2010-12-09 01:41:25 UTC
(In reply to comment #13)
> Since I have had successful builds of both 4.5.x and 4.6.x of gcc using current
> GNU binutils (2.20.1.x) and Sun ld, can this bug be closed?

Yes, this bug can be closed.  I am using GCC 4.4.4 with GNU as and the Sun ld with no problems:

% gcc -v
Using built-in specs.
Target: i386-pc-solaris2.10
Configured with: /home/bfriesen/src/gnu/gcc-4.4.4/configure LDFLAGS='-L/usr/local/lib -R/usr/local/lib' --program-suffix=-4.4.4 --enable-shared --enable-threads --enable-version-specific-runtime-libs --with-gnu-as --with-as=/usr/local/lib/binutils-2.20/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local --with-cpu=opteron --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.4.4 (GCC)

Bob