🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by jonathan Mon, 13 Nov 1989 08:27
gnu ld breaks on NMAGIC .o files
#536
Author: jonathan
Date: Mon, 13 Nov 1989 08:27
46 lines
1731 bytes
Description:
	The gnu loader, as distributed with g++ 1.36.1, does not
	properly relocate references to external symbols in
	NMAGIC .o files.  This loses on Pyramids.

Repeat-by:
	Compile the following files as NMAGIC.  as(1) on Pyramid OSx
	does this by default. On other systems compile, move the .o
	files elsewhere, and do `ld -r -n' on each .o file.
	(I verified the bug on Mt.Xinu's 4.3bsd-tahoe for HP300s. Any
	4.3bsd-based system should do.) 
	Load the resulting .o files with gnu ld and run the program.
	It should print the same values for buggy and buggy_p.
	Instead, buggy_p is erroneously zero.
	Making the .o files OMAGIC (via `ld -r -N') and loading again
	gives correct results.

---main.c---
    /* main () of program to demonstrate bug in GNU ld on pyramids */
    
    
    #include <stdio.h>
    #include "buggy.h"
    
    char *buggy_p = buggy;
    main ()
    {
      char * auto_buggy_p = buggy;
      printf("&buggy=%x buggy_p=%x auto_buggy_p=%x\n",
    	 buggy, buggy_p, auto_buggy_p);
    }
---buggy.c:---
    /*  demonstrate bug in GNU ld on pyramids */
    #include "buggy.h"
    
    
    char buggy[1024];
---buggy.h:---
    extern char buggy[];
-------------
Fix-by:
	???

Workaround:
	Performing ld -r -N either manually or in the GNU CC driver
	works, albeit painfully.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads