home *** CD-ROM | disk | FTP | other *** search
- *** 1.33 1992/10/11 02:39:24
- --- Changelog 1992/11/08 00:48:18
- ***************
- *** 377,379 ****
- --- 377,393 ----
- cnm.c:: ++jrb
- cleanup for hpux
- ----------------------------- Patchlevel 32 --------------------------------
- +
- + ld.c:: howard
- + more fixes for baserel
- +
- + ld.c:: ++jrb
- + fixed BYTE_SWAP problem.
- +
- + ld.c:: ++jrb
- + more BYTE_SWAP fixes in the relocation stuff
- +
- + toglclr.c: Thomas Schulze, ts@uni-paderborn.de
- + add -fshare flag for sharex text (mint 0.96 and up).
- +
- + ----------------------------- Patchlevel 33 --------------------------------
- *** 1.30 1992/10/11 02:39:24
- --- PatchLev.h 1992/11/08 00:48:20
- ***************
- *** 1,4 ****
- ! #define PatchLevel "32"
-
- /*
- * the Patch Level above is to identify the version
- --- 1,4 ----
- ! #define PatchLevel "33"
-
- /*
- * the Patch Level above is to identify the version
- *** 1.37 1992/10/11 02:39:24
- --- ld.c 1992/11/08 00:48:25
- ***************
- *** 2176,2181 ****
- --- 2176,2189 ----
-
- /* Grab the next entry. */
- p++;
- +
- + #ifdef BYTE_SWAP
- + if (entry->superfile==NULL) {
- + p->n_un.n_strx = SWAP4(p->n_un.n_strx); /* oochie wow-wow ??!!! -- ko */
- + p->n_desc = SWAP2(p->n_desc);
- + p->n_value = SWAP4(p->n_value); }
- + #endif /* BYTE_SWAP */
- +
- if (p->n_type != (N_UNDF | N_EXT))
- {
- fprintf (stderr, "%s: Warning symbol found in %s without external reference following.\n",
- ***************
- *** 2629,2634 ****
- --- 2637,2649 ----
- if (index < 0 || index >= length_of_strings
- || (index && *(sym_name_base + index - 1)))
- fatal_with_file ("malformatted __.SYMDEF in ", entry);
- +
- + #ifdef BYTE_SWAP
- + if(sizeof(symdef_base[i].library_member_offset) == 4)
- + symdef_base[i].library_member_offset = SWAP4(symdef_base[i].library_member_offset);
- + else
- + symdef_base[i].library_member_offset = SWAP2(symdef_base[i].library_member_offset);
- + #endif
- }
-
- /* Search the symdef data for members to load.
- ***************
- *** 2663,2676 ****
- register int j;
- register int offset;
- struct file_entry *subentry;
- - #ifdef BYTE_SWAP
- - if (sizeof(symdef_base[i].library_member_offset)==4)
- - symdef_base[i].library_member_offset = SWAP4(symdef_base[i].library_member_offset);
- - else
- - symdef_base[i].library_member_offset = SWAP2(symdef_base[i].library_member_offset);
- - #endif /* BYTE_SWAP */
-
- ! offset = symdef_base[i].library_member_offset;
-
- /* Don't think carefully about any archive member
- more than once in a given pass. */
- --- 2678,2685 ----
- register int j;
- register int offset;
- struct file_entry *subentry;
-
- ! offset = symdef_base[i].library_member_offset;
-
- /* Don't think carefully about any archive member
- more than once in a given pass. */
- ***************
- *** 4357,4371 ****
- struct relocation_info *p;
- struct file_entry *entry;
- {
- ! register int symindex = RELOC_SYMBOL (p) * sizeof (struct nlist);
- ! register symbol *sp = ((symbol *)
- ! (((struct nlist *)
- ! (((char *)entry->symbols) + symindex))
- ! ->n_un.n_name));
-
- if (symindex >= entry->header.a_syms)
- fatal_with_file ("relocation symbolnum out of range in ", entry);
-
- #ifdef N_INDR
- /* Resolve indirection */
- if ((sp->defined & ~N_EXT) == N_INDR)
- --- 4366,4382 ----
- struct relocation_info *p;
- struct file_entry *entry;
- {
- ! register int symindex;
- ! register symbol *sp;
- !
- ! symindex = RELOC_SYMBOL (p) * sizeof (struct nlist);
-
- if (symindex >= entry->header.a_syms)
- fatal_with_file ("relocation symbolnum out of range in ", entry);
-
- + sp = ((symbol *) (((struct nlist *) (((char *)entry->symbols) + symindex))
- + ->n_un.n_name));
- +
- #ifdef N_INDR
- /* Resolve indirection */
- if ((sp->defined & ~N_EXT) == N_INDR)
- ***************
- *** 4373,4378 ****
- --- 4384,4409 ----
- #endif
- return sp;
- }
- +
- + static char *
- + retsymname (p, entry, addr)
- + struct relocation_info *p;
- + struct file_entry *entry;
- + int addr;
- + {
- + register struct nlist *n;
- +
- + if (RELOC_EXTERN_P(p)) {
- + register symbol *sp = retsym(p, entry);
- + return sp->name;
- + }
- + for (n=entry->symbols;
- + n<(struct nlist *)((long)entry->symbols + entry->header.a_syms); n++)
- + if (n->n_value == addr)
- + return(entry->strings + n->n_un.n_strx);
- + return "(static symbol)";
- + }
- +
- /* Relocate ENTRY's text or data section contents.
- DATA is the address of the contents, in core.
- DATA_SIZE is the length of the contents.
- ***************
- *** 4406,4412 ****
- register int relocation = 0;
- register int addr;
- register unsigned int mask = 0;
- ! symbol *sp;
-
- #ifdef BYTE_SWAP /* swap relocation info */
- { /* BITFIELD ALERT BITFIELD ALERT */
- --- 4437,4443 ----
- register int relocation = 0;
- register int addr;
- register unsigned int mask = 0;
- ! int oldreloc;
-
- #ifdef BYTE_SWAP /* swap relocation info */
- { /* BITFIELD ALERT BITFIELD ALERT */
- ***************
- *** 4429,4434 ****
- --- 4460,4466 ----
-
- if (RELOC_EXTERN_P(p))
- {
- + register symbol *sp;
- sp = retsym(p, entry);
-
- /* If the symbol is undefined, leave it at zero. */
- ***************
- *** 4471,4476 ****
- --- 4503,4509 ----
- if (RELOC_PCREL_P(p))
- relocation -= pc_relocation;
-
- + oldreloc = relocation;
- #ifdef RELOC_ADD_EXTRA
- relocation += RELOC_ADD_EXTRA(p);
- #endif
- ***************
- *** 4496,4548 ****
- break;
-
- case 1:
- if (RELOC_MEMORY_ADD_P(p)) {
- ! if (RELOC_PCREL_P(p))
- ! relocation += mask & *(short *) (data + addr);
- else
- ! relocation += mask & *(unsigned short *) (data + addr);
- }
- if (relocation > 32767 || relocation < -32768) {
- ! sp = retsym(p, entry);
- ! error ("relocation out of range for %s in %s",
- ! sp->name, entry->filename);
- make_executable = 0;
- }
- ! *(short *) (data + addr) &= ~mask;
- ! *(short *) (data + addr) |= relocation;
- break;
-
- case 2:
- #ifndef WORD_ALIGNED
- ! if (RELOC_MEMORY_ADD_P(p))
- ! relocation += mask & *(long *) (data + addr);
- ! *(long *) (data + addr) &= ~mask;
- ! *(long *) (data + addr) |= relocation;
- #else
- ! {
- ! register unsigned long word = 0;
-
- ! word |= (unsigned char)(data[addr]) << 24;
- ! word |= (unsigned char)(data[addr+1]) << 16;
- ! word |= (unsigned char)(data[addr+2]) << 8;
- ! word |= (unsigned char)(data[addr+3]);
-
- if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & word;
- if (pure_text && relocation > text_size+text_start) {
- ! sp = retsym(p, entry);
- error ("absolute reference to %s from pure-text in %s",
- ! sp->name, entry->filename);
- make_executable = 0; /* set exit code */
- }
- word &= ~mask;
- word |= relocation;
- ! data[addr] = word >> 24;
- ! data[addr+1] = (word >> 16) & 0xff;
- ! data[addr+2] = (word >> 8) & 0xff;
- ! data[addr+3] = word & 0xff;
- ! }
- #endif
- break;
-
- default:
- --- 4529,4615 ----
- break;
-
- case 1:
- + {
- + register int word;
- if (RELOC_MEMORY_ADD_P(p)) {
- ! if (RELOC_PCREL_P(p)||RELOC_EXTERN_P(p))
- ! word = *(short *) (data + addr);
- else
- ! word = *(unsigned short *) (data + addr);
- ! #ifdef BYTE_SWAP
- ! word = SWAP2(word);
- ! #endif
- ! relocation += mask & word;
- }
- if (relocation > 32767 || relocation < -32768) {
- ! if (!RELOC_EXTERN_P(p))
- ! if (!entry->strings) {
- ! entry->strings = (char *) alloca (entry->string_size);
- ! read_entry_strings (file_open (entry), entry);
- ! }
- ! error ("fatal error: relocation out of range for %s in %s",
- ! retsymname(p, entry, oldreloc+word), entry->filename);
- make_executable = 0;
- }
- ! word &= ~mask;
- ! word |= relocation;
- ! #ifdef BYTE_SWAP
- ! word = SWAP2(word);
- ! #endif
- ! *(short *) (data + addr) = word;
- ! }
- break;
-
- case 2:
- + {
- + register unsigned long word;
- #ifndef WORD_ALIGNED
- ! word = *(long *) (data + addr);
- ! #ifdef BYTE_SWAP
- ! word = SWAP4(word);
- ! #endif /* BYTE_SWAP */
- #else
- ! word = ((unsigned long)(unsigned char)(data[addr])) << 24;
- ! word |= ((unsigned long)(unsigned char)(data[addr+1])) << 16;
- ! word |= ((unsigned long)(unsigned char)(data[addr+2])) << 8;
- ! word |= ((unsigned long)(unsigned char)(data[addr+3]));
- ! #ifdef BYTE_SWAP
- ! /* NOTE: We dont need to swap 4 because we are constructing
- ! the word here */
- ! #endif
-
- ! #endif
-
- if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & word;
- +
- if (pure_text && relocation > text_size+text_start) {
- ! if (!RELOC_EXTERN_P(p))
- ! if (!entry->strings) {
- ! entry->strings = (char *) alloca (entry->string_size);
- ! read_entry_strings (file_open (entry), entry);
- ! }
- error ("absolute reference to %s from pure-text in %s",
- ! retsymname(p, entry, relocation), entry->filename);
- make_executable = 0; /* set exit code */
- }
- word &= ~mask;
- word |= relocation;
- ! #if (defined(BYTE_SWAP) && (!defined(WORD_ALIGNED)))
- ! word = SWAP4(word);
- ! #endif
- ! #ifndef WORD_ALIGNED
- ! *(long *) (data + addr) = word;
- ! #else
- ! data[addr+3] = word;
- ! word >>= 8;
- ! data[addr+2] = word;
- ! word >>= 8;
- ! data[addr+1] = word;
- ! word >>= 8;
- ! data[addr] = word;
- #endif
- + }
- break;
-
- default:
- ***************
- *** 4562,4567 ****
- --- 4629,4635 ----
- }
- #endif /* BYTE_SWAP */
- }
- + entry->strings = 0;
- }
-
- /* For relocatable_output only: write out the relocation,
- *** 1.3 1992/10/11 02:39:24
- --- toglclr.c 1992/11/08 00:48:30
- ***************
- *** 21,26 ****
- --- 21,30 ----
- * (bammi@cadence.com) to toggle the clear TPA above BSS flag
- * introduced with TOS 1.4. I extended it to also handle the additional
- * program flags introduced with the TOS versions for the STE and TT.
- + *
- + * 31-Oct-1992 Thomas Schulze
- + * Added code for MiNT 0.96 (and up) shared text feature. -fshare
- + * will switch this flag.
- */
-
- #include <stdio.h>
- ***************
- *** 149,154 ****
- --- 153,162 ----
- (int)((t & F_ALTALLOC) == F_ALTALLOC),
- (int)((head.a_AZero2 & F_ALTALLOC) == F_ALTALLOC));
-
- + printf("%s: `shared text' bit was %d is now %d\n", fn,
- + (int)((t & F_SHTEXT) == F_SHTEXT),
- + (int)((head.a_AZero2 & F_SHTEXT) == F_SHTEXT));
- +
- return 0;
- }
-
- ***************
- *** 165,171 ****
- fprintf(stderr, "usage: toglclr [options] file file .....\n\n");
- fprintf(stderr, "options: -fload = toggle `fast load' bit\n");
- fprintf(stderr, " -frun = toggle `load program into fast ram' bit\n");
- ! fprintf(stderr, " -fram = toggle `malloc from fast ram' bit\n\n");
- fprintf(stderr, "without options the current state is reported.\n");
- exit(1);
- }
- --- 173,180 ----
- fprintf(stderr, "usage: toglclr [options] file file .....\n\n");
- fprintf(stderr, "options: -fload = toggle `fast load' bit\n");
- fprintf(stderr, " -frun = toggle `load program into fast ram' bit\n");
- ! fprintf(stderr, " -fram = toggle `malloc from fast ram' bit\n");
- ! fprintf(stderr, " -fshare= toggle `shared text' bit\n\n");
- fprintf(stderr, "without options the current state is reported.\n");
- exit(1);
- }
- ***************
- *** 178,183 ****
- --- 187,194 ----
- flags_to_toggle |= F_ALTLOAD;
- if (!strcmp(*argv, "-fram"))
- flags_to_toggle |= F_ALTALLOC;
- + if (!strcmp(*argv, "-fshare"))
- + flags_to_toggle |= F_SHTEXT;
- --argc;
- }
-
-