cc and ld is not same ?


 
Thread Tools Search this Thread
Top Forums Programming cc and ld is not same ?
# 1  
Old 03-05-2002
cc and ld is not same ?

hello.
thank you of your last replay.

i programming c program in hp-9000 unix ,
after maked , occur follow warn :
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (main.o) was detected
. The linked output may not run on a PA 1.x system.


i donnot the warning if affect the program running.

now my program occur core in running .
# 2  
Old 03-06-2002
I don't really follow your question here. I hope that realize that cc and ld are different! When you let cc automatically invoke ld it does so correctly. If you ask cc not do do that and then invoke ld yourself, you can use lots of options. And you can create some more errors than are possible when cc invokes ld itself.

If you're asking if something is wrong, I would say yes, a core file when you run a program is a pretty good indication of that. Still the core file may or may not be related to the warning you got.

About that warning, somewhere, probably during the compile, you must have specified a different architecture. Don't do that unless you really must build a program on one hp system and then run it on a very different hp system. Let the compiler pick the architecture. You cannot upgrade your cpu with just a compiler option.
# 3  
Old 03-06-2002
Error my program occur core when running.

Hello.
Thank you very much for your answer in time.

my program is right running in SCO unix , but occur core running in HP-UNIX of HP 9000 machine . I bethink of your last time reply my question about #pragma pack() in include header file, say HP cpu not support data order when processing data,but in my program , have many similar the follow sentences:

iSerielNo = *(int *)(szReceiveBuf + 2);
or
*(int *)(szReceiveBuf + 2) = iSerielNo ;

I suppose HP 9000 machine not support this forcing evaluating sentence , occur core in running ?
# 4  
Old 03-06-2002
Error my program occur core when running.

Hello.
Thank you very much for your answer in time.

my program is right running in SCO unix , but occur core running in HP-UNIX of HP 9000 machine . I bethink of your last time reply my question about #pragma pack() in include header file, say HP cpu not support data order when processing data,but in my program , have many similar the follow sentences:

iSerielNo = *(int *)(szReceiveBuf + 2);
or
*(int *)(szReceiveBuf + 2) = iSerielNo ;

I suppose HP 9000 machine not support this forcing evaluating sentence , occur core in running ?

others , as:

fread( (ST_SYS *) &stSys , sizeof(ST_SYS) , 1, fp) ;

ST_SYS is a structure variable , may I use the using ?
# 5  
Old 03-07-2002
Code like that will probably result in a buss error on a 9000. You can promote a pointer to char to be a pointer to int and then dereference it. But only if the pointer is properly aligned. If you are using 32 bit ints, then an int is 4 bytes. That means that all ints must be aligned on a 4 byte boundary. To put that another way, if you divide the address by 4 you must get a remainder of zero. This restriction is enforced by the hardware.

That program looks like a mess. It might be better to discard it and write a new one.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question