gcc doesn't pass stdout to ld?

Ian Lance Taylor ian@cygnus.com
Fri Dec 5 09:20:00 GMT 1997


   From: Neal Becker <neal@ctd.comsat.com>
   Date: Fri, 5 Dec 1997 10:53:37 -0500

   With gcc-2.7.2, I used to do:

   /usr/local/m68k/m68k-unknown-coff/bin/gcc -m68000 -msoft-float -T
   flash.ld -o rcv -v apps/crt0.o apps/main.o apps/init.o apps/jumptbl.o
   version.o -Lapps -lapps -Lapi -lapi -Lscc -lscc -Lccube -lccube
   -Ldemod -ldemod -Lperipher -lperipher -Lrf -lrf -Llibgloss -lgloss -u
   main -lm -lc -lgloss -nostartfiles -Wl,-M > map

   To get a map file.  It appears that egcs-1.0 doesn't pass the stdout
   to ld, because now the map is written not to the redirected "map", but 
   to my terminal.  Any reason for the change?  A workaround?

This is due to a change in collect2.  I consider it to be a bug; it
causes problems other than the one you mention.

The bug is that tlink_execute redirects all linker output to both
stdout and stderr into a file.  It then examines the file, and writes
it to stderr.  The effect is that all output the linker sends to
stdout gets redirected to stderr.

The fix is presumably to redirect and examine stdout and stderr
separately.

One work around you can use is -Wl,-Map,map.

Ian



More information about the Gcc mailing list