delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/09/20/05:15:27

Date: Tue, 20 Sep 1994 09:29:48 +0200
From: Stefan Eckart <S_Eckart AT lis DOT e-technik DOT tu-muenchen DOT de>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: strange linker behavior

Hello,

the following program behaves rather strange when compiled with the
current (1.12m2) release of djgpp:

#include <stdio.h>

int delay;

main()
{
  printf("%d\n",delay);
}

I would have expected to get a 0 as output, and in fact this was the case
until v1.11m5. The current version prints a large negative number...

For some reason the linker merges the .bss symbol 'delay' with a .text symbol
'delay' from the runtime library (libsrc/c/dos/delay.s) and printf
displays the first for opcode bytes of delay()...

Is this

a) a programming bug (name clash between an global variable and function name)?
b) a feature or bug of the binutils 2.4 linker?
c) a bug in djgpp?

I think it is a), but why did it work up to now and why don't I get a warning
or error message? Any idea?

Thanks,

Stefan.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019