[comp.unix.aix] Assembly language problem on RS/6000

brandis@inf.ethz.ch (Marc Brandis) (04/29/91)

I am trying to write an assembly language routine that I can assign to a
function pointer in C. There is no problem when calling the routine directly,
but assigning it to a pointer to a function causes a linker error with the
message, that the symbol 'my_routine' could not be resolved. Here is what I
wrote:

        .toc
        .globl  my_routine[ds]
        .csect  my_routine[ds]
        .long   .my_routine[PR]
        .long   TOC[tc0]
        .long   0
        .globl  .my_routine[PR]
        .csect  .my_routine[PR]

# here comes the routine itself
	stm	...


It looks like '.my_routine' becomes exported correctly, but not 'my_routine',
although it is declared as global. The IBM manuals were not a big help in
figuring out what is going wrong. I could imagine that something is wrong with
the section identifier [ds], but as the manuals imply, a procedure descriptor
belongs into a descriptor segment.

Any hints what is wrong or missing here? Thanks for any reply!


Marc-Michael Brandis
Computer Systems Laboratory, ETH-Zentrum (Swiss Federal Institute of Technology)
CH-8092 Zurich, Switzerland
email: brandis@inf.ethz.ch

	

prener@watson.ibm.com (Dan Prener) (05/01/91)

In article <28338@neptune.inf.ethz.ch>, brandis@inf.ethz.ch (Marc Brandis) writes:
|> I am trying to write an assembly language routine that I can assign to a
|> function pointer in C. There is no problem when calling the routine directly,
|> but assigning it to a pointer to a function causes a linker error with the
|> message, that the symbol 'my_routine' could not be resolved. Here is what I
|> wrote:
|> 
|>         .toc
|>         .globl  my_routine[ds]
|>         .csect  my_routine[ds]
|>         .long   .my_routine[PR]
|>         .long   TOC[tc0]
|>         .long   0
|>         .globl  .my_routine[PR]
|>         .csect  .my_routine[PR]
|> 
|> # here comes the routine itself
|> 	stm	...
|> 
|> 
|> It looks like '.my_routine' becomes exported correctly, but not 'my_routine',
|> although it is declared as global. The IBM manuals were not a big help in
|> figuring out what is going wrong. I could imagine that something is wrong with
|> the section identifier [ds], but as the manuals imply, a procedure descriptor
|> belongs into a descriptor segment.
|> 
|> Any hints what is wrong or missing here? Thanks for any reply!
|> 
|> 
|> Marc-Michael Brandis
|> Computer Systems Laboratory, ETH-Zentrum (Swiss Federal Institute of Technology)
|> CH-8092 Zurich, Switzerland
|> email: brandis@inf.ethz.ch

Your assembly code as such is fine.  How are you linking it, and how
are you calling it?
-- 
                                   Dan Prener (prener @ watson.ibm.com)