Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!umbc3!alex From: alex@umbc3.UMD.EDU (Alex S. Crain) Newsgroups: comp.unix.wizards Subject: Re: Aliasing text and data segments of a process Message-ID: <730@umbc3.UMD.EDU> Date: 21 Jan 88 05:36:23 GMT References: <202@sdti.UUCP> Reply-To: alex@umbc3.UMD.EDU (Alex S. Crain) Organization: University of Maryland, Baltimore County Lines: 29 In article <202@sdti.UUCP> mjy@sdti.UUCP (Michael J. Young) writes: > >Is there a way in Unix to create an "alias" between the text and data >segments of a process? More specifically, how does one go about executing a >block of code that was generated in a data segment? *** SYSTEM 5 **** Koyto Common Lisp does this when it loads object code. The system builds object files where the first symbol in the text segment is a function that knows about all the other symbols in the file. There is an external loader that makes a copy of the .o file and resolves all external symbols against the lisp executable's symbol table. Lisp allocates space with brk(), and loads the .o file as data, and then branches to the start of the text area of the .o file, assuming that there is a function there that will put the rest of the symbols on the common obstack. Boy, do things get weird when the .o file is corrupted :-). But to answer the question, Nothing. That is, lisp doesn't do anything special to accomplish this, it just works. There is a short file that demonstrates this behavior, which I can send you if you like. -- :alex. alex@umbc3.umd.edu