Operating System - HP-UX
1832531 Members
8420 Online
110043 Solutions
New Discussion

info : cc compiler option

 
Kernel Tunable parmeter
Occasional Contributor

info : cc compiler option

Hi,
I have one ".c" program, in that program there is some "asm", code is also there while compiling the program I m getting below error.

ld: Unsatisfied symbol "asm" in file app_test.o

could you please tell, which cc "option" , I have to take to compile the asm code in ".c" program?

thanks
Manish
4 REPLIES 4
Steven Schweda
Honored Contributor

Re: info : cc compiler option

> [...] cc compiler option

Which C compiler? (What makes you think that
your C compiler is also a macro assembler for
whichever assembly language may be embedded
in this (mostly) C code?)

> I have one ".c" program, [...]

With my weak psychic powers, I can't see it
from here.

> while compiling the program

I can't see the command you used, either.

> I m getting below error.
>
> ld: Unsatisfied symbol "asm" in file
> app_test.o

As the message says, that complaint is coming
from "ld", not from the C compiler.
Kernel Tunable parmeter
Occasional Contributor

Re: info : cc compiler option

Hi Steven Schweda,

I have ".c" code , in which I have some asm code, plz find below

===========================================
char * allocBuf (long size)
{
long offset =
asm (
"10: ldq_l %t0, (%a0);" /* Load the offset pointer locked */
"bis %r31, %t0, %v0;" /* Save the original in the return register */
"addq %t0, %a1, %t0;" /* Increment the offset by the allocation size */
"40: stq_c %t0, (%a0);" /* Try to store it */
"beq %t0, 10b;", /* If zero, we failed, retry */
&dataOff, size);

return &dataBuf[offset];
}
==========================================

cc aap_test.c, I am getting that mentioned "ld: error for asm". could you please help to resolve this issue. I am on HP-UX IA system.
Steven Schweda
Honored Contributor

Re: info : cc compiler option

> asm (
> "10: ldq_l %t0, (%a0);" /* Load the offset pointer locked */
> [...]

Your code seems to me to call a function,
"asm", and pass it a bunch of character
strings. The C compiler, too, apparently
thinks that "asm" is a function.

> [...] "ld: error for asm".

In some places, quotation marks are used to
denote text which you are _not_ making up.
Returning to what may be the actual error
message, ...

> ld: Unsatisfied symbol "asm" [...]

Because you haven't supplied the function,
"asm". Apparently, "aap_test.c" (or whatever
it's called) is not a complete program in
itself. You should be able to avoid the
link error message by avoiding the linker:

cc -c whatever.c

But the result of that won't be executable.

What is this program, and why do you expect
it to work on your system?

> [...] I am on HP-UX IA system.

uname -a
Dennis Handly
Acclaimed Contributor

Re: info : cc compiler option

The compiler drivers on HP-UX will automatically pass .s files to as(1).
Code with asm must be ported to any new architecture. In your case you have inline assembly for Alpha? You'll have to either replace it by C code or convert to Itanium inline assembly functions, _Asm_*.

>Steven: that complaint is coming from "ld", not from the C compiler.

That's because it looks like a valid function call and Manish isn't using C99. :-(