Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site petsd.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!hjuxa!petsd!law From: law@petsd.UUCP (Steve Law) Newsgroups: net.lang.c,net.unix Subject: Re: Creating functions in data space Message-ID: <728@petsd.UUCP> Date: Mon, 10-Mar-86 13:26:14 EST Article-I.D.: petsd.728 Posted: Mon Mar 10 13:26:14 1986 Date-Received: Wed, 12-Mar-86 03:09:56 EST Organization: Concurrent Computer Corp. Lines: 54 Xref: watmath net.lang.c:8118 net.unix:7348 > In response to George Tomasevich: > I had missed that one. > This seems to me to be very machine dependent, even compiler > dependent. I'm sure that the compiler, in any event, would spit all > kinds of warnings at you. Perhaps a way around it would be to gain > access somehow to the memory management register, have a function that > flips a bit just before calling the data code, and cleans up afterwards. > Perhaps the problem is that C allows you to have identically named > functions and variables, but you could get around that as well. > UNIX System V link editor (ld) allows one to put functions in the .data section of a COFF file. All you need to do is to create a ld command file (also called ifile). For example, the following ifile: SECTIONS { .data: { file1.o (.text) /* file1.c, file2.c file3.c contain */ file2.o (.text) /* the functions text that to be */ file3.o (.text) /* placed in the .data section of */ ... /* the final a.out */ } } and the following command lines: cc -c file1.c file2.c file3.c cc -N otherfiles.c ifile will create an a.out which will have all the functions of file[123].c in the .data section instead of .text section. One can also use ifile(s) to do the following: - place data in .text - create dummy sections (e.g., store history info) - create holes within sections - align sections - merge sections - subsystem linking and many others. It is a very powerful tool, but some of its features are not well documented!!! Steve Law --*-------*-------*-------*-------*-------*-------*-- Name: I. S. Law (Steve) UUCP: ihnp4!vax135!petsd!law ARPA: vax135!petsd!law@BERKELEY US Mail: MS 314B; Concurrent Computer Corp. 106 Apple St; Tinton Falls, NJ 07724 Phone: (201) 758-7280 --*-------*-------*-------*-------*-------*-------*--