Re: exporting struct offsets to assembler

From: Philipp Rumpf (prumpf@parcelfarce.linux.theplanet.co.uk)
Date: Sat Aug 05 2000 - 00:21:51 EDT

  • Next message: Andrew Morton: "Re: exporting struct offsets to assembler"

    On Sat, Aug 05, 2000 at 12:27:42PM +1000, Andrew Morton wrote:
    > It uses some compiler tricks to export the structure offset
    > into a global absolute symbol and uses that symbol in the
    > assembly code.

    So it introduces bogus symbols into System.map.

    >
    > This _should_ be arch-independent, but there is one potential

    What's the point ? The assembly isn't architecture-independent anyway.

    > This can be avoided if the assembler is smart enough with
    >
    > move some_label:b(a0),d0
    >
    > but I don't know if gas does that.

    Or it can be avoided by using a header file that #defines the offsets -
    which is exactly what mips does and other architectures did until some
    time ago. See arch/mips/tools/offset.c.

    I think it would be a better idea to generate the offsets automatically
    and possibly in an architecture-independent way without falling back to
    using symbols.

    > --- linux-2.4.0-test6-pre2/kernel/ksyms.c Sun Jul 30 02:28:18 2000
    > +++ linux-akpm/kernel/ksyms.c Sat Aug 5 12:09:15 2000
    > @@ -540,3 +540,21 @@
    >
    > EXPORT_SYMBOL(tasklist_lock);
    > EXPORT_SYMBOL(pidhash);
    > +
    > +
    > +#define OFFSETOF(struct_name, item) ((unsigned long)&(((struct struct_name *)0)->item))

    offsetof is in linux/stddef.h.

            Philipp Rumpf

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Aug 05 2000 - 00:26:21 EDT