#27 offsetof macro on Linux 2.6.9 needs to be __builtin_offsetof

closed-fixed
David Gay
ncc (18)
5
2006-05-19
2006-02-11
Chad Metcalf
No

This is discussed on the TinyOS Help list:

https://mail.millennium.berkeley.edu/pipermail/tinyos-help/2005-September/012275.html
https://mail.millennium.berkeley.edu/pipermail/tinyos-help/2005-September/012219.html

I'm running Ubuntu with kernel 2.6.12-10-386 and gcc
3.3, 3.4, and 4.0.2. I changed c-parse.gperf as
indicated and $TOSROOT/tools/java/net/tinyos/sim
finally built correctly for me. I tested TOSSIM with
simple apps (Blink, CntToLedAndRfm, etc) and it seems
to work fine.

I've attached a patch for 1.2.4. I know you aren't
going to want to include the patch because it will
break on Windows, apparently non 2.6.9 kernels of
Linux, and others.

But I wasn't sure how you would want to setup the
conditional in c-parse.gperf. Or even if you'd want to
fix it at all as opposed to mentioning a patch. If you
do want to do it I'd be willing to do the work if you
want to tell me what method you want used.

I'd just like to get the patch more visable. Google is
great but making the answers easy to find is great too. :)

Discussion

  • Chad Metcalf
    Chad Metcalf
    2006-02-11

    offsetof to __builtin_offsetof patch

     
  • David Gay
    David Gay
    2006-05-19

    • status: open --> closed-fixed
     
  • David Gay
    David Gay
    2006-05-19

    Logged In: YES
    user_id=398311

    I incorporated this in the current CVS, it will show up in
    1.2.5 (well, actually, it now accepts both offsetof and
    __builtin_offsetof)

    At some future date, it might be necessary to change
    make_offsetof (in expr.c), as it rewrites offsetof to the
    usual macro expansion...