delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/09/02/09:00:43

Date: Mon, 2 Sep 1996 08:56:36 -0400
From: dj (DJ Delorie)
Message-Id: <199609021256.IAA28909@delorie.com>
To: sandmann AT clio DOT rice DOT edu
CC: djgpp-workers AT delorie DOT com
In-reply-to: <9609020600.AA13669@clio.rice.edu> (sandmann@clio.rice.edu)
Subject: Re: make problems

> My guess is that this is the known bug in the crt0 code which malloc's
> the stubinfo structure.  In rare instances with exactly the right code
> size, it ends up at least partially in a different memory zone.  We either
> need to not malloc the structure, or in the final cleanup code save the
> values on the stack before freeing the memory.

This self-adjusting program demonstrates the crash:

#include <stdio.h>
#include <stubinfo.h>

#define FILLER 0x12f74

char filler2[FILLER];

extern int etext, edata, end;
extern int djgpp_first_ctor asm("djgpp_first_ctor");

int
main(void)
{
  printf("text %08x %08x\n", 0x10a8, &etext);
  printf("data %08x %08x\n", &djgpp_first_ctor, &edata);
  printf("bss  %08x %08x\n", &edata, &end);
  printf("stubinfo at %x\n", _stubinfo);
  if ((int)_stubinfo != 0x20000)
    printf("set FILLER to 0x%x\n", FILLER + (0x20000 - (int)_stubinfo));
  return 0;
}

- Raw text -


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