This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bad ld option -M during build of gcc ?


Hello,

I might have found a bug in the build of gcc 3.2.2 for Sun Solaris.

Having a rather old version of gcc installed (it was 2.95), I decided to update it. I updated firstly binutils and bison to current versions (binutils-2.9.1 and bison-1.875).

OS is Sun Solaris 2.6.

During the build of gcc shared libraries, I have an error from ld in the following command:
/gnu/src/gcc-3.2.2/gcc/xgcc -B/gnu/src/gcc-3.2.2/gcc/ -B/gnu/sparc-sun-solaris2.6/bin/ -B/gnu/sparc-sun-solaris2.6/lib/ -isystem /gnu/sparc-sun-solaris2.6/include -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -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/./libgcc.map -o libgcc_s.so.1 libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_exit.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde.o libgcc/./unwind-sjlj.o -lc && rm -f libgcc_s.so && ln -s libgcc_s.so.1 libgcc_s.so


ld complains that libgcc.map has not a good format and tries without success to use it as ld script. The problem should be in the option: -Wl,-M,libgcc/./libgcc.map

gcc -Wl passes the rest of the options to ld. I checked the -M option of ld, it says :
$ ld --version
GNU ld 2.9.1
$ld --help
...
-M, --print-map Print map file on standard output
...
-Map FILE Write a map file


=> My conclusion is that -M should have no parameter, while the build script expects to write the map file into libgcc.map. If this is right, the correct option should be:
-Wl,-Map,libgcc/./libgcc.map


=> I changed the file gcc/config/t-slibgcc-sld where this options is defined (if I am not wrong):
SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
-Wl,-h,$(SHLIB_SONAME) -Wl,-z,text -Wl,-z,defs \
-Wl,*-Map*,$(SHLIB_MAP) -o $(SHLIB_NAME) \
@multilib_flags@ $(SHLIB_OBJS) -lc && \
rm -f $(SHLIB_SOLINK) && \
$(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK)


I restarted the build from the beginning (make distclean; ./configure; make bootstrap) and it seems to work.

Hope that this helps,
Michel



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]