Re: Importing C extern errno into HP-UX assembler
- From: marnol01@xxxxxxxxxxxx
- Date: Fri, 16 Nov 2007 21:38:30 -0800 (PST)
Super! The resulting assembler listing showed me how to fix up my
assembler subroutine.
Thanks!
Mike
Paul Pluzhnikov wrote:
marnol01@xxxxxxxxxxxx writes:.
I have tried many various .IMPORT statements and intsructions
to import the C extern errno variable into a PA-RISC assembler
procedure in order to modify errno from the assembler program.
So far, everything I've tried either has no effect or causes
the program to crash. This is for a PA-RISC 1.1 architecture.
I have a main.c where errno is defined with errno.h, and the
assembler subroutine which needs to be able to modify errno.
I assemble the procedure into a .o file, then use cc to compile
main.c and link it to the .o file. Does anyone have a fully
detailed example of what I need to do to accomplish this?
Compile the following code to assembly (with 'cc -S t.c'):
#include <errno.h>
void foo() { errno = 42; }
The resulting assembly is *exactly* what you need.
The proof:
$ cat t1.c
#include <errno.h>
int main()
{
foo();
printf("%d\n", errno);
return 0;
}
$ cc -S t.c && cc -c t.s && cc t1.c t.o && ./a.out
42
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
- References:
- Importing C extern errno into HP-UX assembler
- From: marnol01
- Re: Importing C extern errno into HP-UX assembler
- From: Paul Pluzhnikov
- Importing C extern errno into HP-UX assembler
- Prev by Date: Re: Importing C extern errno into HP-UX assembler
- Next by Date: Re: Data Protector 6.0 scheduling mysteries
- Previous by thread: Re: Importing C extern errno into HP-UX assembler
- Index(es):
Relevant Pages
|