From: mannan AT daimi DOT aau DOT dk (Manmathan Muthukumarapillai) Subject: Linking problem (b18): "ld: file.o: bad reloc address 0x4 in section `.text'" 17 Jun 1997 22:19:17 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <33A6D198.167E.cygnus.gnu-win32@daimi.aau.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0 (X11; I; IRIX 6.2 IP22) Original-To: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com 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 AT daimi DOT aau DOT dk WWW : http://www.daimi.aau.dk/~mannan/ +++++++++++++++++++++++++++++++++++++++++ - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".