🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #542

ligb++-1.36.1 bug in test0 on Pyramids.

#542
From: jonathan
Date: Mon, 18 Dec 1989 00:32
47 lines
1490 bytes
Test0 fails to run on machines that do not allow the data segment to
be executed (for example, Pyramids running OSx 4.n).

The following diff fixes this problem on a Pyramid.

*** test.hello.cc.DIST	Thu Nov  9 00:28:31 1989
--- test.hello.cc	Mon Dec 18 13:18:39 1989
***************
*** 20,25 ****
--- 20,35 ----
  #endif
  
  
+ #ifdef __pyr__
+ #define MUST_MPROTECT
+ #include <sys/mman.h>
+ 
+ extern "C" {
+   int
+   mprotect (char *, int, int);
+ }
+ #endif
+ 
  class tfile
  {
  public:
***************
*** 101,106 ****
--- 111,128 ----
  
    read (fd, (char*) init_fn, size);
    close (fd);
+ 
+ #ifdef MUST_MPROTECT
+  {
+    void * rounded_size = (void *) ((size + pagsiz-1)&~(pagsiz-1));
+    int status = mprotect ((char*)init_fn, round_size,
+ 			  PROT_READ|PROT_EXEC|PROT_WRITE);
+    if (status !=0 ) {
+      perror ("making dynamically loaded code executable");
+      exit(errno);
+    }
+ }
+ #endif /* MUST_MPROTECT */
  
    fprintf (stderr, "load symbol-table at address 0x%x\n", init_fn);
  
Technical Details
Message-ID: <8912180037.AA03804@life.ai.mit.edu>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!COMP.VUW.AC.NZ!jonathan

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!COMP.VUW.AC.NZ!jonathan
From: jonathan@COMP.VUW.AC.NZ
Newsgroups: gnu.g++.lib.bug
Subject: ligb++-1.36.1 bug in test0 on Pyramids.
Message-ID: <8912180037.AA03804@life.ai.mit.edu>
Date: 18 Dec 89 00:32:31 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 47