link error while using 'ld' under linux... - Minix

This is a discussion on link error while using 'ld' under linux... - Minix ; ****************Source code************** ..code16 ..text ..globl _start _start: movw $MSG, %si print: lodsb andb %al, %al jz end movb $0xe, %ah movw $7, %bx int $0x10 end: ..data MSG: .string "Loading the system ...\r\n" .string "A big step!\r\n" .byte 0 ****************End ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: link error while using 'ld' under linux...

  1. link error while using 'ld' under linux...

    ****************Source code**************
    ..code16
    ..text
    ..globl _start
    _start:
    movw $MSG, %si

    print: lodsb
    andb %al, %al

    jz end
    movb $0xe, %ah
    movw $7, %bx
    int $0x10

    end:

    ..data
    MSG: .string "Loading the system ...\r\n"
    .string "A big step!\r\n"
    .byte 0

    ****************End of Source code**************

    #as -o loading.o loading.s
    >>>>This step succeeds.


    But,
    #ld -o loading load.o

    gots the following error.
    loading.o: In function `_start': relocation truncated to fit: R_386_16
    against `.data'


    Please advise what is wrong with the code?

    Thanks,
    Jianying

  2. Re: link error while using 'ld' under linux...

    JianYing wrote:
    > ****************Source code**************
    > .code16
    > .text
    > .globl _start
    > _start:
    > movw $MSG, %si
    >
    > print: lodsb
    > andb %al, %al
    >
    > jz end
    > movb $0xe, %ah
    > movw $7, %bx
    > int $0x10
    >
    > end:
    >
    > .data
    > MSG: .string "Loading the system ...\r\n"
    > .string "A big step!\r\n"
    > .byte 0
    >
    > ****************End of Source code**************
    >
    > #as -o loading.o loading.s
    > >>>>This step succeeds.

    >
    > But,
    > #ld -o loading load.o
    >
    > gots the following error.
    > loading.o: In function `_start': relocation truncated to fit: R_386_16
    > against `.data'
    >
    >
    > Please advise what is wrong with the code?
    >
    > Thanks,
    > Jianying


    instead of movw $msg, %si

    try

    lea $msg, %si


  3. Re: link error while using 'ld' under linux...

    I got the same error.
    What does that error message mean?

    Thanks,
    Jianying
    idknow@gmail.com wrote:
    > JianYing wrote:
    >> ****************Source code**************
    >> .code16
    >> .text
    >> .globl _start
    >> _start:
    >> movw $MSG, %si
    >>
    >> print: lodsb
    >> andb %al, %al
    >>
    >> jz end
    >> movb $0xe, %ah
    >> movw $7, %bx
    >> int $0x10
    >>
    >> end:
    >>
    >> .data
    >> MSG: .string "Loading the system ...\r\n"
    >> .string "A big step!\r\n"
    >> .byte 0
    >>
    >> ****************End of Source code**************
    >>
    >> #as -o loading.o loading.s
    >> >>>>This step succeeds.

    >>
    >> But,
    >> #ld -o loading load.o
    >>
    >> gots the following error.
    >> loading.o: In function `_start': relocation truncated to fit: R_386_16
    >> against `.data'
    >>
    >>
    >> Please advise what is wrong with the code?
    >>
    >> Thanks,
    >> Jianying

    >
    > instead of movw $msg, %si
    >
    > try
    >
    > lea $msg, %si
    >


  4. Re: link error while using 'ld' under linux...

    JianYing wrote:
    [snip]

    > #as -o loading.o loading.s
    > >>>>This step succeeds.

    >
    > But,
    > #ld -o loading load.o
    >
    > gots the following error.
    > loading.o: In function `_start': relocation truncated to fit: R_386_16
    > against `.data'
    >
    >
    > Please advise what is wrong with the code?
    >
    > Thanks,
    > Jianying


    i think it means that the length of the relocation is longer than
    R_386_16.
    that would be a plain reading of the error msg.

    connect to the irc.freenode.net, channel ##Linux for interactive
    assistance.
    use irssi.1 or bitchx.1 to connect.


+ Reply to Thread