Le Tue, 26 Feb 2008 20:56:32 +0200,
"Pekka Pessi" <[EMAIL PROTECTED]> a écrit :

> 2008/2/26, Alban Crequy <[EMAIL PROTECTED]>:
(...)
> >  Any suggestions to fix the problem ?
> 
> Check that you are linking correct runtime for your compiler.



> Could you generate asm with your GCC from a C file with function using
> non-zero array initializer like
> 
> #include <sofia-sip/su_tag.h>
> 
> tagi_t *tester(void)
> {
> tagi_t filter[2] = {{ NUTAG_ANY() }, { TAG_END() }};
> return tl_adup(NULL, filter);
> }
> 
> and post it? I wonder if the generated code does memcpy from data
> segment, for instance, or  initializes the array explicitly, and if
> there is some extra code that initializes the data segment in
> C++-manner, and if so, how it is supposed to be called (you might need
> to call such code explicitly).

I added the following function:

tagi_t *tester(void)
{
tagi_t filter[2] = {{ NUTAG_ANY() }, { TAG_END() }};
printf("%d\n", 0xdeadaaaa);
return tl_adup(NULL, filter);
}

I added the printf to find the function tester() in the disassembled
code.

and it generates the following code:
$ objdump -S -d -l -r --demangle test_nua.exe
  4010c0:       55                      push   %ebp
  4010c1:       89 e5                   mov    %esp,%ebp
  4010c3:       56                      push   %esi
  4010c4:       57                      push   %edi
  4010c5:       83 ec 10                sub    $0x10,%esp
  4010c8:       51                      push   %ecx
  4010c9:       8d 7c 24 04             lea    0x4(%esp),%edi
  4010cd:       b8 cc cc cc cc          mov    $0xcccccccc,%eax
  4010d2:       ab                      stos   %eax,%es:(%edi)
  4010d3:       ab                      stos   %eax,%es:(%edi)
  4010d4:       ab                      stos   %eax,%es:(%edi)
  4010d5:       ab                      stos   %eax,%es:(%edi)
  4010d6:       59                      pop    %ecx
  4010d7:       8d 7d e8                lea    -0x18(%ebp),%edi
  4010da:       be 44 84 51 00          mov    $0x518444,%esi
  4010df:       a5                      movsl  %ds:(%esi),%es:(%edi)
  4010e0:       a5                      movsl  %ds:(%esi),%es:(%edi)
  4010e1:       a5                      movsl  %ds:(%esi),%es:(%edi)
  4010e2:       a5                      movsl  %ds:(%esi),%es:(%edi)
  4010e3:       68 aa aa ad de          push   $0xdeadaaaa
  4010e8:       68 7e 84 51 00          push   $0x51847e
  4010ed:       e8 76 40 11 00          call   0x515168
  4010f2:       59                      pop    %ecx
  4010f3:       59                      pop    %ecx
  4010f4:       8d 45 e8                lea    -0x18(%ebp),%eax
  4010f7:       50                      push   %eax
  4010f8:       6a 00                   push   $0x0
  4010fa:       ff 15 60 ba 52 00       call   *0x52ba60
  401100:       59                      pop    %ecx
  401101:       59                      pop    %ecx
  401102:       89 c0                   mov    %eax,%eax
  401104:       8d 65 f8                lea    -0x8(%ebp),%esp
  401107:       5f                      pop    %edi
  401108:       5e                      pop    %esi
  401109:       5d                      pop    %ebp
  40110a:       c3                      ret    

I am not sure to understand, but it seems to initialize with the value
from $0x518444.

-- 
Alban

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to