From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078712011780.tru64-unix-managers.marc@archive.invalid> From: Gary George Date: Fri, 19 Jun 1998 16:31:27 +0000 To: tru64-unix-managers Subject: [Summary] Program linked with ld core dumps X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078712011780 Thanks guys! As usual, the list gives instant -- and instantly useful answers! The quick and easy answer came from: Joshua Rowe [rowe@eksystems.com] Anthony Talltree [aad@nwnet.net] Steve VanDevender [stevev@hexadecimal.uoregon.edu] Allan E Johannesen [aej@WPI.EDU] Ian Mortimer [ian@physics.uq.edu.au] Joe Spanicek [joe@resptk.bhp.com.au] Phil Farrell [farrell@pangea.Stanford.EDU] and that was to use the C compiler to do the linking: cc -c hello.c cc -o hello hello.o Stephan Zitz [Stephan_Zitz@tds.com] correctly pointed out that it was probably one of the crt?.o files missing. David Warren [warren@atmos.washington.edu] gave me the tool to diagnose it myself, using cc -v -o hello hello.c to see what the C compiler would set up as a link command. That gave the results: ld -o hello -g0 -O1 -call_shared /usr/lib/cmplrs/cc/crt0.o hello.o -lc Jim Zelenka [jz1j+@andrew.cmu.edu] suggested that I check for a bug in the code, but that's why I'd recreated the problem with the traditional hello program; there aren't too many bugs that can hide in four lines of C: #include void main() { printf("Hello world!\n"); } Again, thanks, everybody! Gary George, I.S.P. Systems Administrator 403-427-3512 > -----Original Message----- > From: Gary George [SMTP:GGeorge@edc.gov.ab.ca] > Sent: Thursday, June 18, 1998 4:31 PM > To: 'Alpha Managers' > Subject: Program linked with ld core dumps > > I have a bit of a problem ... a user actually wants to use the C > compiler, and the linker seems to be misbehaving. Even for a very > basic > 4-line "hello world" program, if he compiles and links as two separate > steps: > cc -c hello.c > ld -o hello hello.o -lc > hello > he gets the message: > Memory fault(coredump) > but if he compiles and links in a single step: > cc -o hello hello.c > hello > he gets a nice, clean execution. The goal of separate compilation and > linking is, of course, that he wants to build some libraries of common > routines. > > The commands look legitimate to me, but I've never programmed on this > platform. > > I will summarize the wisdom of group. > > Gary George, I.S.P. > Systems Administrator > 403-427-3512