This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

Linking problem (b18): "ld: file.o: bad reloc address0x4 in section `.text'"


Hello everybody,

Please help me,

I tried to link severel object files, first I linked some of them
together in one directory to a single file by saying:
        [e:\test]: ld -r -X -o dira.o dira/*.o
then I did this:
        [e:\test]: ld -r -X -o all.o common.o dira.o dirb/*.o
and got the error:
        ld: dira.o: bad reloc address 0x4 in section `.text'


I found out that I can link them together in one step by:
        [e:\test]: ld -r -X -o all.o common.o dira/*.o dirb/*.o
without any problem, but then I get the same problem when I want
to make a exe-file in the final linking with other files.

Actually I want a function like Microsofts LIB-command, where
you create a library with different functions used to by other
C-programs.

I tried to do examine the linker with:
        [e:\test] ld --verbose
and I got this (I am using mingw32):


[e:\beta\r4.0.3]ld --verbose
GNU ld version cygnus-2.8.1 (with BFD cygnus-2.8.1)
  Supported emulations:
   i386pe
using internal linker script:
==================================================
OUTPUT_FORMAT(pei-i386)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib);
SEARCH_DIR(/pizza/mushroom/noer/beta18/install-i386-cygwin32/H-i386-cygwin32/
); SEARCH_DIR(/usr/local/lib);
SEARCH_DIR(/pizza/mushroom/noer/beta18/install-i386-cygwin32/H-i386-cygwin32/i386-cygw
2/lib);
ENTRY(_mainCRTStartup)
SECTIONS
{
  .text  __image_base__ + __section_alignment__  :
  {
     *(.init)
    *(.text)
     ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
                        LONG (-1); *(.ctors); *(.ctor); LONG (0);
     ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
                        LONG (-1); *(.dtors); *(.dtor);  LONG (0);
     *(.fini)
    /* ??? Why is .gcc_exc here?  */
     *(.gcc_exc)
     etext = .;
    /* Grouped section support currently must be explicitly provided for
        in the linker script.  */
    *(.text$)
    *(.gcc_except_table)
  }
  .bss BLOCK(__section_alignment__)  :
  {
    __bss_start__ = . ;
    *(.bss)
    *(COMMON)
    __bss_end__ = . ;
  }
  .data BLOCK(__section_alignment__) :
  {
    __data_start__ = . ;
    *(.data)
    *(.data2)
    __data_end__ = . ;
    /* Grouped section support currently must be explicitly provided for
        in the linker script.  */
    *(.data$)
  }
  .rdata BLOCK(__section_alignment__) :
  {
    *(.rdata)
    /* Grouped section support currently must be explicitly provided for
        in the linker script.  */
    *(.rdata$)
  }
  .edata BLOCK(__section_alignment__) :
  {
    *(.edata)
  }
  /DISCARD/ BLOCK(__section_alignment__) :
  {
    *(.debug$S)
    *(.debug$T)
    *(.debug$F)
    *(.drectve)
  }
  .idata BLOCK(__section_alignment__) :
  {
    /* This cannot currently be handled with grouped sections.
        See pe.em:sort_sections.  */
    *(.idata$2)
    *(.idata$3)
    *(.idata$4)
    *(.idata$5)
    *(.idata$6)
    *(.idata$7)
  }
  .CRT BLOCK(__section_alignment__) :
  {
    /* Grouped sections are used to handle .CRT$foo.  */
    *(.CRT$)
  }
  .rsrc BLOCK(__section_alignment__) :
  {
    /* Grouped sections are used to handle .rsrc$0[12].  */
    *(.rsrc$)
  }
  .endjunk BLOCK(__section_alignment__) :
  {
    /* end is deprecated, don't use it */
     end = .;
     __end__ = .;
  }
  .stab BLOCK(__section_alignment__)  (NOLOAD) :
  {
    [ .stab ]
  }
  .stabstr BLOCK(__section_alignment__) (NOLOAD) :
  {
    [ .stabstr ]
  }
  .reloc BLOCK(__section_alignment__) :
  {
    *(.reloc)
  }
}


==================================================

What does this mean:

    /* Grouped section support currently must be explicitly provided for
        in the linker script.  */

Is this the reason for my linking problem??

hoping to get a answer soon.

Manmathan
-- 
+++++++++++++++++++++++++++++++++++++++++
 Manmathan Kumar, Spobjergvej 149, nr. 4
 DK-8220 Brabrand, Denmark.
 Tel.: (+45) 89449509

 Email: mannan@daimi.aau.dk
 WWW  : http://www.daimi.aau.dk/~mannan/
+++++++++++++++++++++++++++++++++++++++++
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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