cflow and assembler sources

Marcus von Appen mva at
Thu Sep 20 15:33:58 PDT 2007


The flow graph generator for C source code is nearly done. Some minor
issues with the one or other construct still exist, but for most code it
should be stable enough. Tons of bugs were fixed and it can handle K&R
definitions now. You can get the latest version as always at

So far so good. Once it is done, assembler will be the next on my task
list. The standard however is pretty quiet about what should be
extracted from assembler sources and what not. Thus I'd like to have
your input about what should be determined as function definition and
call in assembler sources.

In the following I'm referring to the nasm syntax.

Anything within the '.data' and '.bss' segments could be treated as
global variables.  The 'call' directive would be clearly a function
call. 'global'ized labels would be functions definitions, 'extern'ed
handled as specified by the standard for undefined functions.

A short example:

        section .data
buf:  equ 32             ; global variable buf - shown with -i x flag
_bla: equ 32             ; global variable _bla - shown with -i x -i _ flag
        section .text

        extern foobar   ; extern function shown as 'foobar <>' on call

        global func1    ; function declaration
func1:                  ; output: 'func1: <bla.asm 7>'
        sub esp, buflen ; output: '      buflen <bla.asm 2>' if -i x is used
        call foobar     ; output: '      foobar: <>'
        call func2      ; output: '      func2: <bla.asm 14>'

        global func2

        global _func3   ; only shown if -i _ is used.

Further feedback on what should issue an entry within the graph (like
e.g. jmp) would be great :-).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-standards mailing list