including headers in linker script - Linux

This is a discussion on including headers in linker script - Linux ; Hi, I want to refer to offsets in a header file from a linker script. Since C headers are not compatible with linker scripts this does not work. Do you know any tricks or methods for referring to definitions in ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: including headers in linker script

  1. including headers in linker script

    Hi,

    I want to refer to offsets in a header file from a linker script.
    Since C headers are not compatible with linker scripts this does not
    work. Do you know any tricks or methods for referring to definitions
    in headers from a linker script? I hardcoded values in the scripts so
    far, which is not very pleasant.

    Thanks,
    Bahadir


  2. Re: including headers in linker script

    Bahadir writes:

    > I want to refer to offsets in a header file from a linker script.


    Presumably offsets from beginning of some structure to fields
    within it.

    > Since C headers are not compatible with linker scripts this does not
    > work. Do you know any tricks or methods for referring to definitions
    > in headers from a linker script? I hardcoded values in the scripts so
    > far, which is not very pleasant.


    The "standard" technique is to write a little "helper" C program
    that will compute the offsets and print them in a format acceptable
    to the linker as input.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

+ Reply to Thread