[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] tcc and ruby

From: Joel VanderWerf
Subject: [Tinycc-devel] tcc and ruby
Date: Wed, 02 Jul 2003 17:47:47 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030617

I'm trying to use tcc to build ruby extensions, but outside of the simplest cases, loading the .so segfaults.

Here's an example:

void foo(void)

void Init_test_lib(void)
  int x;
  x = 0;
  x += 1;

I build it with:

  tcc -shared -rdynamic -g -o test_lib.so -I. \
    -I/usr/local/lib/ruby/1.7/i686-linux/ test_lib.c

and run ruby with:

  ruby -r test_lib -e 1

If I comment out the "foo" function, it loads ok. But with the "foo" function, I get:

  ./test_lib.so: [BUG] Segmentation fault
  ruby 1.7.3 (2002-12-20) [i686-linux]
  zsh: abort      ruby -r test_lib.so -e 1

GDB gives me the following information:

  (gdb) r -r test_lib.so -e 1
  Starting program: /home/local/bin/ruby -r test_lib.so -e 1

  Program received signal SIGSEGV, Segmentation fault.
  strcmp (p1=0x80028145 <Address 0x80028145 out of bounds>,
      p2=0x4001419e "__gmon_start__") at ../sysdeps/generic/strcmp.c:38
  38      ../sysdeps/generic/strcmp.c: No such file or directory.
          in ../sysdeps/generic/strcmp.c
  (gdb) bt
  #0  strcmp (p1=0x80028145 <Address 0x80028145 out of bounds>,
      p2=0x4001419e "__gmon_start__") at ../sysdeps/generic/strcmp.c:38
  #1  0x400078fa in do_lookup (undef_name=0x4001419e "__gmon_start__",
hash=256704639, ref=0x40014134, result=0xbfffeb40, scope=0x80028145, i=0,
      flags=1, skip=0x0, type_class=0) at do-lookup.h:99
#2 0x400067b6 in _dl_lookup_symbol (undef_name=0x4001419e "__gmon_start__", undef_map=0x81152a8, ref=0xbfffebc0, symbol_scope=0x8115444, type_class=0,
      flags=1) at dl-lookup.c:251
  Die: DW_TAG_formal_parameter (abbrev = 50, offset = 99530)
          has children: FALSE
                  DW_AT_name (DW_FORM_string) string: "sym"
                  DW_AT_decl_file (DW_FORM_data1) constant: 32
                  DW_AT_decl_line (DW_FORM_data2) constant: 508
                  DW_AT_type (DW_FORM_ref4) constant: 8703
  Dwarf Error: Cannot find type of die.

I've already asked Mitchell about this and the code worked for him, but with an old version of ruby. I've tried it with ruby versions 1.6.8, 1.7.3, and 1.8.0p3.

Any ideas?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]