This is the mail archive of the binutils@sourceware.cygnus.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]

AW: Cygwin crashes using own linker scripts


[ld configurated for pe-i386 (cygwin) breaks if producing binary output]

Mumit Khan wrote:
> If you send me the offending linker script (along with instructions on
> how to run and cause it to crash), I'll see if I can help.

It really does not depend on using a linker script. It seems that binary 
output "-oformat binary" is broken when configuring ld with pe-i386 as target.

An example: Take the following program (but the problem is not 
source code depended):

/*
** This is a small test for absolute linking
** Don't optimize the code
*/

#define LED *((char *) 0xFF056)

typedef struct {
    const char header[16];
    void    *ptr;
} START_T;

extern void Testfunc(void);

const START_T mystart = {    
    "@(#)UserProgr00",
    (void *) Testfunc
};

void Delay(void)
{
    int i, k;

    for (i=0; i<0xFFFFFFF; i++) {
        for (k=0; k<0xFFFFFFF; i++);
    }
}

void Testfunc(void)
{
    int k,j;
    
    for(;;) {
        LED = 0;
        Delay();
        LED = 1;
        Delay();
    }
}

Then do the following:
> gcc -c abstest.c -o abstest.o
> ld -oformat binary -Ttext 0x30000 -Tdata 0x31000 -Tbss 0x32000 abstest.o -o abstest.abs  
Output on my NT SP 3 Ws:

[main] D:\users\rku65670\cygnus\CYGWIN~1\H-I586~1\bin\ld.exe 1067 (0) handle_exceptions: 
Exception: STATUS_ACCESS_VIOLATION
[main] ld 1067 (0) handle_exceptions: Dumping stack trace to ld.exe.core
10:05:18://h/c-src>

If I link with ld-new (target=i386-linux-coff)
> ld-new -oformat binary -Ttext 0x30000 -Tdata 0x31000 -Tbss 0x32000 abstest.o -o abstest.abs  
It works.

The broken ld says:
ld: supported targets: pe-i386 pei-i386 srec symbolsrec tekhex binary ihex
ld: supported emulations: i386pe

The runnning ld says: 
ld-new: supported targets: coff-i386 srec symbolsrec tekhex binary ihex
ld-new: supported emulations: i386coff

Thanks for any help.

-- 
 Klaus Rotter, Siemens AG,  ATD TD 6 EPG, Postfach 3249, 91020 Erlangen
 Frauenauracherstraße 98, 91056 Erlangen
 Tel.: +49 9131 18-84637, Fax: +49 9131 18-84648 
 mailto:Klaus.Rotter@erl9.siemens.de



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