This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: a question about link script


Hi Martin,

> I know that we can point out a entry point of program with label
> "start". But the codes which include the label "start" may be in a
> random address. So if I want to make the address of code with label
> "start" start from 0, what do I can in link script? I looked up the
> document "Using ld", but I don't find how to solve it.

I am not quite sure what you are asking here, but if you want to know
how to set up the start address for an executable to be 0x000000 and
not the (possibly random) address of a symbol called 'start' then you
want to use the linker script command ENTRY.  From the linker
documentation: 

    ENTRY(<symbol>)
    The first instruction to execute in a program is called the
    'entry point'.  You can use the ENTRY linker script command
    to set the entry point.  The argument is a symbol name.

Choose a symbol whose address you know will be 0x0000000, rather than
using the symbol 'start'.  If there is no such symbol then you could
create one, or you could use the -e command line switch to tell the
linker exactly where the entry point should be.

Cheers
        Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]