Article View: gnu.utils.bug
Article #536gnu ld breaks on NMAGIC .o files
From: jonathan
Date: Mon, 13 Nov 1989 08:27
Date: Mon, 13 Nov 1989 08:27
46 lines
1731 bytes
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.
Technical Details
Message-ID:
<8911130827.AA28759@comp.vuw.ac.nz>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!comp.vuw.ac.nz!jonathanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!comp.vuw.ac.nz!jonathan From: jonathan@comp.vuw.ac.nz Newsgroups: gnu.utils.bug Subject: gnu ld breaks on NMAGIC .o files Message-ID: <8911130827.AA28759@comp.vuw.ac.nz> Date: 13 Nov 89 08:27:04 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 46