home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / binutils-2.5.2-diffs.lha / GNU / diffs / binutils-2.5.2.diffs
Encoding:
Text File  |  1995-04-14  |  233.8 KB  |  7,584 lines

  1. diff -rc --new-file binutils-2.5.2-base/Makefile.in binutils-2.5.2/Makefile.in
  2. *** binutils-2.5.2-base/Makefile.in    Sat Oct 22 03:16:10 1994
  3. --- binutils-2.5.2/Makefile.in    Mon Mar 27 11:15:50 1995
  4. ***************
  5. *** 603,609 ****
  6.   # Installation targets.
  7.   
  8.   .PHONY: install uninstall vault-install
  9. ! install: $(INSTALL_TARGET) 
  10.   
  11.   uninstall:
  12.       @echo "the uninstall target is not supported in this tree"
  13. --- 603,613 ----
  14.   # Installation targets.
  15.   
  16.   .PHONY: install uninstall vault-install
  17. ! # AmigaDOS hack - during transition to BFD based 2.5.X binutils
  18. ! # from 1.8.X binutils add individual install targets as they are
  19. ! # tested.
  20. ! #install: $(INSTALL_TARGET) 
  21. ! install: install-gas install-binutils
  22.   
  23.   uninstall:
  24.       @echo "the uninstall target is not supported in this tree"
  25. diff -rc --new-file binutils-2.5.2-base/Product-Info binutils-2.5.2/Product-Info
  26. *** binutils-2.5.2-base/Product-Info    Thu Jan  1 00:00:00 1970
  27. --- binutils-2.5.2/Product-Info    Tue Feb 14 18:26:18 1995
  28. ***************
  29. *** 0 ****
  30. --- 1,18 ----
  31. + .name
  32. + binutils
  33. + .fullname
  34. + GNU binutils
  35. + .type
  36. + Programmer Tools
  37. + .short
  38. + GNU binary utilities, Amiga source
  39. + .description
  40. + The GNU binary utilities.
  41. + .version
  42. + 2.5.2
  43. + .requirements
  44. + Amiga binaries require the ixemul.library.
  45. + .distribution
  46. + GNU Public License
  47. + .described-by
  48. + Fred Fish (fnf@amigalib.com)
  49. diff -rc --new-file binutils-2.5.2-base/bfd/Makefile.in binutils-2.5.2/bfd/Makefile.in
  50. *** binutils-2.5.2-base/bfd/Makefile.in    Wed Oct 12 15:57:35 1994
  51. --- binutils-2.5.2/bfd/Makefile.in    Tue Feb 14 18:29:00 1995
  52. ***************
  53. *** 118,123 ****
  54. --- 118,126 ----
  55.       aout-ns32k.o \
  56.       aout0.o \
  57.       aout32.o \
  58. +     aout-amiga.o\
  59. +     amigados.o \
  60. +     amigadoslink.o \
  61.       bout.o \
  62.       cf-i386lynx.o \
  63.       cf-m68klynx.o \
  64. ***************
  65. *** 233,239 ****
  66.   # C source files that correspond to .o's.
  67.   CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c \
  68.        archures.c coff-i386.c coff-go32.c aout64.c aout32.c sunos.c demo64.c \
  69. !      coff-i960.c srec.c tekhex.c oasys.c ieee.c aout0.c \
  70.        ecoff.c ecofflink.c coff-m68k.c coff-u68k.c coff-apollo.c \
  71.        coff-a29k.c coff-rs6000.c coff-sparc.c coffgen.c format.c \
  72.        section.c core.c syms.c stab-syms.c reloc.c init.c \
  73. --- 236,242 ----
  74.   # C source files that correspond to .o's.
  75.   CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c \
  76.        archures.c coff-i386.c coff-go32.c aout64.c aout32.c sunos.c demo64.c \
  77. !      coff-i960.c srec.c tekhex.c oasys.c ieee.c aout0.c aout-amiga.c \
  78.        ecoff.c ecofflink.c coff-m68k.c coff-u68k.c coff-apollo.c \
  79.        coff-a29k.c coff-rs6000.c coff-sparc.c coffgen.c format.c \
  80.        section.c core.c syms.c stab-syms.c reloc.c init.c \
  81. ***************
  82. *** 253,263 ****
  83.        i386lynx.c cf-i386lynx.c m68klynx.c cf-m68klynx.c \
  84.        sparclynx.c cf-sparclynx.c aix386-core.c hpux-core.c \
  85.        irix-core.c lynx-core.c osf-core.c hash.c linker.c cofflink.c \
  86. !      ns32knetbsd.c sparcnetbsd.c
  87.   
  88.   HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h \
  89.        coffswap.h ecoffswap.h elf32-hppa.h elf32-target.h elf64-target.h \
  90. !      elfcode.h hppa_stubs.h libaout.h libbfd.h \
  91.        libcoff.h libecoff.h libelf.h libhppa.h libieee.h libnlm.h \
  92.        liboasys.h nlm-target.h nlmcode.h som.h genlink.h
  93.   
  94. --- 256,266 ----
  95.        i386lynx.c cf-i386lynx.c m68klynx.c cf-m68klynx.c \
  96.        sparclynx.c cf-sparclynx.c aix386-core.c hpux-core.c \
  97.        irix-core.c lynx-core.c osf-core.c hash.c linker.c cofflink.c \
  98. !      ns32knetbsd.c sparcnetbsd.c amigados.c amigadoslink.c
  99.   
  100.   HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h \
  101.        coffswap.h ecoffswap.h elf32-hppa.h elf32-target.h elf64-target.h \
  102. !      elfcode.h hppa_stubs.h libamiga.h libaout.h libbfd.h \
  103.        libcoff.h libecoff.h libelf.h libhppa.h libieee.h libnlm.h \
  104.        liboasys.h nlm-target.h nlmcode.h som.h genlink.h
  105.   
  106. ***************
  107. *** 525,530 ****
  108. --- 528,537 ----
  109.   
  110.   bfd.ps: 
  111.       (cd $(docdir); $(MAKE) bfd.ps $(FLAGS_TO_PASS))
  112. + amigados.o: amigados.c libamiga.h bfd.h
  113. + amigadoslink.o: bfd.h libamiga.h amigadoslink.c
  114. + aout-amiga.o: aout-amiga.c aoutf1.h bfd.h
  115.   
  116.   # What appears below is generated by a hacked mkdep using gcc -MM.
  117.   
  118. diff -rc --new-file binutils-2.5.2-base/bfd/amigados.c binutils-2.5.2/bfd/amigados.c
  119. *** binutils-2.5.2-base/bfd/amigados.c    Thu Jan  1 00:00:00 1970
  120. --- binutils-2.5.2/bfd/amigados.c    Sun Feb 12 21:59:42 1995
  121. ***************
  122. *** 0 ****
  123. --- 1,2594 ----
  124. + /* BFD back-end for Commodore-Amiga AmigaDOS binaries.
  125. +    Copyright (C) 1990-1994 Free Software Foundation, Inc.
  126. +    Contributed by Leonard Norrgard.  Partially based on the bout
  127. +    and ieee BFD backends and Markus Wild's tool hunk2gcc.
  128. +    Revised and updated by Stephan Thesing 
  129. + This file is part of BFD, the Binary File Descriptor library.
  130. + This program is free software; you can redistribute it and/or modify
  131. + it under the terms of the GNU General Public License as published by
  132. + the Free Software Foundation; either version 2 of the License, or
  133. + (at your option) any later version.
  134. + This program is distributed in the hope that it will be useful,
  135. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  136. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  137. + GNU General Public License for more details.
  138. + You should have received a copy of the GNU General Public License
  139. + along with this program; if not, write to the Free Software
  140. + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  141. + /*
  142. + SECTION
  143. +     amiga back end
  144. + This section describes the overall structure of the Amiga BFD back end.
  145. + The linker stuff can be found in @xref{amigalink}.
  146. + @menu
  147. + @* implementation::
  148. + @* amigalink::
  149. + @end menu
  150. + INODE
  151. + implementation, amigalink, amiga, amiga
  152. + SECTION
  153. +     implementation
  154. + The need for a port of the bfd library for Amiga style object (hunk) files
  155. + arose by the desire to port the GNU debugger gdb to the Amiga.
  156. + Also, the linker ld should be updated to the current version (2.5.2).
  157. + @@*
  158. + This port bases on the work done by Leonard Norrgard, who started porting
  159. + gdb. Raphael Luebbert, who supports the ixemul.library, has also worked on
  160. + implementing the needed @code{ptrace()} system call and gas2.5.
  161. + @menu
  162. + @* not supported::
  163. + @* Does it work ?::
  164. + @* TODO::
  165. + @end menu
  166. + INODE
  167. + not supported, Does it work ?,implementation,implementation
  168. + SUBSECTION
  169. +     not supported
  170. + Currently, the implementation does not support Amiga link library files, like
  171. + e.g. amiga.lib. This may be added in a later version, if anyone starts work
  172. + on it, or I find some time for it.
  173. + The handling of the symbols in hunk files is a little bit broken:
  174. +       o The symbols in a load file are totally ignored at the moment, so gdb and gprof
  175. +             do not work.
  176. +       o The symbols of a object module (Hunk file, starting with HUNK_UNIT) are read in
  177. +             correctly, but HUNK_SYMBOL hunks are also ignored.
  178. + The reason for this is the following:
  179. + Amiga symbol hunks do not allow for much information. Only a name and a value are allowed.
  180. + On the other hand, a.out format carries along much more information (see, e.g. the
  181. + entry on set symbols in the ld manual). The old linker copied this information into
  182. + a HUNK_DEBUG hunk. Now there is the choice:
  183. +     o ignoring the debug hunk, read in only HUNK_SYMBOL definitions => extra info is lost.
  184. +     o read in the debug hunk and use the information therein => How can clashs between the
  185. +           information in the debug hunk and HUNK_SYMBOL or HUNK_EXT hunks be avoided ?
  186. + I haven't decided yet, what to do about this.
  187. + Although bfd allows to link together object modules of different flavours, 
  188. + producing a.out style executables does not work on Amiga :-)
  189. + It should, however, be possible to create a.out files with the -r option of ld
  190. + (incremental link).
  191. + INODE 
  192. + Does it work ?,TODO ,not supported , implementation
  193. + SUBSECTION
  194. +     Does it work ?
  195. + Currently, the following utillities work:
  196. +     o objdump
  197. +     o objcopy
  198. +     o strip
  199. +     o nm
  200. +     o ar
  201. +     o gas
  202. +     
  203. + INODE
  204. + TODO, , Does it work ?, implementation
  205. + SUBSECTION
  206. +     TODO
  207. +     o fix fixme:s
  208. + @*
  209. + BFD:
  210. +     o add flag to say if the format allows multiple sections with the
  211. +           same name.  Fix bfd_get_section_by_name() and bfd_make_section()
  212. +           accordingly.
  213. +        
  214. +     o dumpobj.c: the disassembler: use relocation record data to find symbolic
  215. +            names of addresses, when available.  Needs new routine where one can
  216. +           specify the source section of the symbol to be printed as well as some
  217. +           rewrite of the disassemble functions.
  218. +        
  219. + */
  220. + #include "bfd.h"
  221. + #include "bfdlink.h"
  222. + #include "sysdep.h"
  223. + #include "libbfd.h"
  224. + #include "libamiga.h"
  225. + #include <a.out.h>
  226. + #define GL(x) bfd_get_32 (abfd, (bfd_byte *) (x))
  227. + #define DEBUG_AMIGA 10000
  228. + #if DEBUG_AMIGA
  229. + #include <varargs.h>
  230. + static void error_print(va_alist)
  231. + va_dcl
  232. + {
  233. + va_list args;
  234. + char *fmt;
  235. + va_start(args);
  236. + fmt=va_arg(args,char *);
  237. + (void)vfprintf(stderr,fmt,args);
  238. + va_end(args);
  239. + }
  240. + #define DPRINT(L,x) if (L>=DEBUG_AMIGA) error_print x
  241. + #else
  242. + #define DPRINT(L,x) 
  243. + #endif
  244. + static boolean amiga_digest_file ();
  245. + static boolean amiga_mkobject ();
  246. + reloc_howto_type howto_hunk_reloc8 =
  247. + {
  248. +   HUNK_RELOC8, /* type */
  249. +   0,           /* rightshift */
  250. +   0,           /* size */
  251. +   8,           /* bitsize */
  252. +   true,        /* pc_relative */
  253. +   0,           /* bitpos */
  254. +   complain_overflow_bitfield,  /* complain_on_overflow */
  255. +   0,           /* special_function */
  256. +   "reloc8",    /* textual name */
  257. +   false,       /* partial_inplace? */
  258. +   0x000000ff,  /* src_mask */
  259. +   0x000000ff,  /* dst_mask */
  260. +   true         /* pcrel_offset */
  261. + };
  262. + reloc_howto_type howto_hunk_reloc16 =
  263. + {HUNK_RELOC16,0,1,16,true,0,complain_overflow_bitfield,0,"reloc16",false,0x0000ffff,0x0000ffff,true};
  264. + reloc_howto_type howto_hunk_reloc32 =
  265. + {HUNK_RELOC32,0,2,32,true,0,complain_overflow_bitfield,0,"reloc32",false,0xffffffff,0xffffffff,true};
  266. + reloc_howto_type howto_hunk_drel8 =
  267. + {HUNK_DREL8,0,0,8,false,0,complain_overflow_bitfield,0,"drel8",false,0x000000ff,0x000000ff,false};
  268. + reloc_howto_type howto_hunk_drel16 =
  269. + {HUNK_DREL16,0,1,16,false,0,complain_overflow_bitfield,0,"drel16",false,0x0000ffff,0x0000ffff,false};
  270. + reloc_howto_type howto_hunk_drel32 =
  271. + {HUNK_DREL32,0,2,32,false,0,complain_overflow_bitfield,0,"drel32",false,0xffffffff,0xffffffff,false};
  272. + reloc_howto_type *amiga_howto_array[2][3] =
  273. + {
  274. +   { &howto_hunk_reloc8, &howto_hunk_reloc16, &howto_hunk_reloc32 },
  275. +   { &howto_hunk_drel8, &howto_hunk_drel16, &howto_hunk_drel32 }
  276. + };
  277. + /* This one is used by the linker and tells us, if a debug hunk should be written out*/
  278. + int write_debug_hunk=0;
  279. + /* This is also used by the linker to set the attribute of sections */
  280. + int amiga_attribute=0;
  281. + static const struct bfd_target *
  282. + amiga_object_p (abfd)
  283. +      bfd *abfd;
  284. + {
  285. +   char buf[8];
  286. +   unsigned int x;
  287. +   struct stat stat_buffer;
  288. +   /* An Amiga object file must be at least 8 bytes long.  */
  289. +   if (bfd_read ((PTR) buf, 1, 8, abfd) != 8)
  290. +     {
  291. +       bfd_set_error(bfd_error_wrong_format);
  292. +       return 0;
  293. +     }
  294. +   /* Does it look like an Amiga object file?  */
  295. +   x = GL(buf);
  296. +   if ((x != HUNK_UNIT) && (x != HUNK_HEADER))
  297. +     {
  298. +       /* Not an Amiga file.  */
  299. +       bfd_set_error(bfd_error_wrong_format);
  300. +       return 0;
  301. +     }
  302. +   /* So far it seems to be an Amiga file.  Now slurp it
  303. +      in and examine it closer.  */
  304. +   stat_buffer.st_size=0;
  305. +   if ((-1 == fstat (fileno ((FILE *) abfd->iostream), &stat_buffer))||(stat_buffer.st_size%4!=0))
  306. +     { /* Error during system call or file length is not multiple of longword size */
  307. +       bfd_set_error((stat_buffer.st_size%4==0)?bfd_error_system_call:bfd_error_wrong_format);
  308. +       return 0;
  309. +     }
  310. +   /* Can't fail and return (but must be declared boolean to suit
  311. +      other bfd requirements).  */
  312. +   (void) amiga_mkobject (abfd);
  313. +   AMIGA_DATA(abfd)->first_byte = (unsigned long *) bfd_alloc (abfd, stat_buffer.st_size);
  314. +   bfd_seek (abfd, 0, SEEK_SET);
  315. +   
  316. +   if (bfd_read (AMIGA_DATA(abfd)->first_byte, 1, stat_buffer.st_size, abfd)!=stat_buffer.st_size)
  317. +     {
  318. +       /* Error, reading file */
  319. +      return (const struct bfd_target *)0;
  320. +    }
  321. +   AMIGA_DATA(abfd)->file_pointer = AMIGA_DATA(abfd)->first_byte;
  322. +   AMIGA_DATA(abfd)->file_end = (unsigned long *)((unsigned char *)AMIGA_DATA(abfd)->first_byte + stat_buffer.st_size);
  323. +   if (!amiga_digest_file (abfd))
  324. +     {
  325. +       /* Something went wrong.  */
  326. +       return (const struct bfd_target *) 0;
  327. +     }
  328. +   /* Set default architecture to m68k:68000.  */
  329. +   /* So we can link on 68000 AMIGAs..... */
  330. +   abfd->arch_info = bfd_scan_arch ("m68k:68000");
  331. +   return (abfd->xvec);
  332. + }
  333. + /* Skip over the hunk length longword + the number of longwords given there.  */
  334. + #define next_hunk(abfd) \
  335. +   { AMIGA_DATA(abfd)->file_pointer += 1 + GL(AMIGA_DATA(abfd)->file_pointer); }
  336. + static asection *
  337. + amiga_get_section_by_hunk_number (abfd, hunk_number)
  338. +      bfd *abfd;
  339. +       long hunk_number;
  340. + {
  341. +   /* A cache, so we don't have to search the entire list every time.  */
  342. +   static asection *last_reference;
  343. +   asection *p;
  344. +   switch(hunk_number)
  345. +     {
  346. +     case -1:
  347. +       return bfd_abs_section_ptr;
  348. +       break;
  349. +     case -2:
  350. +       return bfd_und_section_ptr;
  351. +       break;
  352. +     case -3: 
  353. +       return bfd_com_section_ptr;
  354. +       break;
  355. +     default:
  356. +       if (last_reference)
  357. +     if (last_reference->target_index == hunk_number)
  358. +       return last_reference;
  359. +       for (p = abfd->sections; p != NULL; p = p->next)
  360. +     if (p->target_index == hunk_number)
  361. +       {
  362. +         last_reference = p;
  363. +         return p;
  364. +       }
  365. +       BFD_FAIL();
  366. +       return (asection *) 0;
  367. +     }
  368. + return NULL;
  369. + }
  370. + static boolean
  371. + amiga_add_reloc (abfd, section, offset, symbol, howto, target_hunk)
  372. +      bfd *abfd;
  373. +      asection *section;
  374. +      bfd_size_type offset;
  375. +      amiga_symbol_type * symbol;
  376. +      reloc_howto_type *howto;
  377. +      long target_hunk;
  378. + {
  379. +   amiga_reloc_type *reloc;
  380. +   reloc = (amiga_reloc_type *) bfd_zalloc (abfd, sizeof (amiga_reloc_type));
  381. +   reloc->next = 0;
  382. +   if (!reloc)
  383. +     {
  384. +       bfd_set_error(bfd_error_no_memory);
  385. +       return(false);
  386. +     }
  387. +   abfd -> flags |= HAS_RELOC;
  388. +   section -> flags |= SEC_RELOC;
  389. +   if (amiga_per_section(section)->reloc_tail)
  390. +     amiga_per_section(section)->reloc_tail->next = reloc;
  391. +   else
  392. +     section->relocation = (struct reloc_cache_entry *) reloc;
  393. +   amiga_per_section(section)->reloc_tail = reloc;
  394. +   amiga_per_section(section)->reloc_tail->next = NULL;
  395. +   reloc->relent.address = offset;
  396. +   reloc->relent.addend = 0;
  397. +   reloc->relent.howto = howto;
  398. +   if (symbol==NULL) /* relative to section */
  399. +     reloc->symbol=(amiga_symbol_type *)(amiga_get_section_by_hunk_number(abfd,target_hunk)->symbol);
  400. +   else
  401. +     reloc->symbol = symbol;
  402. +   reloc->relent.sym_ptr_ptr=(asymbol **)(&(reloc->symbol));
  403. +   reloc->target_hunk = target_hunk;
  404. +   return true;
  405. + }
  406. + /* BFD doesn't currently allow multiple sections with the same
  407. +    name, so we try a little harder to get a unique name.  */
  408. + asection *
  409. + amiga_make_unique_section (abfd, name)
  410. +      bfd *abfd;
  411. +      CONST char *name;
  412. + {
  413. +   asection *section;
  414. +   section = bfd_make_section (abfd, name);
  415. +   if (!section)
  416. +     {
  417. +       int i = 1;
  418. +       char *new_name;
  419. +       new_name = bfd_alloc (abfd, strlen(name) + 3);
  420. +       /* We try to come up with an original name (since BFD
  421. +      currently requires all sections to have different names).  */
  422. +       while (!section && (i<=99))
  423. +     {
  424. +       sprintf (new_name, "%s_%u", name, i);
  425. +       section = bfd_make_section (abfd, new_name);
  426. +     }
  427. +       if (!section)
  428. +     {
  429. +       /* Complain about the given name.  */
  430. +       bfd_set_error(bfd_error_bad_value);
  431. +       return 0;
  432. +     }
  433. +     }
  434. +   return section;
  435. + }
  436. + #if DEBUG_AMIGA
  437. + #define DPRINTHUNK(x)   fprintf (stderr,"Processing %s hunk (0x%x)...",\
  438. +       (x) == HUNK_UNIT ? "HUNK_UNIT" :\
  439. +       (x) == HUNK_NAME ? "HUNK_NAME" :\
  440. +       (x) == HUNK_DEBUG ? "HUNK_DEBUG" :\
  441. +       (x) == HUNK_OVERLAY ? "HUNK_OVERLAY" :\
  442. +       (x) == HUNK_BREAK ? "HUNK_BREAK" :\
  443. +       (x) == HUNK_HEADER ? "HUNK_HEADER" :\
  444. +       (x) == HUNK_CODE ? "HUNK_CODE" :\
  445. +       (x) == HUNK_DATA ? "HUNK_DATA" :\
  446. +       (x) == HUNK_BSS ? "HUNK_BSS" :\
  447. +       (x) == HUNK_RELOC8 ? "HUNK_RELOC8" :\
  448. +       (x) == HUNK_RELOC16 ? "HUNK_RELOC16" :\
  449. +       (x) == HUNK_RELOC32 ? "HUNK_RELOC32" :\
  450. +       (x) == HUNK_DREL8 ? "HUNK_DREL8" :\
  451. +       (x) == HUNK_DREL16 ? "HUNK_DREL16" :\
  452. +       (x) == HUNK_DREL32 ? "HUNK_DREL32" :\
  453. +       (x) == HUNK_SYMBOL ? "HUNK_SYMBOL" :\
  454. +       (x) == HUNK_EXT ? "HUNK_EXT" :\
  455. +       (x) == HUNK_END ? "HUNK_END" :\
  456. +       (x) == HUNK_LIB ? "HUNK_LIB" :\
  457. +       (x) == HUNK_INDEX ? "HUNK_INDEX" :\
  458. +       "*unknown*",(x))
  459. + #define DPRINTHUNKEND fprintf(stderr,"...done\n")
  460. + #else
  461. + #define DPRINTHUNK(x) 
  462. + #define DPRINTHUNKEND 
  463. + #endif
  464. + static boolean amiga_read_unit(bfd *abfd);
  465. + static boolean amiga_read_load(bfd *abfd);
  466. + static boolean amiga_handle_cdb_hunk(bfd *abfd, int ht,int hn,int ha,int hs);
  467. + static boolean amiga_handle_rest(bfd *abfd,asection *cs,boolean isload);
  468. + static boolean
  469. + amiga_digest_file (abfd)
  470. +      bfd *abfd;
  471. + {
  472. +   amiga_data_type *amiga_data = AMIGA_DATA(abfd);
  473. +   int hunk_type;
  474. +   hunk_type = HUNK_VALUE(GL(amiga_data->file_pointer++));
  475. +   switch (hunk_type)
  476. +     {
  477. +     case HUNK_UNIT:
  478. +       /* Read in the unit  */
  479. +       if (!amiga_read_unit(abfd)) /* Error */
  480. +     return(false);
  481. +       break;
  482. +       
  483. +     case HUNK_HEADER:
  484. +       /* This is a load file, well it should not be used with linking,
  485. +      but it is possible to do so, so always allow it. */
  486. +       
  487. +       /* Read in the load file */
  488. +       if (!amiga_read_load(abfd)) /* Error */
  489. +     {
  490. +       return(false);
  491. +     }
  492. +       break;
  493. +     } /* of switch hunk_type */
  494. +   /* If there is any trailing garbage, i.e. we are not at EOF, then
  495. +      complain and reject the file... */
  496. +   if (amiga_data->file_pointer!=amiga_data->file_end) /* ooops */
  497. +     {
  498. +       bfd_set_error(bfd_error_wrong_format);
  499. +       return(false);
  500. +     }
  501. +   /* Success, all went well... */
  502. +  return(true);
  503. + }/* of amiga_digest_file */
  504. + /* If we read over the end of file, error */
  505. + #define TOO_LARGE_P   if (amiga_data->file_pointer>=amiga_data->file_end)\
  506. +     {DPRINT(10,("Overflow of file pointer\n"));bfd_set_error(bfd_error_wrong_format);return false;}
  507. + /* Read in Unit file */
  508. + /* file pointer is located after the HUNK_UNIT LW */
  509. + static boolean amiga_read_unit(bfd *abfd)
  510. + {
  511. +   amiga_data_type *amiga_data = AMIGA_DATA(abfd);
  512. +   int hunk_type;
  513. +   int hunk_number=0;
  514. +   int hunk_attribute=0;
  515. +   /* The unit name, if given, has no meaning to us, 
  516. +      since we are not in an archive. 
  517. +      We could set the name of abfd to the name, but that 
  518. +      may cause confusion... 
  519. +      So just ignore the unit name 
  520. +      ST 121194 */
  521. +   amiga_data->file_pointer+=GL(amiga_data->file_pointer)+1;
  522. +   TOO_LARGE_P;
  523. +   while (true)
  524. +     {
  525. +       /* Now there may be CODE, DATA, BSS, SYMBOL, DEBUG, RELOC Hunks */
  526. +       
  527. +       hunk_type=HUNK_VALUE(GL(amiga_data->file_pointer)); /* Type of next hunk */
  528. +       hunk_attribute=HUNK_ATTRIBUTE(GL(amiga_data->file_pointer++));
  529. +       hunk_attribute=(hunk_attribute==HUNK_ATTR_CHIP)?
  530. +     MEMF_CHIP:(hunk_attribute==HUNK_ATTR_FAST)?MEMF_FAST:0;
  531. +       
  532. +     
  533. +       switch(hunk_type)
  534. +     {
  535. +     case HUNK_DEBUG:
  536. +       /* We ignore debug hunks in UNITS, for now, because gnu's debug hunks
  537. +          are only added by the linker to LOAD files.....
  538. +          And anyhow, a.out format can keep much more information for units...
  539. +          */
  540. +       amiga_data->file_pointer+=1+GL(amiga_data->file_pointer);
  541. +       TOO_LARGE_P;
  542. +       break;
  543. +     case HUNK_NAME:
  544. +     case HUNK_CODE:
  545. +     case HUNK_DATA:
  546. +     case HUNK_BSS:
  547. +       /* Handle this hunk, including relocs, etc.
  548. +          The finishing HUNK_END is consumed by the routine
  549. +          */
  550. +       if (!amiga_handle_cdb_hunk(abfd,hunk_type,hunk_number++,hunk_attribute,-1))
  551. +         return(false);
  552. +       break;
  553. +     default:
  554. +       /* Something very nasty happened:
  555. +          Illegal Hunk occured....
  556. +          */
  557. +       bfd_set_error(bfd_error_wrong_format);
  558. +       return(false);
  559. +       break;
  560. +       
  561. +     }/* Of switch hunk_type */
  562. +       /* Last HUNK ?*/
  563. +       if (amiga_data->file_pointer==amiga_data->file_end)
  564. +     return true;
  565. +       TOO_LARGE_P; /* Sanity check */
  566. +   
  567. +       /* Next hunk */
  568. +     }/* Of while */
  569. + }/* Of amiga_read_unit */
  570. + #define MAX_HUNKS 200 /* Max # of hunks. we can read in.. */
  571. + /* Read a load file */
  572. + static boolean amiga_read_load(bfd *abfd)
  573. + {
  574. +   amiga_data_type *amiga_data = AMIGA_DATA(abfd); 
  575. +   int hunk_sizes[MAX_HUNKS]; /* If there are more hunks than this, we are in trouble...*/
  576. +   int hunk_attributes[MAX_HUNKS];
  577. +   int hunk_number=0;
  578. +   int hunk_type;
  579. +   int max_hunk_number=0;
  580. +   int i,n;
  581. +   TOO_LARGE_P; /* Sanity */
  582. +   /* Read hunk lengths (and memory attributes...) */
  583. +   /* Read in each hunk */
  584. +   /* If there are resident libs: abort (obsolete feature) */
  585. +   if (GL(amiga_data->file_pointer++)!=0)
  586. +     {
  587. +       bfd_set_error(bfd_error_wrong_format);
  588. +       return(false);
  589. +     }
  590. +   TOO_LARGE_P;
  591. +   max_hunk_number=GL(amiga_data->file_pointer++);
  592. +   if (max_hunk_number>MAX_HUNKS) /* Ooops... too much hunks */
  593. +     {
  594. +       fprintf(stderr,"File %s has too many hunks (%d), aborting\n",abfd->filename,max_hunk_number);
  595. +       bfd_set_error(bfd_error_wrong_format);
  596. +       return(false);
  597. +     }
  598. +   /* Sanity */
  599. +   if ((max_hunk_number<1)||
  600. +       (amiga_data->file_pointer+max_hunk_number+2>=amiga_data->file_end))
  601. +     {
  602. +       bfd_set_error(bfd_error_wrong_format);
  603. +       return(false);
  604. +     }
  605. +   /* Num of root hunk must be 0 */
  606. +   if (GL(amiga_data->file_pointer++)!=0)
  607. +     {
  608. +       bfd_set_error(bfd_error_wrong_format);
  609. +       return(false);
  610. +     }
  611. +   /* Num of last hunk must be mhn-1 */
  612. +   if (GL(amiga_data->file_pointer++)!=max_hunk_number-1)
  613. +     {
  614. +       bfd_set_error(bfd_error_wrong_format);
  615. +       return(false);
  616. +     }
  617. +   /* Now, read in sizes and memory attributes */
  618. +   for (i=0;i<max_hunk_number;i++)
  619. +     {
  620. +       n=HUNK_VALUE(GL(amiga_data->file_pointer));
  621. +       hunk_sizes[i]=n<<2;
  622. +       n=HUNK_ATTRIBUTE(GL(amiga_data->file_pointer++));
  623. +       if (n==HUNK_ATTR_FOLLOWS) /* Attribute is in next long */
  624. +     hunk_attributes[i]=GL(amiga_data->file_pointer++);
  625. +       else
  626. +     hunk_attributes[i]= (n==HUNK_ATTR_CHIP)?MEMF_CHIP:
  627. +       (n==HUNK_ATTR_FAST)?MEMF_FAST:0;
  628. +     }
  629. +   TOO_LARGE_P; /* Sanity */
  630. +   /* We can now read in all the hunks */
  631. +   for (hunk_number=0;hunk_number<max_hunk_number;hunk_number++)
  632. +     {
  633. +       hunk_type=HUNK_VALUE(GL(amiga_data->file_pointer++));
  634. +       /* This may be HUNK_NAME, CODE, BSS, DEBUG, DATA */
  635. +       switch(hunk_type)
  636. +     {
  637. +     case HUNK_NAME:
  638. +     case HUNK_CODE:
  639. +     case HUNK_DATA:
  640. +     case HUNK_BSS:
  641. +     case HUNK_DEBUG:
  642. +       if (
  643. +       !amiga_handle_cdb_hunk(abfd,hunk_type,hunk_number,hunk_attributes[hunk_number],
  644. +                 hunk_sizes[hunk_number]))
  645. +         {
  646. +           bfd_set_error(bfd_error_wrong_format);
  647. +           return(false);
  648. +         }
  649. +       break;
  650. +     default:
  651. +       /* illegal hunk */
  652. +       bfd_set_error(bfd_error_wrong_format);
  653. +       return(false);
  654. +       break;
  655. +     }/* Of switch */
  656. +     }
  657. +   if (amiga_data->file_pointer!=amiga_data->file_end)
  658. +     {
  659. +       bfd_set_error(bfd_error_wrong_format);
  660. +       return(false);
  661. +     }
  662. +   return(true);
  663. + }/* Of amiga_read_load */
  664. + /* Handle NAME, CODE, DATA, BSS, DEBUG Hunks */
  665. + static boolean 
  666. + amiga_handle_cdb_hunk(bfd *abfd, 
  667. +               int hunk_type, 
  668. +               int hunk_number,
  669. +               int hunk_attribute, /* MEMF_CHIP, etc. */
  670. +               int hunk_size)
  671. + /* If hunk_size==-1, then we are digesting a HUNK_UNIT */
  672. + {
  673. +   amiga_data_type *amiga_data = AMIGA_DATA(abfd);
  674. +   char *current_name=NULL;
  675. +   int len;
  676. +   asection *current_section=NULL;
  677. +   if (hunk_type==HUNK_NAME) /* get name */
  678. +     {
  679. +       len=HUNK_VALUE(GL(amiga_data->file_pointer))<<2; /* Length */
  680. +       /* DIRTY: We move the name 4 bytes towards the beginning of the file,
  681. +             overwriting the length,
  682. +             and end it with a '\0' */
  683. +       strncpy((char *)amiga_data->file_pointer,(char *)(amiga_data->file_pointer+1),len);
  684. +       *(((char *)amiga_data->file_pointer)+len)='\0';
  685. +       current_name=(char *)amiga_data->file_pointer;
  686. +       amiga_data->file_pointer+=1+(len>>2); /* Advance */
  687. +       TOO_LARGE_P;
  688. +       hunk_type=HUNK_VALUE(GL(amiga_data->file_pointer++)); /* Next hunk */
  689. +       if (hunk_size==-1) /* In a unit ==> Get attribute from file */
  690. +     {
  691. +       hunk_attribute=HUNK_ATTRIBUTE(GL(amiga_data->file_pointer-1));
  692. +       hunk_attribute=(hunk_attribute==HUNK_ATTR_CHIP)?MEMF_CHIP:
  693. +                  (hunk_attribute==HUNK_ATTR_FAST)?MEMF_FAST:0;
  694. +     }
  695. +     }
  696. +   else /* Set curent name to something appropriate */
  697. +     current_name=(hunk_type==HUNK_CODE)?".text":
  698. +                  (hunk_type==HUNK_BSS)?".bss":".data";
  699. +       
  700. +   /* file_pointer is now at  hunk_type */
  701. +   switch (hunk_type)
  702. +     {
  703. +     case HUNK_CODE:
  704. +       /* Handle code hunk */
  705. +       len=HUNK_VALUE(GL(amiga_data->file_pointer++))<<2; /* Length of section */
  706. +       if (len>hunk_size) /* len may be shorter than hunk_size... */ 
  707. +     if (hunk_size==-1)
  708. +       hunk_size=len;
  709. +     else
  710. +       {
  711. +         bfd_set_error(bfd_error_wrong_format);
  712. +         return false;
  713. +       }
  714. +       /* Make new section */
  715. +       current_section=amiga_make_unique_section(abfd,current_name);
  716. +       if (!current_section)
  717. +     return false;
  718. +       current_section->filepos=(char *)(amiga_data->file_pointer)-(char *)amiga_data->first_byte;
  719. +       current_section->_raw_size=hunk_size;
  720. +       current_section->_cooked_size=hunk_size;
  721. +       current_section->target_index=hunk_number;
  722. +       bfd_set_section_flags(abfd,current_section, 
  723. +                 SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS);
  724. +       amiga_per_section(current_section)->real_length=len; /* real size */
  725. +       amiga_per_section(current_section)->attribute=hunk_attribute;
  726. +       amiga_data->file_pointer+=(len>>2); /* next hunk */
  727. +       if (!amiga_handle_rest(abfd,current_section,hunk_size!=-1))
  728. +     return false;
  729. +       
  730. +       break;
  731. +     case HUNK_DATA:
  732. +       /* Handle data hunk */
  733. +       len=HUNK_VALUE(GL(amiga_data->file_pointer++))<<2; /* Length of section */
  734. +       if (len>hunk_size) /* len may be shorter than hunk_size... */ 
  735. +     if (hunk_size==-1)
  736. +       hunk_size=len;
  737. +     else
  738. +       {
  739. +         bfd_set_error(bfd_error_wrong_format);
  740. +         return false;
  741. +       }
  742. +       current_section=amiga_make_unique_section(abfd,current_name);
  743. +       if (!current_section)
  744. +     return false;
  745. +       current_section->filepos=(char *)amiga_data->file_pointer-(char *)amiga_data->first_byte;
  746. +       current_section->_raw_size=hunk_size;
  747. +       current_section->_cooked_size=hunk_size;
  748. +       current_section->target_index=hunk_number;
  749. +       bfd_set_section_flags(abfd,current_section, 
  750. +                 SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS);
  751. +       amiga_per_section(current_section)->real_length=len; /* real size */
  752. +       amiga_per_section(current_section)->attribute=hunk_attribute;
  753. +       amiga_data->file_pointer+=(len>>2); /* next hunk */
  754. +       if (!amiga_handle_rest(abfd,current_section,hunk_size!=-1))
  755. +     return false;
  756. +       break;
  757. +     case HUNK_BSS:
  758. +       /* Handle bss hunk */
  759. +       
  760. +       len=HUNK_VALUE(GL(amiga_data->file_pointer++))<<2; /* Length of section */
  761. +       if (len>hunk_size) /* len may be shorter than hunk_size... */ 
  762. +     if (hunk_size==-1)
  763. +       hunk_size=len;
  764. +     else
  765. +       {
  766. +         bfd_set_error(bfd_error_wrong_format);
  767. +         return false;
  768. +       }
  769. +       current_section=amiga_make_unique_section(abfd,current_name);
  770. +       if (!current_section)
  771. +     return false;
  772. +       current_section->filepos=(file_ptr)-1;
  773. +       current_section->_raw_size=hunk_size;
  774. +       current_section->_cooked_size=hunk_size;
  775. +       current_section->target_index=hunk_number;
  776. +       bfd_set_section_flags(abfd,current_section, SEC_ALLOC );
  777. +       amiga_per_section(current_section)->real_length=len; /* real size */
  778. +       amiga_per_section(current_section)->attribute=hunk_attribute;
  779. +       if (!amiga_handle_rest(abfd,current_section,hunk_size!=-1))
  780. +     return false;
  781. +       break;
  782. +     case HUNK_DEBUG:
  783. +       if (hunk_size==-1) /* We are digesting a unit ==> ignore debug hunks */
  784. +     {
  785. +       amiga_data->file_pointer+=1+GL(amiga_data->file_pointer);
  786. +       return(true);
  787. +     }
  788. +       /* We are digesting a load file, so check for gnu debug hunk, else ignore it */
  789. +       /* format of gnu debug hunk is:
  790. +           HUNK_DEBUG
  791. +               N
  792. +             0413.L    Magic number
  793. +       symtabsize
  794. +       strtabsize
  795. +       symtabdata  [length=symtabsize]
  796. +       strtabdata  [length=strtabsize]
  797. +           [pad bytes]
  798. +       */
  799. +       if (GL(amiga_data->file_pointer+1)==0413) /* GNU DEBUG HUNK */
  800. +     {
  801. +       /*FIXME: we should add the symbols in the debug hunk to symtab... */
  802. +       
  803. +       amiga_data->symtab_size=GL(amiga_data->file_pointer+2);
  804. +       amiga_data->stringtab_size=GL(amiga_data->file_pointer+3);
  805. +       adata(abfd).sym_filepos=
  806. +         (file_ptr)((char *)(amiga_data->file_pointer +4)-(char *)amiga_data->first_byte);
  807. +       adata(abfd).str_filepos=adata(abfd).sym_filepos+amiga_data->symtab_size;
  808. +       amiga_data->file_pointer+=1+GL(amiga_data->file_pointer);
  809. +     }
  810. +       else /* NOT GNU DEBUG HUNK... */
  811. +     {
  812. +       /* ignore it */
  813. +       amiga_data->file_pointer+=1+GL(amiga_data->file_pointer);
  814. +     }
  815. +       /* there has to be an HUNK_END here... */
  816. +       if (GL(amiga_data->file_pointer++)!=HUNK_END)
  817. +     {
  818. +       bfd_set_error(bfd_error_wrong_format);
  819. +       return(false);
  820. +     }
  821. +       break;
  822. +     default:
  823. +       bfd_set_error(bfd_error_wrong_format);
  824. +       return false;
  825. +       break;
  826. +     }/* of switch hunk_type */
  827. +   return(true);
  828. + }/* Of amiga_handle_cdb_hunk */
  829. + /* Handle rest of a hunk 
  830. +    I.e.: Relocs, EXT, SYMBOLS... */
  831. + static boolean amiga_handle_rest(bfd *abfd, asection *current_section, boolean isload)
  832. + {
  833. +   amiga_data_type *amiga_data = AMIGA_DATA(abfd);
  834. +   int hunk_type;
  835. +   int type;
  836. +   int len;
  837. +   int n;
  838. +   unsigned long **p;
  839. +   struct amiga_raw_symbol *sp=NULL;
  840. +   while (1)/* loop */
  841. +     {
  842. +       hunk_type=GL(amiga_data->file_pointer++);
  843. +       switch (hunk_type)
  844. +     {
  845. +     case HUNK_END: /* Reached end */
  846. +       return(true); /* Done */
  847. +       break;
  848. +       /* Relocs.... */
  849. +     case HUNK_RELOC8:
  850. +     case HUNK_RELOC16:
  851. +     case HUNK_RELOC32:
  852. +     case HUNK_DREL8:
  853. +     case HUNK_DREL16:
  854. +     case HUNK_DREL32:
  855. +       /* We leave them alone, but attach them to the section,
  856. +          so we can read them in later.....*/
  857. +       
  858. +       /* But we already set the flags HAS_RELOC, SEC_RELOC */
  859. +       /* We also maintain the reloc count */
  860. +       /* This is simply done by adding all addresses of relocs to an array in the section */
  861. +       p=amiga_per_section(current_section)->raw_relocs;
  862. +       if (amiga_per_section(current_section)->max_raw_relocs<=
  863. +           amiga_per_section(current_section)->num_raw_relocs) /* allocate more space */
  864. +         {
  865. +           if (p==NULL)
  866. +         {
  867. +           p=(unsigned long **)malloc(sizeof(unsigned long *)*10); /* initial */
  868. +           amiga_per_section(current_section)->max_raw_relocs=10;
  869. +           amiga_per_section(current_section)->num_raw_relocs=0;
  870. +         }
  871. +           else /* More space */
  872. +         {
  873. +           p=(unsigned long **)realloc((void *)p,
  874. +                  sizeof(unsigned long *)*(amiga_per_section(current_section)->max_raw_relocs+30));
  875. +           amiga_per_section(current_section)->max_raw_relocs+=30;
  876. +         }
  877. +           if (p==NULL)
  878. +         {
  879. +           bfd_set_error(bfd_error_no_memory);
  880. +           return(false);
  881. +         }
  882. +           amiga_per_section(current_section)->raw_relocs=p;
  883. +         }
  884. +       p[amiga_per_section(current_section)->num_raw_relocs++]=amiga_data->file_pointer-1;
  885. +       
  886. +       abfd->flags|=HAS_RELOC;
  887. +       current_section->flags|=SEC_RELOC;
  888. +       /* Advance file_pointer */
  889. +       while ((n=GL(amiga_data->file_pointer++)))
  890. +         {
  891. +           amiga_data->file_pointer+=1+n;
  892. +           current_section->reloc_count+=n;
  893. +         }
  894. +       break;
  895. +       /* Symbol definition */
  896. +     case HUNK_SYMBOL:
  897. +       /* In a unit, we ignore these, since all symbol information comes with HUNK_EXT,
  898. +          in a load file, these are added */
  899. +       if (!isload)
  900. +         {
  901. +           int foo;
  902. +           
  903. +           while ((foo=GL(amiga_data->file_pointer))!=0)
  904. +         amiga_data->file_pointer+=foo+2;
  905. +           amiga_data->file_pointer++;
  906. +           break;
  907. +         }
  908. +       /* We add these, by falling through... */
  909. +     case HUNK_EXT:
  910. +       /* We leave these alone, until they are requested by the user */
  911. +       sp=amiga_per_section(current_section)->last;
  912. +       
  913. +       if (sp==NULL) /* First one added */
  914. +         {
  915. +           amiga_per_section(current_section)->last=amiga_per_section(current_section)->first=
  916. +         (struct amiga_raw_symbol *)(amiga_data->file_pointer-1);
  917. +           *(amiga_data->file_pointer-1)=0;
  918. +         }
  919. +       else
  920. +         {
  921. +           sp->next=(struct amiga_raw_symbol *)(amiga_data->file_pointer-1);
  922. +           *(amiga_data->file_pointer-1)=0;
  923. +           amiga_per_section(current_section)->last=sp->next;
  924. +         }
  925. +       /* skip these */
  926. +       while ((n=GL(amiga_data->file_pointer)))
  927. +         {
  928. +           amiga_data->file_pointer++;
  929. +           type=(n>>24)&0xff;
  930. +           len=n&0xffffff;
  931. +           
  932. +           amiga_data->file_pointer+=len; /* skip name */
  933. +           switch(type)
  934. +         {
  935. +         case EXT_SYMB: /* Symbol hunks are relative to hunk start... */
  936. +         case EXT_DEF: /* def relative to hunk */
  937. +         case EXT_ABS: /* def absolute */
  938. +           abfd->flags|=HAS_SYMS; /* We have symbols */
  939. +           abfd->symcount++;
  940. +           amiga_data->file_pointer++;
  941. +           break;
  942. +         case EXT_REF8: /* 8 bit ref */
  943. +         case EXT_REF16: /* 16 bit ref */
  944. +         case EXT_REF32: /* 32 bit ref */
  945. +         case EXT_DEXT8: /* 8 bit base relative ref */
  946. +         case EXT_DEXT16: /* 16 bit " "*/
  947. +         case EXT_DEXT32: /* 32 bit " " */
  948. +           abfd->flags|=HAS_SYMS;
  949. +           n=GL(amiga_data->file_pointer);
  950. +           if (n)
  951. +             {
  952. +               abfd->flags|=HAS_RELOC;
  953. +               current_section->flags|=SEC_RELOC;
  954. +             }
  955. +           current_section->reloc_count+=n;
  956. +           amiga_data->file_pointer+=1+n;
  957. +           break;
  958. +           
  959. +         case EXT_COMMON: /* Common ref/def */
  960. +           abfd->flags|=HAS_SYMS;
  961. +           abfd->symcount++;
  962. +           n=GL(amiga_data->file_pointer+1);
  963. +           if (n)
  964. +             {
  965. +               abfd->flags|=HAS_RELOC;
  966. +               current_section->flags|=SEC_RELOC;
  967. +             }
  968. +               
  969. +           current_section->reloc_count+=n;
  970. +           amiga_data->file_pointer+=2+n;
  971. +           break;
  972. +           
  973. +         default: /* error */
  974. +           
  975. +           bfd_set_error(bfd_error_wrong_format);
  976. +           return false;
  977. +           break;
  978. +         }/* of switch type */
  979. +           
  980. +         }/* Of while */
  981. +       amiga_data->file_pointer++;
  982. +       break;
  983. +     default: /* error */
  984. +       bfd_set_error(bfd_error_wrong_format);
  985. +       return(false);
  986. +       break;
  987. +     }/* Of switch */
  988. +     }/* of while */
  989. +   return(true);
  990. + }/* of amiga_handle_rest*/
  991. + static boolean
  992. + amiga_mkobject (abfd)
  993. +      bfd *abfd;
  994. + {
  995. +   struct amiga_data_struct *rawptr;
  996. +   rawptr = (struct amiga_data_struct *) bfd_zalloc (abfd, sizeof (struct amiga_data_struct));
  997. +   abfd->tdata.amiga_data = rawptr;
  998. +   return true;
  999. + }
  1000. + static boolean amiga_write_section_contents(bfd *, asection *);
  1001. + static boolean amiga_write_symbols(bfd *, asection *);
  1002. + /* used with base relative linking */
  1003. + extern int amiga_base_relative;
  1004. + /* Write out the contents of a bfd */
  1005. + static boolean
  1006. + amiga_write_object_contents (abfd)
  1007. +      bfd *abfd;
  1008. + {
  1009. +   struct amiga_data_struct *amiga_data=AMIGA_DATA(abfd);
  1010. +   sec_ptr p;
  1011. +   unsigned long n[5];
  1012. +   int i;
  1013. +   char b[3];
  1014. +   /* Distinguish UNITS, LOAD Files
  1015. +     Write out hunks+relocs+HUNK_EXT+HUNK_DEBUG (GNU format)*/
  1016. +   DPRINT(5,("Entering write_object_conts\n"));
  1017. +   abfd->output_has_begun=true; /* Output has begun */
  1018. +   /* Distinguish Load files and Unit files */
  1019. +   if (amiga_data->IsLoadFile)
  1020. +     {
  1021. +       DPRINT(5,("Writing Load file\n"));
  1022. +       /* Write out load file header */
  1023. +       n[0]=HUNK_HEADER;
  1024. +       n[1]=0;
  1025. +       n[2]=abfd->section_count;
  1026. +       /* If amiga_base_relative is set, we write out one hunk less */
  1027. +       if (amiga_base_relative)
  1028. +     {
  1029. +       n[2]=abfd->section_count-1;
  1030. +       BFD_ASSERT(abfd->section_count==3); /* Or we are in big trouble */
  1031. +     }
  1032. +       n[3]=0;
  1033. +       n[4]=n[2]-1;
  1034. +       if (bfd_write((PTR)(n),sizeof(unsigned long),5,abfd)!=5*sizeof(unsigned long))
  1035. +     return false;
  1036. +       /* Write out sizes and memory specifiers... */
  1037. +       /* We have to traverse the section list again, bad but no other way... */
  1038. +       for (p=abfd->sections;p!=NULL;p=p->next)
  1039. +     {
  1040. +       if (amiga_base_relative && (strcmp(p->name,".bss")==0)) /* skip */
  1041. +         continue;
  1042. +       /* Get  size for header*/
  1043. +       if (amiga_per_section(p)->real_length!=0)
  1044. +         n[0]=(amiga_per_section(p)->real_length)>>2;
  1045. +       else
  1046. +         n[0]=(p->_raw_size)>>2;
  1047. +       i=amiga_per_section(p)->attribute;
  1048. +       switch (i)
  1049. +         {
  1050. +         case MEMF_CHIP:
  1051. +           n[0]|=0x40000000;
  1052. +           i=1;
  1053. +           break;
  1054. +         case MEMF_FAST:
  1055. +           n[0]|=0x80000000;
  1056. +           i=1;
  1057. +           break;
  1058. +         case 0: /* nothing*/
  1059. +           i=1;
  1060. +           break;
  1061. +         default: /* Special one */
  1062. +           n[0]|=0xc0000000;
  1063. +           n[1]=i;
  1064. +           i=2;
  1065. +           break;
  1066. +         }/* Of switch */
  1067. +       if (bfd_write((PTR)(n),sizeof(unsigned long),i,abfd)!=i*sizeof(unsigned long))
  1068. +     return false;
  1069. +     }/* Of for */
  1070. +     }
  1071. +   else
  1072. +     {/* Unit , no base-relative linking here.... */
  1073. +       /* Write out unit header */
  1074. +       DPRINT(5,("Writing Unit\n"));
  1075. +       n[0]=HUNK_UNIT;
  1076. +       if (bfd_write((PTR)(n),sizeof(unsigned long),1,abfd)!=sizeof(unsigned long))
  1077. +     return false;
  1078. +       i=(strlen(abfd->filename)+3)>>2; /* longword size of name */
  1079. +       if (bfd_write((PTR)(&i),sizeof(unsigned long),1,abfd)!=sizeof(unsigned long))
  1080. +     return false;
  1081. +       if (bfd_write((PTR)(abfd->filename),sizeof(char),strlen(abfd->filename),abfd)!=strlen(abfd->filename))
  1082. +     return false;
  1083. +       /* Pad to lw boundary */
  1084. +       b[0]=b[1]=b[2]='\0';
  1085. +       i=(i<<2)-strlen(abfd->filename);
  1086. +       if (i)
  1087. +     if (bfd_write((PTR)(b),sizeof(char),i,abfd)!=i)
  1088. +       return false;
  1089. +       /* That's all... for units :-)*/
  1090. +     }
  1091. +   /* Write out every section */
  1092. +   for (p=abfd->sections;p!=NULL;p=p->next)
  1093. +     {
  1094. +       if (!amiga_write_section_contents(abfd,p)) /* Write out section data + relocs */
  1095. +     return false;
  1096. +       if (!amiga_write_symbols(abfd,p)) /* Write out symbols, incl HUNK_END */
  1097. +     return false;
  1098. +     }/* of for sections */
  1099. +   /* Write out debug hunk, if requested */
  1100. +   if (amiga_data->IsLoadFile && write_debug_hunk)
  1101. +     {
  1102. +       struct external_nlist {
  1103. +     bfd_byte e_strx[BYTES_IN_WORD];       /* index into string table of name */
  1104. +     bfd_byte e_type[1];                   /* type of symbol */
  1105. +     bfd_byte e_other[1];                  /* misc info (usually empty) */
  1106. +     bfd_byte e_desc[2];                   /* description field */
  1107. +     bfd_byte e_value[BYTES_IN_WORD];      /* value of symbol */
  1108. +       };
  1109. +       extern boolean
  1110. +     translate_to_native_sym_flags(bfd *, asymbol *, struct external_nlist *);
  1111. +       /* We have to convert all the symbols in abfd to a.out style.... */
  1112. +       struct external_nlist *data,*p; /* Were to put the data */
  1113. +       char *strtab; /* string table */
  1114. +       int str_size;
  1115. +       int max_str_size;
  1116. +       asymbol *sym;
  1117. +       asection *s;
  1118. +       if (abfd->symcount)
  1119. +     {
  1120. +       if ((data=(struct external_nlist *)malloc(sizeof(struct external_nlist)*abfd->symcount))==NULL)
  1121. +         {
  1122. +         hunk_no_mem:
  1123. +           fprintf(stderr,"No memory for debug hunk, hunk not written\n");
  1124. +           return true;
  1125. +         }
  1126. +       str_size=4; /* At least*/
  1127. +       max_str_size=400; /* initial value */
  1128. +       if ((strtab=(char *)malloc(max_str_size))==NULL)
  1129. +         {
  1130. +           free((void *)data);
  1131. +           goto hunk_no_mem;
  1132. +         }
  1133. +       /* Now, set the .text, .data and .bss fields in the tdata struct (because
  1134. +          translate_to_native_sym_flags needs them... */
  1135. +       for (i=0,s=abfd->sections;s!=NULL;s=s->next)
  1136. +         if (strcmp(s->name,".text")==0)
  1137. +           {
  1138. +         i|=1;
  1139. +         adata(abfd).textsec=s;
  1140. +           }
  1141. +       else if (strcmp(s->name,".data")==0)
  1142. +         {
  1143. +           i|=2;
  1144. +           adata(abfd).datasec=s;
  1145. +         }
  1146. +       else if (strcmp(s->name,".bss")==0)
  1147. +         {
  1148. +           i|=4;
  1149. +           adata(abfd).bsssec=s;
  1150. +         }
  1151. +       if (i!=7) /* One section missing... */
  1152. +         {
  1153. + free_all:
  1154. +           free(strtab);
  1155. +           free(data);
  1156. +           goto hunk_no_mem;
  1157. +         }
  1158. +       for (p=data,i=0;i<abfd->symcount;i++) /* Translate every symbol */
  1159. +         {
  1160. +           sym=abfd->outsymbols[i];
  1161. +           if (sym!=NULL) /* NULL entries have been written already.... */
  1162. +         {
  1163. +           char *q;
  1164. +           if (!translate_to_native_sym_flags(abfd,sym,p))
  1165. +             goto free_all;
  1166. +           /* Now, add the name of sym to the stringtab */
  1167. +           while (max_str_size<=strlen(sym->name)+1+str_size)
  1168. +             { /* Realloc space */
  1169. +               if ((strtab=(char *)realloc(strtab, max_str_size+1024))==NULL)
  1170. +             {
  1171. +               free(data);
  1172. +               goto hunk_no_mem;
  1173. +             }
  1174. +               max_str_size+=1024;
  1175. +             }
  1176. +           PUT_WORD(abfd,str_size,&(p->e_strx[0])); /* Store index */
  1177. +           for (q=sym->name;strtab[str_size++]=*q++;)
  1178. +             ;
  1179. +           p++;
  1180. +         }
  1181. +         }
  1182. +           
  1183. +           
  1184. +     
  1185. +       /* Write out HUNK_DEBUG, size, 0413.... */
  1186. +       n[0]=HUNK_DEBUG;
  1187. +       n[1]=3+(((p-data)*sizeof(struct nlist)+str_size+3)>>2);
  1188. +       n[2]=0413L; /* Magic number */
  1189. +       n[3]=(p-data)*sizeof(struct nlist);
  1190. +       n[4]=str_size;
  1191. +       if (bfd_write((PTR)(n),sizeof(unsigned long),5,abfd)!=5*sizeof(unsigned long))
  1192. +         return false;
  1193. +       /* Write out symbols */
  1194. +       if (bfd_write((PTR)(data),sizeof(struct nlist),(p-data),abfd)!=(p-data)*sizeof(struct nlist))
  1195. +         return false;
  1196. +       /* Write string tab */
  1197. +       if (bfd_write((PTR)(strtab),sizeof(char),(str_size+3)&(~3),abfd)!=(str_size+3)&(~3))
  1198. +         return false;
  1199. +     }/* Of if abfd->symcount */
  1200. +     }/* Of write out debug hunk */
  1201. +   return true;
  1202. + }
  1203. + /* Write out section contents, including relocs */
  1204. + static boolean
  1205. + amiga_write_section_contents(bfd *abfd, asection * section)
  1206. + {
  1207. +   unsigned long n[2];
  1208. +   int i,j;
  1209. +   unsigned int k;
  1210. +   char b[3];
  1211. +   struct reloc_cache_entry *r;
  1212. +   asection *osection,*sec,*insection;
  1213. +   asymbol *sym_p;
  1214. +   unsigned long *reloc_data=NULL;
  1215. +   int reloc_count=0;
  1216. +   unsigned long *reloc_out=NULL;
  1217. +   unsigned long reloc_types[6]={HUNK_RELOC32, HUNK_RELOC16, HUNK_RELOC8,
  1218. +                   HUNK_DREL32,HUNK_DREL16, HUNK_DREL8};
  1219. +   int reloc_counts[6]={0,0,0,0,0,0};
  1220. +   int out_size=0;
  1221. +   int max_hunk=-1;
  1222. +   int size=0;
  1223. +   char *c_p;
  1224. +   unsigned char *values;
  1225. +   DPRINT(5,("Entered Write-section-conts\n"));
  1226. +   /* If we are base-relative linking and the section is .bss and abfd is a load file, then return */
  1227. +   if (AMIGA_DATA(abfd)->IsLoadFile && amiga_base_relative && (strcmp(section->name,".bss")==0))
  1228. +     return true; /* Nothing 2 do */
  1229. +   /* WRITE out HUNK_NAME + section name */
  1230. +   n[0]=HUNK_NAME;
  1231. +   j=strlen(section->name);
  1232. +   i=(j+3)>>2; /* LW len of name */
  1233. +   n[1]=i;
  1234. +   if (bfd_write((PTR)(n),sizeof(unsigned long),2,abfd)!=2*sizeof(unsigned long))
  1235. +     return false;
  1236. +   if (bfd_write((PTR)(section->name),sizeof(char),j,abfd)!=j)
  1237. +     return false;
  1238. +   b[0]=b[1]=b[2]='\0';
  1239. +   if ((i<<2)-j!=0) /* Pad */
  1240. +     if(bfd_write((PTR)(b),sizeof(char),(i<<2)-j,abfd)!=((i<<2)-j))
  1241. +       return false;
  1242. +   /* Depending on the type of the section, write out HUNK_{CODE|DATA|BSS} */
  1243. +   if (section->flags&SEC_CODE) /* Code section */
  1244. +     n[0]=HUNK_CODE;
  1245. +   else if (section->flags&SEC_DATA) /* data section */
  1246. +     n[0]=HUNK_DATA;
  1247. +   else if (section->flags&SEC_ALLOC) /* BSS */
  1248. +     n[0]=HUNK_BSS;
  1249. +   else /* Error */
  1250. +     {
  1251. +       bfd_set_error(bfd_error_nonrepresentable_section);
  1252. +       return(false);
  1253. +     }
  1254. +   DPRINT(10,("Section type is %lx\n",n[0]));
  1255. +   /* Get attribute for section */
  1256. +   switch (amiga_per_section(section)->attribute)
  1257. +     {
  1258. +     case MEMF_CHIP:
  1259. +       n[0]|=HUNKF_CHIP;
  1260. +       break;
  1261. +     case MEMF_FAST:
  1262. +       n[0]|=HUNKF_FAST;
  1263. +       break;
  1264. +     case 0:
  1265. +       break;
  1266. +     default: /* error , can't represent this */
  1267. +       bfd_set_error(bfd_error_nonrepresentable_section);
  1268. +       return(false);
  1269. +       break;
  1270. +     }/* Of switch */
  1271. +   DPRINT(10,("Section attribute is %lx\n",n[0]));
  1272. +   /* Get real size in n[1], this may be shorter than the size in the header */
  1273. +   n[1]=section->_cooked_size>>2;
  1274. +   if(n[1]==0)
  1275. +     n[1]=section->_raw_size>>2;
  1276. +   if (bfd_write((PTR)(n),sizeof(unsigned long),2,abfd)!=2*sizeof(unsigned long))
  1277. +       return false;
  1278. +   DPRINT(5,("Wrote code and size=%lx\n",n[1]));
  1279. +   /* If a BSS hunk, we're done, else write out section contents */
  1280. +   if (HUNK_VALUE(n[0])==HUNK_BSS)
  1281. +     return true;
  1282. +   DPRINT(5,("Non bss hunk...\n"));
  1283. +   /* Traverse through the relocs, sample them in reloc_data, adjust section data to get 0 addend
  1284. +      Then compactify reloc_data 
  1285. +      Set the entry in the section for the reloc to NULL */
  1286. +   /* Get memory for relocs, we use upper bound */
  1287. +   if ((reloc_data=(unsigned long *)malloc(5*sizeof(unsigned long)*section->reloc_count))==NULL)
  1288. +     {
  1289. +       bfd_set_error(bfd_error_no_memory);
  1290. +       return(false);
  1291. +     }
  1292. +   BFD_ASSERT((section->flags&SEC_IN_MEMORY)!=0);
  1293. +   DPRINT(5,("Section has %d relocs\n",section->reloc_count));
  1294. +   for (i=0;i<section->reloc_count;i++)
  1295. +     {
  1296. +       r=section->orelocation[i];
  1297. +       DPRINT(5,("Doing reloc %d=%lx(%d)\n",i,r,r?r->howto->type:-1));
  1298. +       sym_p=*(r->sym_ptr_ptr); /* The symbol for this section */
  1299. +       insection=sym_p->section;
  1300. +       DPRINT(5,("Sec for reloc is %lx(%s)\n",insection,insection->name));
  1301. +       DPRINT(5,("Symbol for this reloc is %lx(%s)\n",sym_p, sym_p->name));
  1302. +       /* Is reloc relative to a special section ? */
  1303. +       if ((insection==bfd_abs_section_ptr)||(insection==bfd_com_section_ptr)||
  1304. +       (insection==bfd_und_section_ptr)||(insection==bfd_ind_section_ptr))
  1305. +     continue; /* Nothing to do, since this translates to HUNK_EXT */
  1306. +       
  1307. +       r->addend+=sym_p->value; /* Add offset of symbol from section start */
  1308. +       /* Address of reloc has been unchanged since original reloc, or has been adjusted by 
  1309. +      get_relocated_section_contents */
  1310. +       /* For relocs, the vma of the target section is in the data, the addend is
  1311. +      -vma of that section =>No need to add vma*/
  1312. +       /* Add in offset */
  1313. +       r->addend+=insection->output_offset;
  1314. +       osection=insection->output_section; /* target section */
  1315. +       /* Determine which hunk to write, and index of target */
  1316. +       reloc_data[5*reloc_count+1]=1; /* 1 reloc ==> Waste of space */
  1317. +       for (j=0,sec=abfd->sections;sec!=NULL;sec=sec->next,j++)
  1318. +     {
  1319. +       if (sec==osection)
  1320. +         break;
  1321. +     }
  1322. +    
  1323. +       BFD_ASSERT(sec!=NULL);
  1324. +       
  1325. +       if (j>max_hunk) /* Maximum number used */
  1326. +     max_hunk=j;
  1327. +       reloc_data[5*reloc_count+2]=j;
  1328. +       reloc_data[5*reloc_count+3]=r->address;
  1329. +       reloc_data[5*reloc_count+4]=0;
  1330. +       switch(r->howto->type) /* FIXME: Is this sufficient to distinguish them ?*/
  1331. +     {
  1332. +       /* AMIGA specific */
  1333. +     case HUNK_RELOC8:
  1334. +     case HUNK_RELOC16:
  1335. +     case HUNK_RELOC32:
  1336. +     case HUNK_DREL8:
  1337. +     case HUNK_DREL16:
  1338. +     case HUNK_DREL32:
  1339. +       reloc_data[5*reloc_count+1]=r->howto->type;
  1340. +       if (r->howto->type>=HUNK_DREL32)
  1341. +         {
  1342. +           size=2-(r->howto->type-HUNK_DREL32);
  1343. +           reloc_counts[3+r->howto->type-HUNK_DREL32]++;
  1344. +         }
  1345. +       else
  1346. +         {
  1347. +           size=2-(r->howto->type-HUNK_RELOC32); /* 0:8bit, 1:16bit, 2:32 bit */
  1348. +           reloc_counts[r->howto->type-HUNK_RELOC32]++;
  1349. +         }
  1350. +       break;
  1351. +       /* Now, these may occur, if a.out was used as input */
  1352. +     case 0: /* 8 bit ref */
  1353. +       reloc_data[5*reloc_count]=HUNK_RELOC8;
  1354. +       reloc_counts[2]++;
  1355. +       size=0;
  1356. +       break;
  1357. +     case 1: /* 16 bit relative */
  1358. +       reloc_data[5*reloc_count]=HUNK_RELOC16;
  1359. +       reloc_counts[1]++;
  1360. +       size=1;
  1361. +       break;
  1362. +     case 2: /* 32 bit relative */
  1363. +       reloc_data[5*reloc_count]=HUNK_RELOC32;
  1364. +       reloc_counts[0]++;
  1365. +       size=2;
  1366. +       break;
  1367. +     case 9: /* 16 bit base rel */
  1368. +       reloc_data[5*reloc_count+1]=HUNK_DREL16;
  1369. +       reloc_counts[4]++;
  1370. +       size=1;
  1371. +       break;
  1372. +     case 10: /* 32 bit baserel */
  1373. +       reloc_data[5*reloc_count+1]=HUNK_DREL32;
  1374. +       reloc_counts[3]++;
  1375. +       size=2;
  1376. +       break;
  1377. +       /* FIXME: There are other (pc relative) displacements left */
  1378. +     default: /* Error, can't represent this */
  1379. +       bfd_set_error(bfd_error_nonrepresentable_section);
  1380. +       free((void *)reloc_data);
  1381. +       return false;
  1382. +       break;
  1383. +     }/* Of switch */
  1384. +       section->orelocation[i]=NULL;
  1385. +       c_p=((char*)(section->contents))+r->address;
  1386. +       DPRINT(5,("reloc address=%lx,addend=%lx\n",r->address,r->addend));
  1387. +       /* There is no error checking with these.. */
  1388. +       values=(unsigned char *)c_p;
  1389. +       switch (size)
  1390. +     {
  1391. +     case 0: /* adjust byte */
  1392. +       j=(int)(*c_p);
  1393. +       DPRINT(5,("content(b):%x\n",j));
  1394. +       j+=r->addend;
  1395. +       *c_p=(signed char)j;
  1396. +       break;
  1397. +     case 1: /* Adjust word */
  1398. +       k=values[0]|(values[1]<<8);
  1399. +       j=(int)k;
  1400. +       DPRINT(5,("content(w):%x\n",j));
  1401. +       j+=r->addend;
  1402. +       values[0]=j&0xff;
  1403. +       values[1]=(j&0xff00)>>8;
  1404. +       break;
  1405. +     case 2: /* adjust long */
  1406. +       k=values[3]|(values[2]<<8)|(values[1]<<16)|(values[0]<<24);
  1407. +       j=k;
  1408. +       DPRINT(5,("content(l):%x\n",j));
  1409. +       DPRINT(5,("[3,2,1,0]=%x,%x,%x,%x\n",values[3],values[2],values[1],values[0]));
  1410. +       j+=r->addend;
  1411. +       values[3]=j&0xff;
  1412. +       values[2]=(j&0xff00)>>8;
  1413. +       values[1]=(j&0xff0000)>>16;
  1414. +       values[0]=(j&0xff000000)>>24;
  1415. +       break;
  1416. +     }/* of switch */
  1417. +       r->addend=0;
  1418. +       DPRINT(5,("Did adjusting\n"));
  1419. +       reloc_count++;
  1420. +     }/* of for i */
  1421. +   DPRINT(5,("Did all relocs\n"));
  1422. +   /* We applied all the relocs, as far as possible to obtain 0 addend fields */
  1423. +   /* Write the section contents */
  1424. +   if(bfd_write((PTR)(section->contents),sizeof(char),section->_raw_size,abfd)!=section->_raw_size)
  1425. +       return false;
  1426. +   DPRINT(10,("Wrote contents, writing relocs now\n"));
  1427. +   /* We gathered all the relocs, now compactify them */
  1428. +   if (!reloc_count) /* No reloc found ==> We are done */
  1429. +     {
  1430. +       free((void *)reloc_data);
  1431. +       return true;
  1432. +     }
  1433. +   /* There are some relocs.... */
  1434. +   /* Get mem for output array */
  1435. +   if ((reloc_out=(unsigned long *)malloc(5*sizeof(unsigned long)*reloc_count))==NULL)
  1436. +     {
  1437. +       bfd_set_error(bfd_error_no_memory);
  1438. +       free((void *)reloc_data);
  1439. +       return false;
  1440. +     }
  1441. +   /* Sample every reloc type */
  1442. +   for (i=0,out_size=0;i<6;i++)
  1443. +     if (reloc_counts[i]!=0) /* there are some relocs of these */
  1444. +       {
  1445. +     int k,num;
  1446. +     reloc_out[out_size++]=reloc_types[i];
  1447. +     /* sample all of these, for every hunk */
  1448. +     for (j=0;j<=max_hunk;j++) /* For every hunk */
  1449. +       { /* Walk through reloc_data, */
  1450. +         num=0; /* # relocs to hunk j */
  1451. +         for (k=0;k<reloc_count;k++)
  1452. +           if (reloc_data[5*k+2]==j) /* Reloc to this hunk */
  1453. +         {
  1454. +           if (!(num++)) /* one more and was first one */
  1455. +             {
  1456. +               reloc_out[out_size+1]=j; /* write hunk number */
  1457. +             }
  1458. +           reloc_out[out_size+1+num]=reloc_data[5*k+3]; /* offset */
  1459. +         }
  1460. +         if (num) /* There was at least one ref to this hunk */
  1461. +           {
  1462. +         reloc_out[out_size]=num; /* number of refs */
  1463. +         out_size+=2+num; /* adjust */
  1464. +           }
  1465. +       } /* sampled all hunks */
  1466. +     reloc_out[out_size++]=0; /* End of this reloc type */
  1467. +       }/* Of if there is one reloc */
  1468. +   DPRINT(10,("Sampled relocs, write them now\n"));
  1469. +   /* Write out the relocs */
  1470. +   if (bfd_write((PTR)reloc_out,sizeof(unsigned long),out_size,abfd)!=sizeof(unsigned long)*out_size)
  1471. +     {
  1472. +       free((void *)reloc_out);
  1473. +       free((void *)reloc_data);
  1474. +       return (false);
  1475. +     }
  1476. +   free ((void *)reloc_out);
  1477. +   free ((void *)reloc_data);
  1478. +   DPRINT(5,("Leaving write_section...\n"));
  1479. +   return true;
  1480. + }
  1481. + /* Write out symbol information, including HUNK_EXT, DEFS, ABS */
  1482. + /* In the case, we were linking base relative, the symbols of the .bss hunk have been converted already
  1483. + to belong to the .data hunk */
  1484. + static boolean amiga_write_symbols(bfd *abfd, asection *section)
  1485. + {
  1486. +   int i,j;
  1487. +   struct reloc_cache_entry *r;
  1488. +   asection *osection;
  1489. +   asymbol *sym_p;
  1490. +   char b[3]="\0\0\0";
  1491. +   unsigned long n[3];
  1492. +   int symbol_count;
  1493. +   unsigned int symbol_header;
  1494. +   unsigned long type;
  1495. +   int len;
  1496. +   /* If base rel linking and section is .bss ==> exit */
  1497. +   if (amiga_base_relative && (strcmp(section->name,".bss")==0))
  1498. +     return true;
  1499. +   if (section->reloc_count==0 && abfd->symcount==0)
  1500. +     {/* Write HUNK_END */
  1501. +     alldone:
  1502. +       DPRINT(5,("Leaving write_symbols\n"));
  1503. +       n[0]=HUNK_END;
  1504. +       return(bfd_write((PTR)n,sizeof(unsigned long),1,abfd)==sizeof(unsigned long));
  1505. +     }
  1506. +   symbol_count=0;
  1507. +   symbol_header=HUNK_EXT;
  1508. +   /* If this is Loadfile, then do not write HUNK_EXT, but rather HUNK_SYMB*/
  1509. +  /* Write out all the symbol definitions, then HUNK_END 
  1510. +      Now, first traverse the relocs, all entries that are non NULL
  1511. +      have to be taken into account */
  1512. +   /* Determine the type of HUNK_EXT to issue and build a single HUNK_EXT subtype */
  1513. +   /*FIXME: We write out many HUNK_EXT's entries for references to the same symbol.. */
  1514. +   for (i=0;i<section->reloc_count;i++)
  1515. +     {
  1516. +       r=section->orelocation[i];
  1517. +       if (r==NULL) /* Empty entry */
  1518. +     continue;
  1519. +       sym_p=*(r->sym_ptr_ptr); /* The symbol for this section */
  1520. +       osection=sym_p->section; /* The section the symbol belongs to */
  1521. +       /* this section MUST be a special section */
  1522. +       DPRINT(5,("Symbol is %s, section is %lx(%s)\n",sym_p->name,osection,osection->name));
  1523. +       if (osection!=bfd_com_section_ptr) /* Not common symbol */
  1524. +     {
  1525. +       DPRINT(5,("Non common ref\n"));
  1526. +       /* Add a reference to this HUNK */
  1527. +       if ((symbol_count++)==0) /* First write out the HUNK_EXT */
  1528. +         {
  1529. +           j=HUNK_EXT;
  1530. +           if(bfd_write((PTR)(&j),sizeof(int),1,abfd)!=sizeof(int))
  1531. +         return false;
  1532. +         }
  1533. +       /* Determine type of ref */
  1534. +       switch(r->howto->type) /* FIXME: Is this sufficient to distinguish them ?*/
  1535. +         {
  1536. +           /* AMIGA specific */
  1537. +         case 0:
  1538. +         case HUNK_RELOC8:
  1539. +           type=EXT_REF8;
  1540. +           break;
  1541. +         case 1:
  1542. +         case HUNK_RELOC16:
  1543. +           type=EXT_REF16;
  1544. +           break;
  1545. +         case 2:
  1546. +         case HUNK_RELOC32:
  1547. +           type=EXT_REF32;
  1548. +           break;
  1549. +         case HUNK_DREL8:
  1550. +           type=EXT_DEXT8;
  1551. +           break;
  1552. +         case 9:
  1553. +         case HUNK_DREL16:
  1554. +           type=EXT_DEXT16;
  1555. +           break;
  1556. +         case 10:
  1557. +         case HUNK_DREL32:
  1558. +             type=EXT_DEXT32;
  1559. +           break;
  1560. +           
  1561. +           /* FIXME: There are other (pc relative) displacements left */
  1562. +         default: /* Error, can't represent this */
  1563. +           bfd_set_error(bfd_error_nonrepresentable_section);
  1564. +           return false;
  1565. +           break;
  1566. +         }/* Of switch */
  1567. +       DPRINT(5,("Type is %x\n",type));
  1568. +       type<<=24;
  1569. +       type&=0xff000000;
  1570. +       j=strlen(sym_p->name);
  1571. +       len=(j+3)>>2; /* LW Len of name */
  1572. +       
  1573. +       type|=(len & 0xffffff);
  1574. +       if (bfd_write((PTR)(&type),sizeof(unsigned long),1,abfd)!=sizeof(unsigned long))
  1575. +         return false;
  1576. +       if (bfd_write((PTR)(sym_p->name),sizeof(char),j,abfd)!=j)
  1577. +         return false;
  1578. +       if ((len<<2)-j!=0) /* Pad name */
  1579. +         if (bfd_write((PTR)(b),sizeof(char),(len<<2)-j,abfd)!=((len<<2)-j))
  1580. +           return false;
  1581. +       n[0]=1; /* 1 ref at address... */
  1582. +       n[1]=r->address;
  1583. +       if (bfd_write((PTR)(n),sizeof(unsigned long),2,abfd)!=2*sizeof(long))
  1584. +         return false;
  1585. +       
  1586. +       continue; /* Next relocation */
  1587. +     }/* Of is ref to undefined or abs symbol */
  1588. +       
  1589. +       if (osection==bfd_com_section_ptr) /* ref to common symbol */
  1590. +     {
  1591. +       DPRINT(5,("Common ref\n"));
  1592. +       /* If the reference is NOT 32 bit wide absolute , then issue warning */
  1593. +       if ((r->howto->type!=2)&&(r->howto->type!=HUNK_RELOC32))
  1594. +         fprintf(stderr,"Warning: Non 32 bit wide reference to common symbol %s\n",
  1595. +             sym_p->name);
  1596. +       if ((symbol_count++)==0) /* First write out the HUNK_EXT */
  1597. +         {
  1598. +           j=HUNK_EXT;
  1599. +           if(bfd_write((PTR)(&j),sizeof(int),1,abfd)!=sizeof(int))
  1600. +         return false;
  1601. +         }
  1602. +       type=(EXT_COMMON<<24)&0xff000000;
  1603. +       j=strlen(sym_p->name);
  1604. +       len=(j+3)>>2;
  1605. +       type|=(len&0xffffff);
  1606. +       if (bfd_write((PTR)(&type),sizeof(unsigned long),1,abfd)!=sizeof(unsigned long))
  1607. +         return false;
  1608. +       if (bfd_write((PTR)(sym_p->name),sizeof(char),j,abfd)!=j)
  1609. +         return false;
  1610. +       
  1611. +       if ((len<<2)-j!=0) /* Pad name */
  1612. +         if (bfd_write((PTR)(b),sizeof(char),(len<<2)-j,abfd)!=((len<<2)-j))
  1613. +           return false;
  1614. +       n[0]=sym_p->value; /* Size of common block */
  1615. +       n[1]=1;
  1616. +       n[2]=r->address;
  1617. +       if (bfd_write((PTR)(n),sizeof(unsigned long),3,abfd)!=3*sizeof(long))
  1618. +         return false;
  1619. +       
  1620. +       continue;
  1621. +     }/* Of is common section */
  1622. +       DPRINT(10,("Failing...\n"));
  1623. +       BFD_FAIL();
  1624. +     }/* Of traverse relocs */
  1625. +       
  1626. +       
  1627. +   /* Now traverse the symbol table and write out all definitions, that are relative
  1628. +      to this hunk */
  1629. +   /* Absolute defs are always only written out with the first hunk */
  1630. +   /* Don't write out COMMON symbols
  1631. +                      local symbols
  1632. +                      undefined symbols
  1633. +              indirect symbols
  1634. +              warning symbols
  1635. +              debugging symbols
  1636. +              warning symbols
  1637. +              constructor symbols, since they are unrepresentable in HUNK format..*/
  1638. +   DPRINT(10,("Traversing symbol table\n"));
  1639. +   symbol_header=(AMIGA_DATA(abfd)->IsLoadFile)?HUNK_SYMBOL:HUNK_EXT;
  1640. +   for (i=0;i<abfd->symcount;i++)
  1641. +     {
  1642. +       sym_p=abfd->outsymbols[i];
  1643. +       osection=sym_p->section;
  1644. +       DPRINT(5,("%d. symbol(%s), osec=%x(%s)\n",i,sym_p->name,osection,osection->name));
  1645. +       if ((osection==bfd_und_section_ptr)||(osection==bfd_com_section_ptr)||
  1646. +       (osection==bfd_ind_section_ptr))
  1647. +     continue; /* Don't write these */
  1648. +       /* Only write abs defs, if not writing A Loadfile */
  1649. +       if ((osection==bfd_abs_section_ptr)&&(section->index==0)&&!AMIGA_DATA(abfd)->IsLoadFile) /* Write out abs defs */
  1650. +     {
  1651. +       DPRINT(5,("Abs symbol\n"));
  1652. +       if ((symbol_count++)==0) /* First write out the HUNK_EXT */
  1653. +         {
  1654. +           if(bfd_write((PTR)(&symbol_header),sizeof(int),1,abfd)!=sizeof(int))
  1655. +         return false;
  1656. +         }
  1657. +       type=(EXT_ABS<<24)&0xff000000;
  1658. +       j=strlen(sym_p->name);
  1659. +       
  1660. +       len=(j+3)>>2;
  1661. +       
  1662. +       type|=(len & 0xffffff);
  1663. +       if (bfd_write((PTR)(&type),sizeof(unsigned long),1,abfd)!=sizeof(unsigned long))
  1664. +         return false;
  1665. +       if (bfd_write((PTR)(sym_p->name),sizeof(char),j,abfd)!=j)
  1666. +         return false;
  1667. +       
  1668. +       if ((len<<2)-j!=0) /* Pad name */
  1669. +         if (bfd_write((PTR)(b),sizeof(char),(len<<2)-j,abfd)!=((len<<2)-j))
  1670. +           return false;
  1671. +       
  1672. +       n[0]=sym_p->value;
  1673. +       if (bfd_write((PTR)n,sizeof(unsigned long),1,abfd)!=sizeof(unsigned long))
  1674. +         return false;
  1675. +       continue;
  1676. +     }/* Of abs def */
  1677. +       if (osection==bfd_abs_section_ptr) /* Not first hunk. Already written */
  1678. +     continue;
  1679. +       /* If it is a warning symbol, or a constructor symbol or a debugging or a local symbol,
  1680. +      don't write it */
  1681. +       if (sym_p->flags & (BSF_WARNING|BSF_CONSTRUCTOR|BSF_DEBUGGING|BSF_LOCAL))
  1682. +     continue;
  1683. +       /* Now, if osection==section, write it out */
  1684. +       if (osection->output_section==section)
  1685. +     {
  1686. +       DPRINT(5,("Writing it out\n"));
  1687. +       if ((symbol_count++)==0) /* First write out the header */
  1688. +         {
  1689. +           if(bfd_write((PTR)(&symbol_header),sizeof(int),1,abfd)!=sizeof(int))
  1690. +         return false;
  1691. +         }
  1692. +       type=((symbol_header==HUNK_EXT?EXT_DEF:0)<<24)&0xff000000;
  1693. +       j=strlen(sym_p->name);
  1694. +       
  1695. +       len=(j+3)>>2;
  1696. +       
  1697. +       type|=(len & 0xffffff);
  1698. +       if (bfd_write((PTR)(&type),sizeof(unsigned long),1,abfd)!=sizeof(unsigned long))
  1699. +         return false;
  1700. +       if (bfd_write((PTR)(sym_p->name),sizeof(char),j,abfd)!=j)
  1701. +         return false;
  1702. +       
  1703. +       if ((len<<2)-j!=0) /* Pad name */
  1704. +         if (bfd_write((PTR)(b),sizeof(char),(len<<2)-j,abfd)!=((len<<2)-j))
  1705. +           return false;
  1706. +       n[0]=sym_p->value+sym_p->section->output_offset;
  1707. +       if (bfd_write((PTR)n,sizeof(unsigned long),1,abfd)!=sizeof(unsigned long))
  1708. +         return false;
  1709. +     }/* Of this section */
  1710. +     }/* Of for */
  1711. +   DPRINT(10,("Did traversing\n"));
  1712. +   if (symbol_count) /* terminate HUNK_EXT, HUNK_SYMBOL */
  1713. +     {
  1714. +       n[0]=0;
  1715. +       if (bfd_write((PTR)n,sizeof(unsigned long),1,abfd)!=sizeof(unsigned long))
  1716. +     return false;
  1717. +     }
  1718. +   DPRINT(5,("Leaving\n"));
  1719. +   goto alldone; /* Write HUNK_END, return */
  1720. + }
  1721. + static boolean
  1722. + amiga_get_section_contents (abfd, section, location, offset, count)
  1723. +      bfd *abfd;
  1724. +      sec_ptr section;
  1725. +      PTR location;
  1726. +      file_ptr offset;
  1727. +      bfd_size_type count;
  1728. + {
  1729. +   memmove ((void *) location,
  1730. +        (void *) (((int) AMIGA_DATA(abfd)->first_byte)
  1731. +              + (int) section->filepos
  1732. +              + (int) offset),
  1733. +        count);
  1734. +   return true;
  1735. + }
  1736. + boolean
  1737. + amiga_new_section_hook (abfd, newsect)
  1738. +      bfd *abfd;
  1739. +      asection *newsect;
  1740. + {
  1741. +   newsect->used_by_bfd = (PTR) bfd_zalloc (abfd, sizeof (amiga_per_section_type));
  1742. +   newsect->alignment_power = 2;
  1743. +   amiga_per_section(newsect)->reloc_tail = NULL;
  1744. +   return true;
  1745. + }
  1746. + /* This reads the symbol table, by following various pointers,
  1747. +    set up by amiga_digest_file */
  1748. + static boolean
  1749. + amiga_slurp_symbol_table (abfd)
  1750. +      bfd *abfd;
  1751. + {
  1752. +   /* slurp in symbols, associated with this bfd */
  1753. +   amiga_data_type *amiga_data=AMIGA_DATA(abfd);
  1754. +   asection *section;
  1755. +   struct amiga_raw_symbol *sp;
  1756. +   amiga_symbol_type *asp=NULL;
  1757. +   unsigned long *lp;
  1758. +   int len;
  1759. +   int type;
  1760. +   if (amiga_data->symbols)
  1761. +     return true; /* already read */
  1762. +   /* Symbols are associated with every section */
  1763. +   for (section=abfd->sections;section!=NULL;section=section->next)
  1764. +     {
  1765. +       for (sp=amiga_per_section(section)->first;sp!=NULL;sp=sp->next)
  1766. +     {
  1767. +       lp=&(sp->data[0]);
  1768. +       while (*lp)
  1769. +         {
  1770. +           type =(*lp)>>24; /* type of entry */
  1771. +           len=(*lp++)&0xffffff; /* namelength */
  1772. +           
  1773. +           switch(type)
  1774. +         {
  1775. +         case EXT_COMMON: /* Common reference/definition*/
  1776. +         case EXT_ABS: /* Absolute */
  1777. +         case EXT_DEF: /* Relative Definition */
  1778. +         case EXT_SYMB: /* Same as EXT_DEF for load files */
  1779. +           /* Add symbol to section.... */
  1780. +           /* We don't have to increase symcount, this has already been done */
  1781. +           
  1782. +           asp=(amiga_symbol_type *)bfd_zalloc(abfd,sizeof(amiga_symbol_type));
  1783. +           if (!asp) /* No mem */
  1784. +             {
  1785. +               bfd_set_error(bfd_error_no_memory);
  1786. +               return(false);
  1787. +             }
  1788. +           
  1789. +           /* Add symbol to list of all symbols */
  1790. +           asp->next=NULL;
  1791. +           if (!amiga_data->symbols) /* first one */
  1792. +             {
  1793. +               amiga_data->symbols=amiga_data->symbol_tail=asp;
  1794. +             }
  1795. +           else
  1796. +             {
  1797. +               amiga_data->symbol_tail->next=asp;
  1798. +               amiga_data->symbol_tail=asp;
  1799. +             }
  1800. +           asp->symbol.section=((type==EXT_DEF)||(type==EXT_SYMB))?section:(type==EXT_COMMON)?
  1801. +                bfd_com_section_ptr:bfd_abs_section_ptr;
  1802. +           asp->symbol.flags=BSF_GLOBAL;
  1803. +           asp->symbol.value=lp[len];
  1804. +           asp->symbol.the_bfd=abfd;
  1805. +           asp->type=type;
  1806. +           asp->hunk_number=((type==EXT_DEF)||(type==EXT_SYMB))?section->target_index:
  1807. +              (type==EXT_ABS)?-1:-3;
  1808. +           if ((asp->symbol.name=bfd_alloc(abfd,(len<<2)+1))==NULL)
  1809. +             {
  1810. +               bfd_set_error(bfd_error_no_memory);
  1811. +               return(false);
  1812. +             } 
  1813. +           strncpy((char *)(asp->symbol.name),(char *)lp,len<<2);
  1814. +           ((char*)(asp->symbol.name))[(len<<2)]='\0';
  1815. +           /* Now store the symbol in the first name longword */
  1816. +           *lp=(unsigned long)asp;
  1817. +           lp+=len+1;
  1818. +           if (type==EXT_COMMON) /* skip refs */
  1819. +             lp+=(*lp)+1;
  1820. +           break;
  1821. +         default: /* References to an undefined symbol */
  1822. +           /* Problem is that this symbol may be defined in another hunk WITHIN this bfd */
  1823. +           /* To avoid conflicts with bfd, we simply scan through the list of already defined symbols
  1824. +              and add a symbol only, if we did not find it */
  1825. +           for (asp=amiga_data->symbols;asp!=NULL;asp=asp->next)
  1826. +             {
  1827. +               if (strncmp((char *)lp,asp->symbol.name,len<<2)==0)
  1828. +             break; /* Found symbol */
  1829. +             }
  1830. +           if (asp==NULL) /* Symbol not  defined */
  1831. +             {
  1832. +               asp=(amiga_symbol_type *)bfd_zalloc(abfd,sizeof(amiga_symbol_type));
  1833. +               if (!asp) /* No mem */
  1834. +             {
  1835. +               bfd_set_error(bfd_error_no_memory);
  1836. +               return(false);
  1837. +             }
  1838. +               
  1839. +               /* Add symbol to list of all symbols */
  1840. +               asp->next=NULL;
  1841. +               if (!amiga_data->symbols) /* first one */
  1842. +             {
  1843. +               amiga_data->symbols=amiga_data->symbol_tail=asp;
  1844. +             }
  1845. +               else
  1846. +             {
  1847. +               amiga_data->symbol_tail->next=asp;
  1848. +               amiga_data->symbol_tail=asp;
  1849. +             }
  1850. +               if ((asp->symbol.name=bfd_alloc(abfd,(len<<2)+1))==NULL)
  1851. +             {
  1852. +               bfd_set_error(bfd_error_no_memory);
  1853. +               return(false);
  1854. +             } 
  1855. +               strncpy((char *)(asp->symbol.name),(const char *)lp,len<<2);
  1856. +               ((char *)(asp->symbol.name))[(len<<2)]='\0';
  1857. +               asp->symbol.section=bfd_und_section_ptr;
  1858. +               asp->symbol.flags=0;
  1859. +               asp->symbol.the_bfd=abfd;
  1860. +               asp->hunk_number=-2;
  1861. +               asp->type=type;
  1862. +               abfd->symcount++;
  1863. +             }
  1864. +           
  1865. +           /* Store symbol in 1st LW of name */
  1866. +           *lp=(unsigned long)asp;
  1867. +           lp+=len;
  1868. +           lp+=1+(*lp); /* skip refs */
  1869. +           break;
  1870. +         }/* Of switch type */
  1871. +         }/* Of while *lp */
  1872. +     }/* of for sp */
  1873. +     }/* Of for section */
  1874. +   return true;
  1875. + }
  1876. + /* Get size of symtab */
  1877. + long
  1878. + amiga_get_symtab_upper_bound (abfd)
  1879. +      bfd *abfd;
  1880. + {
  1881. +   /* We read in the symbol table first */
  1882. +   if (!amiga_slurp_symbol_table (abfd))
  1883. +     return -1;
  1884. +   return (abfd->symcount != 0) ?
  1885. +     (abfd->symcount+1) * (sizeof (amiga_symbol_type *)) : 0;
  1886. + }
  1887. + long
  1888. + amiga_get_symtab (abfd, location)
  1889. +      bfd *abfd;
  1890. +      asymbol **location;
  1891. + {
  1892. +   amiga_symbol_type *symp;
  1893. +   if(!amiga_slurp_symbol_table(abfd))
  1894. +     return -1;
  1895. +   if (abfd->symcount)
  1896. +     {
  1897. +       int i = 0;
  1898. +       for (symp = AMIGA_DATA(abfd)->symbols;
  1899. +                  symp != (amiga_symbol_type *) NULL;
  1900. +                  symp = symp->next)
  1901. +     {
  1902. +       location[i++] = &symp->symbol;
  1903. +     }
  1904. +     }
  1905. +   return abfd->symcount;
  1906. + }
  1907. + asymbol *
  1908. + amiga_make_empty_symbol (abfd)
  1909. +      bfd *abfd;
  1910. + {
  1911. +   amiga_symbol_type *new =
  1912. +     (amiga_symbol_type *) bfd_zalloc (abfd, sizeof (amiga_symbol_type));
  1913. +   new->symbol.the_bfd = abfd;
  1914. +   return &new->symbol;
  1915. + }
  1916. + void
  1917. + amiga_get_symbol_info (ignore_abfd, symbol, ret)
  1918. +       bfd *ignore_abfd;
  1919. +       asymbol *symbol;
  1920. +       symbol_info *ret;
  1921. + {
  1922. +   bfd_symbol_info (symbol, ret);
  1923. +   if (symbol->name[0] == ' ')
  1924. +     ret->name = "* empty table entry ";
  1925. +   if (symbol->section==bfd_abs_section_ptr)
  1926. +     ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A';
  1927. + }
  1928. + void
  1929. + amiga_print_symbol (ignore_abfd, afile,  symbol, how)
  1930. +       bfd *ignore_abfd;
  1931. +       PTR afile;
  1932. +       asymbol *symbol;
  1933. +       bfd_print_symbol_type how;
  1934. + {
  1935. +   FILE *file = (FILE *)afile;
  1936. +   
  1937. +   switch (how) {
  1938. +   case bfd_print_symbol_name:
  1939. +     fprintf(file, "%s", symbol->name);
  1940. +     break;
  1941. +   case bfd_print_symbol_more:
  1942. +     fprintf(stderr,"%4x %2x %2x",
  1943. +         (unsigned int)((amiga_symbol(symbol)->hunk_number)&0xffff),0,amiga_symbol(symbol)->type);
  1944. +     break;
  1945. +   case bfd_print_symbol_all:
  1946. +       {
  1947. +     CONST char *section_name = symbol->section->name;
  1948. +     if (symbol->name[0] == ' ')
  1949. +       {
  1950. +         fprintf(file, "* empty table entry ");
  1951. +       }
  1952. +     else
  1953. +       {
  1954. +         bfd_print_symbol_vandf ((PTR)file, symbol);
  1955. +         fprintf(file," %-5s %04x %02x %s",
  1956. +             section_name,
  1957. +             (unsigned int)((amiga_symbol(symbol)->hunk_number)&0xffff),  /* ->desc */
  1958. +             (unsigned) 0,                       /* ->other */
  1959. +                                                 /* type */
  1960. +             symbol->name);                      /* ->name */
  1961. +     }
  1962. +       }
  1963. +     break;
  1964. +   }
  1965. + }
  1966. +  long
  1967. + amiga_get_reloc_upper_bound (abfd, asect)
  1968. +      bfd *abfd;
  1969. +      sec_ptr asect;
  1970. + {
  1971. +   if (bfd_get_format (abfd) != bfd_object)
  1972. +     {
  1973. +       bfd_set_error(bfd_error_invalid_operation);
  1974. +       return 0;
  1975. +     }
  1976. +   return sizeof (arelent *) * (asect->reloc_count + 1);
  1977. + }
  1978. + /* slurp in relocs , amiga_digest_file left various pointers for us*/
  1979. + static boolean 
  1980. + amiga_slurp_relocs(bfd *abfd, sec_ptr section, asymbol **symbols)
  1981. + {
  1982. +   struct amiga_raw_symbol *sp;
  1983. +   amiga_symbol_type *asp;
  1984. +   long *lp;
  1985. +   
  1986. +   int i,n,br,j;
  1987. +   int index;
  1988. +   long hunk_number;
  1989. +   int type;
  1990. +   /* First browse through raw_relocs */
  1991. +   for (i=0;i<amiga_per_section(section)->num_raw_relocs;i++)
  1992. +     {
  1993. +       lp=amiga_per_section(section)->raw_relocs[i];
  1994. +       /* lp points to RELOC ID */
  1995. +       /* first determine type of reloc */
  1996. +       switch (*lp)
  1997. +     {
  1998. +     case HUNK_RELOC32: /* 32 bit ref */
  1999. +     case HUNK_RELOC16: /* 16 bit ref */
  2000. +     case HUNK_RELOC8: /* 8 bit ref */
  2001. +     case HUNK_DREL32: /* 32 bit ref baserel */
  2002. +     case HUNK_DREL16: /* 16 bit baserel */
  2003. +     case HUNK_DREL8: /* 8 bit baserel */
  2004. +       if (*lp<HUNK_DREL32)
  2005. +         { /*0:8bit, 1: 16bit, 2:32bit */
  2006. +           index=2-((*lp)-HUNK_RELOC32);
  2007. +           br=0; /* not base relative */
  2008. +         }
  2009. +       else
  2010. +         {
  2011. +           index=2-((*lp)-HUNK_DREL32);
  2012. +           br=1; /* base relative */
  2013. +         }
  2014. +       lp++;
  2015. +       while ((n=*lp++)) /* read offsets and hunk number */
  2016. +         {
  2017. +           hunk_number=(long)(*lp++);
  2018. +           for (j=0;j<n;j++)
  2019. +         { /* add relocs */
  2020. +           if (!amiga_add_reloc(abfd,section,lp[j],NULL,
  2021. +                        amiga_howto_array[br][index],hunk_number))
  2022. +             return false;
  2023. +         }/* of for */
  2024. +           lp+=n;
  2025. +         }/* of while */
  2026. +       break;
  2027. +     default: /* error */
  2028. +       bfd_set_error(bfd_error_wrong_format);
  2029. +       return (false);
  2030. +       break;
  2031. +     }/* of switch */
  2032. +     }/* of for i */
  2033. +   
  2034. +   /* Now step through the raw_symbols and add all relocs in them */
  2035. +   for (sp=amiga_per_section(section)->first;sp!=NULL;sp=sp->next)
  2036. +     {
  2037. +       lp=&(sp->data[0]);
  2038. +       /* points to id */
  2039. +       while (*lp) /* until end is reached */
  2040. +     {
  2041. +       type=((*lp)>>24)&0xff;
  2042. +       n=(*lp++)&0xffffff;
  2043. +       /* lp points to symbol pointer (former 1st LW of name )*/
  2044. +       asp=(amiga_symbol_type *)(*lp);
  2045. +       switch (type)
  2046. +         {
  2047. +         case EXT_SYMB:
  2048. +         case EXT_DEF:
  2049. +         case EXT_ABS: /* no relocs here, just advance the pointer */
  2050. +           lp+=1+n;
  2051. +           break;
  2052. +         case EXT_COMMON: /* same as below, but advance lp by one to skip common size */
  2053. +           lp++;
  2054. +           /* Fall through */
  2055. +         default: /* reference to something */
  2056. +           /* skip name first */
  2057. +           lp+=n;
  2058. +           /* points to num of refs to hunk */
  2059. +           n=*lp++;
  2060. +           for (i=0;i<n;i++) /* refs follow */
  2061. +         {
  2062. +           /* Add relocs to this section, relative to asp, offset is lp[i] */
  2063. +           /* determine howto first */
  2064. +           if (type==EXT_COMMON) /* 32 bit ref */
  2065. +             {
  2066. +               index=2;
  2067. +               br=0;
  2068. +             }
  2069. +           else
  2070. +             {
  2071. +               if (type>EXT_REF32)
  2072. +             type--; /* skip EXT_COMMON gap */
  2073. +              
  2074. +              type-=EXT_REF32;
  2075. +              br=0;
  2076. +              if (type>2) /* base relative */
  2077. +                {
  2078. +              type-=3;
  2079. +              br=1;
  2080. +                }
  2081. +              index=2-type;
  2082. +             }/* of else */
  2083. +           
  2084. +           if (!amiga_add_reloc(abfd,section,lp[i],asp,amiga_howto_array[br][index],-4))
  2085. +             return false;
  2086. +         }
  2087. +           
  2088. +           lp+=n;
  2089. +           
  2090. +           break;
  2091. +         }/* of switch */
  2092. +     }/* of while *lp */
  2093. +     }/* Of for sp*/
  2094. +   return true;
  2095. + }/* Of slurp_relocs */
  2096. + long
  2097. + amiga_canonicalize_reloc (abfd, section, relptr, symbols)
  2098. +      bfd *abfd;
  2099. +      sec_ptr section;
  2100. +      arelent **relptr;
  2101. +      asymbol **symbols;
  2102. + {
  2103. +   amiga_reloc_type *src = NULL;
  2104. +   if (!amiga_slurp_relocs(abfd,section,symbols))
  2105. +     return -1;
  2106. +   src=(amiga_reloc_type *)section->relocation;
  2107. +   while (src != (amiga_reloc_type *) 0)
  2108. +     {
  2109. +       *relptr++ = &src->relent;
  2110. +       src = src->next;
  2111. +     }
  2112. +   *relptr = (arelent *) 0;
  2113. +   return section->reloc_count;
  2114. + }
  2115. + /* Set section contents */
  2116. + /* We do it the following way: 
  2117. +    if this is a bss setion ==> error
  2118. +    otherwise, we try to allocate space for this section,
  2119. +    if  this has not already been done
  2120. +    Then we set the memory area to the contents */
  2121. + static boolean
  2122. + amiga_set_section_contents (abfd, section, location, offset, count)
  2123. +      bfd *abfd;
  2124. +      sec_ptr section;
  2125. +      unsigned char *location;
  2126. +      file_ptr offset;
  2127. +       int count;
  2128. + {
  2129. +   unsigned char *contents;
  2130. +   if ((section->flags&SEC_HAS_CONTENTS)==0) /* BSS */
  2131. +     {
  2132. +       bfd_set_error(bfd_error_invalid_operation);
  2133. +       return false;
  2134. +     }
  2135. +   
  2136. +   if ((section->flags&SEC_IN_MEMORY)==0) /* Not in memory, so alloc space */
  2137. +     {
  2138. +       contents=bfd_zalloc(abfd,section->_raw_size);
  2139. +       if (!contents)
  2140. +     {
  2141. +       bfd_set_error(bfd_error_no_memory);
  2142. +       return false;
  2143. +     }
  2144. +       
  2145. +       DPRINT(5,("Allocated %lx bytes at %lx\n",section->_raw_size,contents));
  2146. +       section->contents=contents;
  2147. +       section->flags|=SEC_IN_MEMORY;
  2148. +     }
  2149. +   else /* In memory */
  2150. +     contents=section->contents;
  2151. +   /* Copy mem */
  2152. +   memmove(contents+offset,location,count);
  2153. +   return(true);
  2154. + }/* Of section_set_contents */
  2155. + /* FIXME: Is this everything ? */
  2156. + static boolean
  2157. + amiga_set_arch_mach (abfd, arch, machine)
  2158. +      bfd *abfd;
  2159. +      enum bfd_architecture arch;
  2160. +      unsigned long machine;
  2161. + {
  2162. +   bfd_default_set_arch_mach(abfd, arch, machine);
  2163. +   if (arch == bfd_arch_m68k)
  2164. +     {
  2165. +       switch (machine)
  2166. +     {
  2167. +     case 68000:
  2168. +     case 68008:
  2169. +     case 68010:
  2170. +     case 68020:
  2171. +     case 68030:
  2172. +     case 68040:
  2173. +     case 68070:
  2174. +     case 0:
  2175. +       return true;
  2176. +     default:
  2177. +       return false;
  2178. +     }
  2179. +     }
  2180. +   return false;
  2181. + }
  2182. + static int
  2183. + DEFUN(amiga_sizeof_headers,(ignore_abfd, ignore),
  2184. +       bfd *ignore_abfd AND
  2185. +       boolean ignore)
  2186. + {
  2187. +   /* The amiga hunk format doesn't have headers.*/
  2188. +   return 0;
  2189. + }
  2190. + /* Provided a BFD, a section and an offset into the section, calculate
  2191. +    and return the name of the source file and the line nearest to the
  2192. +    wanted location.  */
  2193. + boolean
  2194. + amiga_find_nearest_line(abfd, section, symbols, offset, filename_ptr,
  2195. +             functionname_ptr, line_ptr)
  2196. +      bfd *abfd;
  2197. +      asection *section;
  2198. +      asymbol **symbols;
  2199. +      bfd_vma offset;
  2200. +      char **filename_ptr;
  2201. +      char **functionname_ptr;
  2202. +      int *line_ptr;
  2203. + {
  2204. +   /* FIXME (see aoutx.h, for example) */
  2205. +   return false;
  2206. + }
  2207. + static const struct reloc_howto_struct *
  2208. + amiga_bfd_reloc_type_lookup (abfd, code)
  2209. +        bfd *abfd;
  2210. +        bfd_reloc_code_real_type code;
  2211. + {
  2212. +   switch (code)
  2213. +     {
  2214. +     case BFD_RELOC_8_PCREL:  return &howto_hunk_reloc8;
  2215. +     case BFD_RELOC_16_PCREL: return &howto_hunk_reloc16;
  2216. +     case BFD_RELOC_32_PCREL: return &howto_hunk_reloc32;
  2217. +     case BFD_RELOC_8:        return &howto_hunk_drel8;
  2218. +     case BFD_RELOC_16:       return &howto_hunk_drel16;
  2219. +     case BFD_RELOC_CTOR:    /* FIXME - assumes 32 bits */
  2220. +     case BFD_RELOC_32:       return &howto_hunk_drel32;
  2221. +       /* FIXME: Add more cases here for base relative relocs*/
  2222. +     default:                 return 0;
  2223. +     }
  2224. + }
  2225. + /* We don't have core files.  */
  2226. + #define    amiga_core_file_failing_command _bfd_dummy_core_file_failing_command
  2227. + #define    amiga_core_file_failing_signal _bfd_dummy_core_file_failing_signal
  2228. + #define    amiga_core_file_matches_executable_p _bfd_dummy_core_file_matches_executable_p
  2229. + /* 101194: We do not use archive files, AMIGA Hunk load libs will be supported someday... ST */
  2230. + #define    amiga_openr_next_archived_file    (bfd * (*)(bfd *, bfd*))bfd_nullvoidptr
  2231. + #define    amiga_generic_stat_arch_elt    (int (*)(bfd *, struct stat *))_bfd_n1
  2232. + #define    amiga_slurp_armap        (boolean (*)(bfd *))bfd_false
  2233. + #define    amiga_slurp_extended_name_table    (boolean (*)(bfd *))bfd_false
  2234. + #define amiga_update_armap_timestamp    (boolean (*)(bfd *))bfd_false
  2235. + #define    amiga_write_armap        (boolean (*)(bfd *,unsigned int, struct orl*,\
  2236. + unsigned int,int))bfd_false
  2237. + #define    amiga_truncate_arname        (void (*)(bfd *,const char *, char*))bfd_void
  2238. + #define amiga_construct_extended_name_table (boolean (*)(bfd *,char **, bfd_size_type *,\
  2239. +  const char **))bfd_false
  2240. + #define amiga_bfd_debug_info_start        bfd_void
  2241. + #define amiga_bfd_debug_info_end        bfd_void
  2242. + #define amiga_bfd_debug_info_accumulate    (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
  2243. + /* NOTE: We use a special get_relocated_section_contents both in amiga AND in a.out files.
  2244. +    In addition, we use an own final_link routine, which is nearly identical to _bfd_generic_final_link */
  2245. + extern bfd_byte *get_relocated_section_contents(bfd*, struct bfd_link_info *,
  2246. +                         struct bfd_link_order *, bfd_byte *,
  2247. +                         boolean, asymbol **);
  2248. + #define amiga_bfd_get_relocated_section_contents get_relocated_section_contents
  2249. + #define amiga_bfd_relax_section                   bfd_generic_relax_section
  2250. + #define amiga_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
  2251. + #define amiga_close_and_cleanup         _bfd_generic_close_and_cleanup
  2252. + #define amiga_bfd_make_debug_symbol \
  2253. +   (asymbol * (*)(bfd *, void *, unsigned long)) bfd_nullvoidptr
  2254. + #define amiga_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
  2255. + #define amiga_bfd_link_add_symbols _bfd_generic_link_add_symbols
  2256. + extern boolean amiga_final_link(bfd *, struct bfd_link_info *);
  2257. + #define amiga_bfd_final_link amiga_final_link
  2258. + #define amiga_bfd_free_cached_info    _bfd_generic_bfd_free_cached_info
  2259. + #define amiga_bfd_is_local_label    bfd_generic_is_local_label
  2260. + #define amiga_bfd_copy_private_section_data (boolean (*)(bfd *,sec_ptr,bfd *,sec_ptr))bfd_true
  2261. + #define amiga_bfd_copy_private_bfd_data (boolean (*)(bfd *,bfd *))bfd_true
  2262. + #if defined (amiga)
  2263. + /* So that the JUMP_TABLE() macro below can work.  */
  2264. + #undef amiga
  2265. + #endif
  2266. + bfd_target amiga_vec =
  2267. + {
  2268. +   "amiga",        /* name */
  2269. +   bfd_target_amiga_flavour,
  2270. +   true,            /* data byte order is little */
  2271. +   true,            /* header byte order is little */
  2272. +   HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT, /* object flags */
  2273. +   SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC, /* section flags */
  2274. +   '_',                /* symbol leading char */
  2275. +   ' ',                /* ar_pad_char */
  2276. +   31,                /* ar_max_namelen */
  2277. +   2,                /* minimum align */
  2278. +   bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32,
  2279. +   bfd_putb32, bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
  2280. +   bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32,
  2281. +   bfd_putb32, bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
  2282. +   {
  2283. +     /* bfd_check_format */
  2284. +     _bfd_dummy_target,
  2285. +     amiga_object_p,
  2286. +     _bfd_dummy_target, /* AMIGA style like archives are not yet supported
  2287. +               archives are supported by a.out backend (ar) */
  2288. +     _bfd_dummy_target
  2289. +   },
  2290. +   {
  2291. +     /* bfd_set_format */
  2292. +     bfd_false,
  2293. +     amiga_mkobject,
  2294. +     bfd_false,    /* Archives not supported yet */
  2295. +     bfd_false
  2296. +   },
  2297. +   {
  2298. +     /* bfd_write_contents */
  2299. +     bfd_false,
  2300. +     amiga_write_object_contents,
  2301. +     bfd_false,    /*Archives not supported yet */
  2302. +     bfd_false
  2303. +   },
  2304. +   BFD_JUMP_TABLE_GENERIC (amiga),
  2305. +   BFD_JUMP_TABLE_COPY (amiga),
  2306. +   BFD_JUMP_TABLE_CORE (_bfd_nocore),
  2307. +   BFD_JUMP_TABLE_ARCHIVE (amiga),
  2308. +   BFD_JUMP_TABLE_SYMBOLS (amiga),
  2309. +   BFD_JUMP_TABLE_RELOCS (amiga),
  2310. +   BFD_JUMP_TABLE_WRITE (amiga),
  2311. +   BFD_JUMP_TABLE_LINK (amiga),
  2312. +   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  2313. +   (PTR) 0
  2314. + #if 0
  2315. + /* fixme: no longer in use?  */
  2316. +   /* How applications can find out about amiga relocation types (see
  2317. +      documentation on reloc types).  */
  2318. +   amiga_reloc_type_lookup
  2319. + #endif
  2320. + };
  2321. diff -rc --new-file binutils-2.5.2-base/bfd/amigadoslink.c binutils-2.5.2/bfd/amigadoslink.c
  2322. *** binutils-2.5.2-base/bfd/amigadoslink.c    Thu Jan  1 00:00:00 1970
  2323. --- binutils-2.5.2/bfd/amigadoslink.c    Fri Feb 10 14:29:08 1995
  2324. ***************
  2325. *** 0 ****
  2326. --- 1,994 ----
  2327. + /* BFD back-end for Commodore-Amiga AmigaDOS binaries. Linker routines.
  2328. +    Copyright (C) 1990-1994 Free Software Foundation, Inc.
  2329. +    Contributed by Stephan Thesing
  2330. + This file is part of BFD, the Binary File Descriptor library.
  2331. + This program is free software; you can redistribute it and/or modify
  2332. + it under the terms of the GNU General Public License as published by
  2333. + the Free Software Foundation; either version 2 of the License, or
  2334. + (at your option) any later version.
  2335. + This program is distributed in the hope that it will be useful,
  2336. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  2337. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2338. + GNU General Public License for more details.
  2339. + You should have received a copy of the GNU General Public License
  2340. + along with this program; if not, write to the Free Software
  2341. + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  2342. + /*
  2343. + INODE
  2344. + amigalink, , implementation, amiga
  2345. + SECTION
  2346. +     amigalink
  2347. + This is the description of the linker routines for the amiga.
  2348. + In fact, this includes a description of the changes made to the
  2349. + a.out code, in order to build a working linker for the Amiga.
  2350. + @menu
  2351. + @* alterations::
  2352. + @end menu
  2353. + INODE 
  2354. + alterations, , , amigalink
  2355. + SUBSECTION
  2356. +     alterations
  2357. + The file @file{aout-amiga.c} defines the amiga a.out backend. It differs from
  2358. + the sun3 backend only in these details:
  2359. +     o The @code{final_link} routine is @code{amiga_final_link}.
  2360. +     o The routine to get the relocated section contents is
  2361. +            @code{aout_bfd_get_relocated_section_contents}.
  2362. + This ensures that the link is performed properly, but has the side effect of loosing
  2363. + performance.
  2364. + The amiga bfd code uses the same @code{amiga_final_link} routine, but with a 
  2365. + different <<get_relocated_section_contents>> entry: <<amiga_bfd_get_relocated_section_contents>>.
  2366. + The latter  differs from the routine of the a.out backend only in the application of relocs
  2367. +  to the section contents.
  2368. + @@*
  2369. + The usage of a special linker code has one reason:
  2370. + The bfd library assumes that a program is always loaded at a known memory
  2371. + address. This is not a case on an Amiga. So the Amiga format has to take over
  2372. + some relocs to an executable output file. 
  2373. + This is not the case with a.out formats, so there relocations can be applied at link time,
  2374. + not at run time, like on the Amiga.
  2375. + The special routines compensate this: instead of applying the relocations, they are
  2376. + copied to the output file, if neccessary.
  2377. + As as consequence, the @code{final_link} and @code{get_relocated_section_contents} are nearly identical to
  2378. + the original routines from @file{linker.c} and @file{reloc.c}.
  2379. + */
  2380. + #include "bfd.h"
  2381. + #include "bfdlink.h"
  2382. + #include "genlink.h"
  2383. + #include "sysdep.h"
  2384. + #include "libbfd.h"
  2385. + #include "libamiga.h"
  2386. + #undef GET_SWORD
  2387. + #define aadata ((bfd)->tdata.amiga_data->a)
  2388. + #undef adata
  2389. + #include "libaout.h"
  2390. + #define max(x,y) (((x)<=(y))?(y):(x))
  2391. + #define DEBUG_AMIGA 10000
  2392. + #if DEBUG_AMIGA
  2393. + #include <varargs.h>
  2394. + static void error_print(va_alist)
  2395. + va_dcl
  2396. + {
  2397. + va_list args;
  2398. + char *fmt;
  2399. + va_start(args);
  2400. + fmt=va_arg(args,char *);
  2401. + (void)vfprintf(stderr,fmt,args);
  2402. + va_end(args);
  2403. + }
  2404. + #define DPRINT(L,x) if (L>=DEBUG_AMIGA) error_print x
  2405. + #else
  2406. + #define DPRINT(L,x) 
  2407. + #endif
  2408. + /* This one is used to indicate base-relative (and maybe later residentable) linking */
  2409. + int amiga_base_relative=0;
  2410. + extern boolean default_indirect_link_order
  2411. +   PARAMS ((bfd *, struct bfd_link_info *, asection *,
  2412. +        struct bfd_link_order *, boolean));
  2413. + bfd_byte *
  2414. + get_relocated_section_contents(bfd *, struct bfd_link_info *,
  2415. +                    struct bfd_link_order *, bfd_byte *,
  2416. +                    boolean , asymbol **);
  2417. + static bfd_reloc_status_type 
  2418. + amiga_perform_reloc(bfd *, arelent *, PTR, asection *, bfd *, char **);
  2419. + static bfd_reloc_status_type 
  2420. + aout_perform_reloc(bfd *, arelent *, PTR, asection *, bfd *, char **);
  2421. + static boolean
  2422. + amiga_reloc_link_order (bfd *, struct bfd_link_info *,asection *,struct bfd_link_order *);
  2423. + /* This one is nearly identical to bfd_generic_get_relocated_section_contents from reloc.c */
  2424. + bfd_byte *
  2425. + get_relocated_section_contents (abfd, link_info, link_order, data,
  2426. +                         relocateable, symbols)
  2427. +      bfd *abfd;
  2428. +      struct bfd_link_info *link_info;
  2429. +      struct bfd_link_order *link_order;
  2430. +      bfd_byte *data;
  2431. +      boolean relocateable;
  2432. +      asymbol **symbols;
  2433. + {
  2434. +   bfd *input_bfd = link_order->u.indirect.section->owner;
  2435. +   asection *input_section = link_order->u.indirect.section;
  2436. +   long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
  2437. +   arelent **reloc_vector = NULL;
  2438. +   long reloc_count;
  2439. +   bfd_reloc_status_type (*reloc_func)(bfd *, arelent *, PTR, asection *, bfd *, char **);
  2440. +   DPRINT(5,("Entering get_rel_sec_cont\n"));
  2441. +   if (reloc_size < 0)
  2442. +     goto error_return;
  2443. +   if (input_bfd->xvec->flavour==bfd_target_amiga_flavour)
  2444. +     reloc_func=amiga_perform_reloc;
  2445. +   else if (input_bfd->xvec->flavour==bfd_target_aout_flavour)
  2446. +     reloc_func=aout_perform_reloc;
  2447. +   else
  2448. +     {
  2449. +       bfd_set_error(bfd_error_bad_value);
  2450. +       goto error_return;
  2451. +     }
  2452. +   reloc_vector = (arelent **) malloc (reloc_size);
  2453. +   if (reloc_vector == NULL && reloc_size != 0)
  2454. +     {
  2455. +       bfd_set_error (bfd_error_no_memory);
  2456. +       goto error_return;
  2457. +     }
  2458. +   DPRINT(5,("GRSC: GetSecCont()\n"));
  2459. +   /* read in the section */
  2460. +   if (!bfd_get_section_contents (input_bfd,
  2461. +                  input_section,
  2462. +                  (PTR) data,
  2463. +                  0,
  2464. +                  input_section->_raw_size))
  2465. +     goto error_return;
  2466. +   /* We're not relaxing the section, so just copy the size info */
  2467. +   input_section->_cooked_size = input_section->_raw_size;
  2468. +   input_section->reloc_done = true;
  2469. +   DPRINT(5,("GRSC: CanReloc\n"));
  2470. +   reloc_count = bfd_canonicalize_reloc (input_bfd,
  2471. +                     input_section,
  2472. +                     reloc_vector,
  2473. +                     symbols);
  2474. +   if (reloc_count < 0)
  2475. +     goto error_return;
  2476. +   if (reloc_count > 0)
  2477. +     {
  2478. +       arelent **parent;
  2479. +       DPRINT(5,("reloc_count=%d\n",reloc_count));
  2480. +       for (parent = reloc_vector; *parent != (arelent *) NULL;
  2481. +        parent++)
  2482. +     {
  2483. +       char *error_message = (char *) NULL;
  2484. +       bfd_reloc_status_type r ;
  2485. +       DPRINT(5,("Applying a reloc\nparent=%lx, reloc_vector=%lx, *parent=%lx\n",parent,reloc_vector,*parent));
  2486. +       r=(*reloc_func) (input_bfd,
  2487. +                *parent,
  2488. +                (PTR) data,
  2489. +                input_section,
  2490. +                relocateable ? abfd : (bfd *) NULL,
  2491. +                &error_message);
  2492. +       
  2493. +       if (relocateable)
  2494. +         {
  2495. +           asection *os = input_section->output_section;
  2496. +           DPRINT(5,("Keeping reloc\n"));
  2497. +           /* A partial link, so keep the relocs */
  2498. +           os->orelocation[os->reloc_count] = *parent;
  2499. +           os->reloc_count++;
  2500. +         }
  2501. +       if (r != bfd_reloc_ok)
  2502. +         {
  2503. +           switch (r)
  2504. +         {
  2505. +         case bfd_reloc_undefined:
  2506. +           if (!((*link_info->callbacks->undefined_symbol)
  2507. +             (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
  2508. +              input_bfd, input_section, (*parent)->address)))
  2509. +             goto error_return;
  2510. +           break;
  2511. +         case bfd_reloc_dangerous:
  2512. +           BFD_ASSERT (error_message != (char *) NULL);
  2513. +           if (!((*link_info->callbacks->reloc_dangerous)
  2514. +             (link_info, error_message, input_bfd, input_section,
  2515. +              (*parent)->address)))
  2516. +             goto error_return;
  2517. +           break;
  2518. +         case bfd_reloc_overflow:
  2519. +           if (!((*link_info->callbacks->reloc_overflow)
  2520. +             (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
  2521. +              (*parent)->howto->name, (*parent)->addend,
  2522. +              input_bfd, input_section, (*parent)->address)))
  2523. +             goto error_return;
  2524. +           break;
  2525. +         case bfd_reloc_outofrange:
  2526. +         default:
  2527. +           DPRINT(10,("get_rel_sec_cont fails, perform reloc returned $%x\n",r));
  2528. +           abort ();
  2529. +           break;
  2530. +         }
  2531. +         }
  2532. +     }
  2533. +     }
  2534. +   if (reloc_vector != NULL)
  2535. +     free (reloc_vector);
  2536. +   DPRINT(5,("GRSC: Returning ok\n"));
  2537. +   return data;
  2538. + error_return:
  2539. +   DPRINT(5,("GRSC: Error_return\n"));
  2540. +   if (reloc_vector != NULL)
  2541. +     free (reloc_vector);
  2542. +   return NULL;
  2543. + }
  2544. + /* Add a value to a location */
  2545. + static bfd_reloc_status_type
  2546. + my_add_to(PTR data, int offset, int size, int add)
  2547. + {
  2548. +   signed char *p;
  2549. +   int val;
  2550. +   bfd_reloc_status_type ret;
  2551. +   DPRINT(5,("Entering add_value\n"));
  2552. +   ret=bfd_reloc_ok;
  2553. +   p=((signed char*)data)+offset;
  2554. +   switch (size)
  2555. +     {
  2556. +     case 0: /* byte size */
  2557. +       val=(int)(p[0]);
  2558. +       val+=add;
  2559. +       if ((val&0xffffff00)!=0 && (val&0xffffff00)!=0xffffff00) /* Overflow */
  2560. +     {
  2561. +       ret=bfd_reloc_overflow;
  2562. +     }
  2563. +       p[0]=val&0xff;
  2564. +       break;
  2565. +     case 1: /* word size */
  2566. +       val=(int)(p[1]|(p[0]<<8));
  2567. +       val+=add;
  2568. +       if ((val&0xffff0000)!=0 && (val&0xffff0000)!=0xffff0000) /* Overflow */
  2569. +     {
  2570. +       ret=bfd_reloc_overflow;
  2571. +     }
  2572. +       p[1]=val&0xff;
  2573. +       p[0]=((val&0xff00)>>8)&0xff;
  2574. +       break;
  2575. +     case 2: /* long word */
  2576. +       val=p[3]|((int)(p[2]<<8))|((int)(p[1]<<16))|((int)(p[0]<<24));
  2577. +       val=+add;
  2578. +       p[3]=val&0xff;
  2579. +       p[2]=((val&0xff00)>>8)&0xff;
  2580. +       p[1]=((val&0xff0000)>>16)&0xff;
  2581. +       p[0]=((val&0xff000000)>>24)&0xff;
  2582. +       break;
  2583. +       
  2584. +     default: /* Error */
  2585. +       ret=bfd_reloc_notsupported;
  2586. +       break;
  2587. +     }/* Of switch */
  2588. +   DPRINT(5,("Leaving add_value\n"));
  2589. +   return (ret);
  2590. + }
  2591. + /* Get the value of ___a4_init */
  2592. + static asymbol *
  2593. + mygeta4(bfd *abfd)
  2594. + {
  2595. +   asymbol *s;
  2596. +   int i;
  2597. +   for (i=0;i<abfd->symcount;i++)
  2598. +     {
  2599. +       s=abfd->outsymbols[i];
  2600. +       if (strcmp(s->name,"___a4_init")==0)
  2601. +     return s;
  2602. +     }
  2603. +   return (NULL); /* Not found */
  2604. + }
  2605. + /* Perform an Amiga relocation */
  2606. + static bfd_reloc_status_type 
  2607. + amiga_perform_reloc(bfd *abfd, arelent *r, PTR data, asection *sec, bfd *obfd, char **error_message)
  2608. + {
  2609. +   asymbol *sym; /* Reloc is relative to sym */
  2610. +   asymbol *a4init; /* This symbol is used with baserelative relocs */
  2611. +   asection *target_section; /* reloc is relative to this section */
  2612. +   int relocation;
  2613. +   boolean copy;
  2614. +   bfd_reloc_status_type ret;
  2615. +   int size;
  2616. +   DPRINT(5,("Entering APR\nflavour is %d (aflavour=%d, aout_flavour=%d)\n",sec->owner->xvec->flavour,
  2617. +       bfd_target_amiga_flavour, bfd_target_aout_flavour));
  2618. +   /* If obfd==NULL: Apply the reloc, if possible. */
  2619. +   /* Else: Modify it and return */
  2620. +   if (obfd!=NULL) /* Only modify the reloc */
  2621. +     {
  2622. +       r->address+=sec->output_offset;
  2623. +       sec->output_section->flags|=SEC_RELOC;
  2624. +       DPRINT(5,("Leaving APR, modified case \n"));
  2625. +       return bfd_reloc_ok;
  2626. +     }
  2627. +   /* Try to apply the reloc */
  2628. +   sym=*(r->sym_ptr_ptr);
  2629. +   target_section=sym->section;
  2630. +   if (target_section==bfd_und_section_ptr) /* Error */
  2631. +     {
  2632. +       DPRINT(10,("perform_reloc: Target is undefined section\n"));
  2633. +       return bfd_reloc_undefined;
  2634. +     }
  2635. +   
  2636. +   relocation=0; copy=false; ret=bfd_reloc_ok;
  2637. +   switch(r->howto->type)
  2638. +     {
  2639. +     case HUNK_RELOC32: /* 32 bit reloc */
  2640. +       DPRINT(5,("RELOC32\n"));
  2641. +       size=2;
  2642. +       if (target_section==bfd_abs_section_ptr) /* Ref to absolute hunk */
  2643. +     relocation=sym->value;
  2644. +       else if (target_section==bfd_com_section_ptr) /* ref to common */
  2645. +     {
  2646. +       relocation=0;
  2647. +       copy=true;
  2648. +     }
  2649. +       else
  2650. +     {
  2651. +       /* If we access a symbol in the .bss section, we have to convert this to an access to .data section*/
  2652. +       /* This is done through a change to the symbol... */
  2653. +       if (amiga_base_relative && (strcmp(sym->section->output_section->name,".bss")==0))
  2654. +         {
  2655. +           /* get value for .data section */
  2656. +           bfd *ibfd;
  2657. +           asection *s;
  2658. +           ibfd=target_section->output_section->owner;
  2659. +           for (s=ibfd->sections;s!=NULL;s=s->next)
  2660. +         if (strcmp(s->name,".data")==0)
  2661. +           {
  2662. +             sym->section->output_offset=s->_raw_size;
  2663. +             sym->section->output_section=s;
  2664. +           }
  2665. +         }
  2666. +       relocation=0;
  2667. +       copy=true;
  2668. +     }
  2669. +       break;
  2670. +     case HUNK_RELOC8:
  2671. +     case HUNK_RELOC16:
  2672. +       DPRINT(5,("RELOC16/8\n"));
  2673. +       size=(r->howto->type==HUNK_RELOC8)?0:1;
  2674. +       if (target_section==bfd_abs_section_ptr) /* Ref to absolute hunk */
  2675. +     relocation=sym->value;
  2676. +       if (target_section==bfd_com_section_ptr) /* Error.. */
  2677. +     {
  2678. +       relocation=0;
  2679. +       copy=false;
  2680. +       ret=bfd_reloc_undefined;
  2681. +     }
  2682. +       else
  2683. +     {
  2684. +       DPRINT(5,("PC relative\n"));
  2685. +       /* This is a pc relative hunk... */
  2686. +       if (sec->output_section!=target_section->output_section) /* Error */
  2687. +         {
  2688. +           DPRINT(10,("pc relative, but out of range I\n"));
  2689. +           relocation=0;
  2690. +           copy =false;
  2691. +           ret=bfd_reloc_outofrange;
  2692. +         }
  2693. +       else
  2694. +         { /* Same section */
  2695. +           relocation=-(r->address+sec->output_offset);
  2696. +           copy=false;
  2697. +         }
  2698. +     }
  2699. +       break;
  2700. +       
  2701. +     case HUNK_DREL32: /* baserel relocs */
  2702. +     case HUNK_DREL16:
  2703. +     case HUNK_DREL8:
  2704. +       DPRINT(5,("HUNK_BASEREL relocs\n"));
  2705. +       /* Relocs are always relative to the symbol ___a4_init */
  2706. +       /* Relocs to .bss section are converted to a reloc to .data section, since
  2707. +      .bss section contains only COMMON sections...... and should be following .data section.. */
  2708. +       size=(r->howto->type==HUNK_DREL32)?2:((r->howto->type==HUNK_DREL16)?1:0);
  2709. +       
  2710. +       if (target_section==bfd_abs_section_ptr) /* Hmmmm, this should have been baserel, but we allow
  2711. +                           this */
  2712. +     {
  2713. +       fprintf(stderr,"Warning: Baserel reloc to symbol %s converted to absolut in section %s\n",
  2714. +           sym->name,sec->name);
  2715. +       relocation=sym->value;
  2716. +     }
  2717. +       else 
  2718. +     {
  2719. +       /* Get value for ___a4init */
  2720. +       if ((a4init=mygeta4(target_section->output_section->owner))==NULL)
  2721. +         {
  2722. +           fprintf(stderr,"Base symbol for base relative reloc not defined, section %s, reloc to symbol"
  2723. +               "%s\n",sec->name,sym->name);
  2724. +           copy=false;
  2725. +           ret=bfd_reloc_notsupported;
  2726. +           break;
  2727. +         }
  2728. +       /* If target->out is .bss, add the value of the .data section to sym->value and
  2729. +          set output_section new to .data section.... */
  2730. +       if (strcmp(target_section->output_section->name,".bss")==0)
  2731. +         {
  2732. +           bfd *ibfd;
  2733. +           asection *s;
  2734. +           ibfd=target_section->output_section->owner;
  2735. +           for (s=ibfd->sections;s!=NULL;s=s->next)
  2736. +         if (strcmp(s->name,".data")==0)
  2737. +           {
  2738. +             sym->section->output_section=s;
  2739. +             sym->section->output_offset=s->_raw_size;
  2740. +           }
  2741. +         }
  2742. +       relocation=sym->value+sym->section->output_offset-a4init->value+r->addend;
  2743. +     
  2744. +       copy=false; 
  2745. +     }
  2746. +       break;
  2747. +       
  2748. +     default:
  2749. +       fprintf(stderr,"Error:Not supported reloc type:%d\n",r->howto->type);
  2750. +       copy=false;
  2751. +       relocation=0;
  2752. +       ret=bfd_reloc_notsupported;
  2753. +       break;
  2754. +     } /* Of switch */
  2755. +   
  2756. +   /* Add in relocation */
  2757. +   if (relocation!=0)
  2758. +     ret=my_add_to(data,r->address,2,relocation);
  2759. +   
  2760. +   if (copy)/* Copy reloc to output section */
  2761. +     {
  2762. +       DPRINT(5,("Copying reloc\n"));
  2763. +       target_section=sec->output_section;
  2764. +       r->address+=sec->output_offset;
  2765. +       target_section->orelocation[target_section->reloc_count++]=r;
  2766. +       sec->output_section->flags|=SEC_RELOC;
  2767. +     }
  2768. +   DPRINT(5,("Leaving a_perform_reloc\n"));
  2769. +   return ret;
  2770. + }
  2771. + /* Perform an a.out reloc */
  2772. + static bfd_reloc_status_type 
  2773. + aout_perform_reloc(bfd *abfd, arelent *r, PTR data, asection *sec, bfd *obfd, char **error_message)
  2774. + {
  2775. +   asymbol *sym; /* Reloc is relative to this */
  2776. +   asymbol *a4init;
  2777. +   asection *target_section; /* reloc is relative to this section */
  2778. +   int relocation;
  2779. +   boolean copy;
  2780. +   bfd_reloc_status_type ret;
  2781. +   int size;
  2782. +   /* If obfd==NULL: Apply the reloc, if possible. */
  2783. +   /* Else: Modify it and return */
  2784. +   DPRINT(5,("Entering aout_perf_reloc\n"));
  2785. +   if (obfd!=NULL) /* Only modify the reloc */
  2786. +     {
  2787. +       r->address+=sec->output_offset;
  2788. +       DPRINT(5,("Leaving aout_perf_reloc, modified\n"));
  2789. +       return bfd_reloc_ok;
  2790. +     }
  2791. +   sym=*(r->sym_ptr_ptr);
  2792. +   target_section=sym->section;
  2793. +   if (target_section==bfd_und_section_ptr) /* Error */
  2794. +     {
  2795. +       DPRINT(10,("target_sec=UND, aout_perf_rel\n"));
  2796. +       return bfd_reloc_undefined;
  2797. +     }
  2798. +   relocation=0; copy=false; ret=bfd_reloc_ok;
  2799. +   switch (r->howto->type)
  2800. +     {
  2801. +     case 0: /* 8 bit reloc, pc relative or absolut */
  2802. +     case 1: /* 16 bit reloc */
  2803. +       DPRINT(10,("16/8 bit relative\n"));
  2804. +       size=r->howto->type;
  2805. +       if (target_section==bfd_abs_section_ptr) /* Ref to absolute hunk */
  2806. +     relocation=sym->value;
  2807. +       else if (target_section==bfd_com_section_ptr) /* Error.. */
  2808. +     {
  2809. +       relocation=0;
  2810. +       copy=false;
  2811. +       ret=bfd_reloc_undefined;
  2812. +       fprintf(stderr,"Pc relative relocation to  common symbol \"%s\" in section %s\n",
  2813. +           sym->name,sec->name);
  2814. +       DPRINT(10,("Ref to common symbol...aout_perf_reloc\n"));
  2815. +     }
  2816. +       else 
  2817. +     {
  2818. +       /* This is a pc relative hunk... or a baserel... */
  2819. +       if (sec->output_section!=target_section->output_section) /* Error or baserel */
  2820. +         {
  2821. +           if (target_section->output_section->flags&SEC_DATA!=0) /* Baserel reloc */
  2822. +         {
  2823. +           goto baserel; /* Dirty, but no code doubling.. */
  2824. +         }/* Of is baserel */
  2825. +           relocation=0;
  2826. +           copy =false;
  2827. +           ret=bfd_reloc_outofrange;
  2828. +           fprintf(stderr,"pc relative relocation out of range in section %s. Relocation was to"
  2829. +               "symbol %s\n",sec->name,sym->name);
  2830. +           DPRINT(10,("Section%s, target %s: Reloc out of range...not same section, aout_perf\n" 
  2831. +               "sec->out=%s, target->out=%s, offset=%lx\n",sec->name, target_section->name,
  2832. +               sec->output_section->name,target_section->output_section->name,r->address));
  2833. +         }
  2834. +       else
  2835. +         { /* Same section */
  2836. +           relocation=-(r->address+sec->output_offset);
  2837. +           copy=false;
  2838. +           DPRINT(5,("Reloc to same section...\n"));
  2839. +         }
  2840. +     }
  2841. +       break;
  2842. +     case 2: /* 32 bit reloc, abs. or relative */
  2843. +       DPRINT(10,("32 bit\n"));
  2844. +       size=2;
  2845. +       if (target_section==bfd_abs_section_ptr) /* Ref to absolute hunk */
  2846. +     relocation=sym->value;
  2847. +       else if (target_section==bfd_com_section_ptr) /* ref to common */
  2848. +     {
  2849. +       relocation=0;
  2850. +       copy=true;
  2851. +     }
  2852. +       else
  2853. +     {
  2854. +       /* If we access a symbol in the .bss section, we have to convert this to an access to .data section*/
  2855. +       /* This is done through a change to the output section of the symbol... */
  2856. +       if (amiga_base_relative && (strcmp(sym->section->output_section->name,".bss")==0))
  2857. +         {
  2858. +           /* get value for .data section */
  2859. +           bfd *ibfd;
  2860. +           asection *s;
  2861. +           ibfd=target_section->output_section->owner;
  2862. +           for (s=ibfd->sections;s!=NULL;s=s->next)
  2863. +         if (strcmp(s->name,".data")==0)
  2864. +           {
  2865. +             sym->section->output_section=s;
  2866. +             sym->section->output_offset=s->_raw_size;
  2867. +           }
  2868. +         }
  2869. +       relocation=0;
  2870. +       copy=true;
  2871. +     }
  2872. +       DPRINT(10,("target->out=%s(%lx), sec->out=%s(%lx), symbol=%s\n",
  2873. +          target_section->output_section->name,
  2874. +          target_section->output_section,sec->output_section->name,
  2875. +          sec->output_section,sym->name));
  2876. +       break;
  2877. +     case 9: /* 16 bit base relative */
  2878. +     case 10: /* 32 bit base relative */
  2879. +       DPRINT(10,("32/16 bit baserel\n"));
  2880. +       /* We use the symbol ___a4_init as base */
  2881. +       size=r->howto->type-8;
  2882. +       
  2883. +     baserel: 
  2884. +       if (target_section==bfd_abs_section_ptr) /* Hmmmm, this should have been baserel, but we allow
  2885. +                           this */
  2886. +     {
  2887. +       fprintf(stderr,"Warning: Baserel reloc to symbol %s converted to absolut in section %s\n",
  2888. +           sym->name,sec->name);
  2889. +       relocation=sym->value;
  2890. +     }
  2891. +       else if (target_section==bfd_com_section_ptr) /* Error.. */
  2892. +     {
  2893. +       relocation=0;
  2894. +       copy=false;
  2895. +       ret=bfd_reloc_undefined;
  2896. +       fprintf(stderr,"Baserelative relocation to common \"%s\"\n", sym->name);
  2897. +       DPRINT(10,("Ref to common symbol...aout_perf_reloc\n"));
  2898. +     }
  2899. +       else /* Target section and sec need not be the same... */
  2900. +     {
  2901. +       /* Get value for ___a4init */
  2902. +       if ((a4init=mygeta4(target_section->output_section->owner))==NULL)
  2903. +         {
  2904. +           fprintf(stderr,"Base symbol for base relative reloc not defined, section %s, reloc to symbol"
  2905. +               "%s\n",sec->name,sym->name);
  2906. +           copy=false;
  2907. +           ret=bfd_reloc_notsupported;
  2908. +           DPRINT(10,("target->out=%s(%lx), sec->out=%s(%lx), symbol=%s\n",
  2909. +              target_section->output_section->name,
  2910. +              target_section->output_section,sec->output_section->name,
  2911. +              sec->output_section,sym->name));
  2912. +           
  2913. +           break;
  2914. +         }
  2915. +       
  2916. +       /* If target->out is .bss, add the value of the .data section....to sym, set new output_section */
  2917. +       if (strcmp(target_section->output_section->name,".bss")==0)
  2918. +         {
  2919. +           bfd *ibfd;
  2920. +           asection *s;
  2921. +           ibfd=target_section->output_section->owner;
  2922. +           for (s=ibfd->sections;s!=NULL;s=s->next)
  2923. +         if (strcmp(s->name,".data")==0)
  2924. +           {
  2925. +             sym->section->output_offset=s->_raw_size;
  2926. +             sym->section->output_section=s;
  2927. +           }
  2928. +         }
  2929. +       relocation=sym->value+sym->section->output_offset-a4init->value+r->addend;
  2930. +       copy=false; /* Nothing to do, since write_section_contents adds output_offset.. */
  2931. +     }
  2932. +       DPRINT(10,("target->out=%s(%lx), sec->out=%s(%lx), symbol=%s\n",
  2933. +          target_section->output_section->name,
  2934. +          target_section->output_section,sec->output_section->name,
  2935. +          sec->output_section,sym->name));
  2936. +       break;
  2937. +       
  2938. +     default:
  2939. +       copy=false;
  2940. +       relocation=0;
  2941. +       ret=bfd_reloc_notsupported;
  2942. +       DPRINT(10,("Unsupported reloc:%d\n",r->howto->type));
  2943. +       break;
  2944. +     }/* Of switch */
  2945. +   /* Add in relocation */
  2946. +   if (relocation!=0)
  2947. +     ret=my_add_to(data,r->address,2,relocation);
  2948. +   
  2949. +   if (copy)/* Copy reloc to output section */
  2950. +     {
  2951. +       DPRINT(5,("Copying reloc\n"));
  2952. +       target_section=sec->output_section;
  2953. +       r->address+=sec->output_offset;
  2954. +       target_section->orelocation[target_section->reloc_count++]=r;
  2955. +     }
  2956. +   DPRINT(5,("Leaving aout_perf_reloc with %d (OK=%d)\n",ret,bfd_reloc_ok));
  2957. +   return ret;
  2958. + }
  2959. + /* The final link routine, used both by Amiga and a.out backend*/
  2960. + /* This is nearly a copy of _bfd_generic_final_link */
  2961. + boolean
  2962. + amiga_final_link (abfd, info)
  2963. +      bfd *abfd;
  2964. +      struct bfd_link_info *info;
  2965. + {
  2966. +   bfd *sub;
  2967. +   asection *o,*act_sec;
  2968. +   struct bfd_link_order *p;
  2969. +   size_t outsymalloc;
  2970. +   struct generic_write_global_symbol_info wginfo;
  2971. +   DPRINT(5,("Entering final_link\n"));
  2972. +   abfd->outsymbols = (asymbol **) NULL;
  2973. +   abfd->symcount = 0;
  2974. +   outsymalloc = 0;
  2975. +   /* Build the output symbol table.  */
  2976. +   for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next)
  2977. +     if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc))
  2978. +       return false;
  2979. +   DPRINT(10,("Did build output symbol table\n"));
  2980. +   /* Accumulate the global symbols.  */
  2981. +   wginfo.info = info;
  2982. +   wginfo.output_bfd = abfd;
  2983. +   wginfo.psymalloc = &outsymalloc;
  2984. +   _bfd_generic_link_hash_traverse (_bfd_generic_hash_table (info),
  2985. +                                    _bfd_generic_link_write_global_symbol,
  2986. +                                    (PTR) &wginfo);
  2987. +   DPRINT(10,("Accumulated global symbols\n"));
  2988. +   DPRINT(10,("Output bfd is %s(%lx)\n",abfd->filename,abfd));
  2989. +   /* Allocate space for the output relocs for each section.  */
  2990. +   /* We also handle base-relative linking special, by setting the .data sections real length to
  2991. +      it's length + .bss length */
  2992. +   /* This is different to bfd_generic_final_link: We ALWAYS alloc space for the relocs,
  2993. +      because we may need it anyway */
  2994. +   for (o = abfd->sections;
  2995. +        o != (asection *) NULL;
  2996. +        o = o->next)
  2997. +     {
  2998. +       /* If section is .data, find .bss and add that length */
  2999. +       if (!info->relocateable && amiga_base_relative && (strcmp(o->name,".data")==0))
  3000. +     {
  3001. +       if (abfd->xvec->flavour!=bfd_target_amiga_flavour) /* oops */
  3002. +         {
  3003. +           fprintf(stderr,"You can't use base relative linking with partial links.\n");
  3004. +         }
  3005. +       else
  3006. +         {
  3007. +           for (act_sec=abfd->sections; act_sec!=NULL;act_sec=act_sec->next)
  3008. +         if (strcmp(act_sec->name,".bss")==0)
  3009. +           amiga_per_section(o)->real_length=o->_raw_size+act_sec->_raw_size;
  3010. +         }
  3011. +     }/* Of base-relative linking */
  3012. +       DPRINT(10,("Section in output bfd is %s (%lx)\n",o->name,o));
  3013. +       o->reloc_count = 0;
  3014. +       for (p = o->link_order_head;
  3015. +        p != (struct bfd_link_order *) NULL;
  3016. +        p = p->next)
  3017. +     {
  3018. +       if (p->type == bfd_section_reloc_link_order
  3019. +           || p->type == bfd_symbol_reloc_link_order)
  3020. +         ++o->reloc_count;
  3021. +       else if (p->type == bfd_indirect_link_order)
  3022. +         {
  3023. +           asection *input_section;
  3024. +           bfd *input_bfd;
  3025. +           long relsize;
  3026. +           arelent **relocs;
  3027. +           asymbol **symbols;
  3028. +           long reloc_count;
  3029. +           
  3030. +           input_section = p->u.indirect.section;
  3031. +           input_bfd = input_section->owner;
  3032. +           DPRINT(10,("\tIndirect section from bfd %s, section is %s(%lx) (COM=%lx)\n",
  3033. +              input_bfd->filename,input_section->name,input_section,
  3034. +              bfd_com_section_ptr));
  3035. +           relsize = bfd_get_reloc_upper_bound (input_bfd,
  3036. +                            input_section);
  3037. +           if (relsize < 0)
  3038. +         {
  3039. +           DPRINT(10,("Relsize<0.I..in bfd %s, sec %s\n",input_bfd->filename,
  3040. +                  input_section->name));
  3041. +           return false;
  3042. +         }
  3043. +           relocs = (arelent **) malloc ((size_t) relsize);
  3044. +           if (!relocs && relsize != 0)
  3045. +         {
  3046. +           bfd_set_error (bfd_error_no_memory);
  3047. +           return false;
  3048. +         }
  3049. +           symbols = _bfd_generic_link_get_symbols (input_bfd);
  3050. +           reloc_count = bfd_canonicalize_reloc (input_bfd,
  3051. +                             input_section,
  3052. +                             relocs,
  3053. +                             symbols);
  3054. +           if (reloc_count < 0)
  3055. +         {
  3056. +           DPRINT(10,("Relsize<0.II..in bfd %s, sec %s\n",input_bfd->filename,
  3057. +                  input_section->name));
  3058. +           return false;
  3059. +         }
  3060. +           BFD_ASSERT (reloc_count == input_section->reloc_count);
  3061. +           o->reloc_count += reloc_count;
  3062. +           free (relocs);
  3063. +         }
  3064. +     }
  3065. +       if (o->reloc_count > 0)
  3066. +     {
  3067. +       o->orelocation = ((arelent **)
  3068. +                 bfd_alloc (abfd,
  3069. +                        (o->reloc_count
  3070. +                     * sizeof (arelent *))));
  3071. +       if (!o->orelocation)
  3072. +         {
  3073. +           bfd_set_error (bfd_error_no_memory);
  3074. +           return false;
  3075. +         }
  3076. +       /* o->flags |= SEC_RELOC; There may be no relocs. This can be determined only later */
  3077. +       /* Reset the count so that it can be used as an index
  3078. +          when putting in the output relocs.  */
  3079. +       o->reloc_count = 0;
  3080. +     }
  3081. +     }
  3082. +         
  3083. +   DPRINT(10,("Got all relocs\n"));
  3084. +   /* Handle all the link order information for the sections.  */
  3085. +   for (o = abfd->sections;
  3086. +        o != (asection *) NULL;
  3087. +        o = o->next)
  3088. +     {
  3089. +       for (p = o->link_order_head;
  3090. +            p != (struct bfd_link_order *) NULL;
  3091. +            p = p->next)
  3092. +         {
  3093. +           switch (p->type)
  3094. +             {
  3095. +             case bfd_section_reloc_link_order:
  3096. +             case bfd_symbol_reloc_link_order:
  3097. +               if (! amiga_reloc_link_order (abfd, info, o, p)) /* We use an own routine */
  3098. +                 return false;
  3099. +               break;
  3100. +             case bfd_indirect_link_order:
  3101. +               if (! default_indirect_link_order (abfd, info, o, p, true)) 
  3102. +         /* Calls our get_relocated_section_contents*/
  3103. +                 return false;
  3104. +               break;
  3105. +             default:
  3106. +               if (! _bfd_default_link_order (abfd, info, o, p))
  3107. +                 return false;
  3108. +               break;
  3109. +             }
  3110. +         }
  3111. +     }
  3112. +   if (abfd->xvec->flavour==bfd_target_amiga_flavour&&!info->relocateable)
  3113. +     AMIGA_DATA(abfd)->IsLoadFile=true;
  3114. +   DPRINT(10,("Leaving final_link\n"));
  3115. +   return true;
  3116. + }
  3117. + /* Handle reloc link order . This is nearly a copy from gneric_reloc_link_order in linker.c*/
  3118. + static boolean 
  3119. + amiga_reloc_link_order(bfd *abfd,struct bfd_link_info *info  , asection *sec, struct bfd_link_order *link_order)
  3120. + {
  3121. +    amiga_reloc_type *r;
  3122. +    DPRINT(5,("Entering amiga_reloc_link_order\n"));
  3123. +    /* We generate a new AMIGA style reloc */
  3124. +    BFD_ASSERT(sec->orelocation!=NULL);
  3125. +    if (sec->orelocation == (arelent **) NULL)
  3126. +      {
  3127. +        DPRINT(10,("aborting, since orelocation==NULL\n"));
  3128. +        abort ();
  3129. +      }
  3130. +    r = (amiga_reloc_type *) bfd_zalloc (abfd, sizeof (amiga_reloc_type));
  3131. +    if (r ==  NULL)
  3132. +      {
  3133. +        bfd_set_error (bfd_error_no_memory);
  3134. +        DPRINT(5,("Leaving amiga_reloc_link, no mem\n"));
  3135. +        return false;
  3136. +      }
  3137. +    
  3138. +    r->relent.address = link_order->offset;
  3139. +    r->relent.howto = bfd_reloc_type_lookup (abfd, link_order->u.reloc.p->reloc);
  3140. +    if (r->relent.howto ==  NULL)
  3141. +      {
  3142. +        bfd_set_error (bfd_error_bad_value);
  3143. +        DPRINT(5,("Leaving amiga_reloc_link, bad value\n"));
  3144. +        return false;
  3145. +      }
  3146. +    
  3147. +    /* Get the symbol to use for the relocation.  */
  3148. +    if (link_order->type == bfd_section_reloc_link_order)
  3149. +      r->relent.sym_ptr_ptr = link_order->u.reloc.p->u.section->symbol_ptr_ptr;
  3150. +    else
  3151. +      {
  3152. +        struct generic_link_hash_entry *h;
  3153. +        
  3154. +        h = _bfd_generic_link_hash_lookup (_bfd_generic_hash_table (info),
  3155. +                       link_order->u.reloc.p->u.name,
  3156. +                       false, false, true);
  3157. +        if (h == (struct generic_link_hash_entry *) NULL
  3158. +        || ! h->written)
  3159. +      {
  3160. +        if (! ((*info->callbacks->unattached_reloc)
  3161. +           (info, link_order->u.reloc.p->u.name,
  3162. +            (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
  3163. +          return false;
  3164. +        bfd_set_error (bfd_error_bad_value);
  3165. +        DPRINT(5,("Leaving amiga_reloc_link, bad value in hash lookup\n"));
  3166. +        return false;
  3167. +      }
  3168. +        r->relent.sym_ptr_ptr = &h->sym;
  3169. +      }
  3170. +    DPRINT(5,("Got symbol for relocation\n"));
  3171. +    /* Store the addend */
  3172. +    r->relent.addend = link_order->u.reloc.p->addend;
  3173. +    /* If we are generating relocateable output, just add the reloc */
  3174. +    if (info->relocateable)
  3175. +      {
  3176. +        DPRINT(5,("Adding reloc\n"));
  3177. +        sec->orelocation[sec->reloc_count] = (arelent *)r;
  3178. +        ++sec->reloc_count; 
  3179. +        sec->flags|=SEC_RELOC;
  3180. +      }
  3181. +    else
  3182. +      { /* Try to apply the reloc */
  3183. +        char *em="";
  3184. +        PTR data;
  3185. +        bfd_reloc_status_type ret;
  3186. +        DPRINT(5,("Apply link_order_reloc\n"));
  3187. +        /*FIXME: Maybe, we have to get the section contents, before we use them, if they have not been
  3188. +      set by now.. */
  3189. +        BFD_ASSERT(sec->contents!=NULL);
  3190. +        data=(PTR)(sec->contents);
  3191. +        if (bfd_get_flavour(abfd)==bfd_target_amiga_flavour)
  3192. +      ret=amiga_perform_reloc(abfd,(arelent *)r,data,sec,NULL,&em);
  3193. +        else
  3194. +      ret=aout_perform_reloc(abfd,(arelent *)r,data,sec,NULL,&em);
  3195. +        if (ret!=bfd_reloc_ok)
  3196. +      {
  3197. +        DPRINT(5,("Leaving amiga_reloc_link, value false\n"));
  3198. +        return false;
  3199. +      }
  3200. +      }
  3201. +    DPRINT(5,("Leaving amiga_reloc_link\n"));
  3202. +    return true;
  3203. + }
  3204. diff -rc --new-file binutils-2.5.2-base/bfd/aout-amiga.c binutils-2.5.2/bfd/aout-amiga.c
  3205. *** binutils-2.5.2-base/bfd/aout-amiga.c    Thu Jan  1 00:00:00 1970
  3206. --- binutils-2.5.2/bfd/aout-amiga.c    Fri Feb 10 14:29:10 1995
  3207. ***************
  3208. *** 0 ****
  3209. --- 1,39 ----
  3210. + /* BFD backend for Amiga style a.out with flags set to 0
  3211. +    Copyright (C) 1990, 91, 92, 93, 1994 Free Software Foundation, Inc.
  3212. +    Written by Stephan Thesing.
  3213. + This file is part of BFD, the Binary File Descriptor library.
  3214. + This program is free software; you can redistribute it and/or modify
  3215. + it under the terms of the GNU General Public License as published by
  3216. + the Free Software Foundation; either version 2 of the License, or
  3217. + (at your option) any later version.
  3218. + This program is distributed in the hope that it will be useful,
  3219. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  3220. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3221. + GNU General Public License for more details.
  3222. + You should have received a copy of the GNU General Public License
  3223. + along with this program; if not, write to the Free Software
  3224. + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  3225. + #define TARGETNAME "a.out-amiga"
  3226. + #define MY(OP) CAT(aout_amiga_,OP)
  3227. + #include "bfd.h"
  3228. + #define MY_exec_hdr_flags 0
  3229. + extern boolean
  3230. + amiga_final_link(bfd *,struct bfd_link_info *);
  3231. + #define MY_bfd_final_link amiga_final_link
  3232. + extern bfd_byte *
  3233. + get_relocated_section_contents(bfd *, struct bfd_link_info *,
  3234. +                    struct bfd_link_order *, bfd_byte *,
  3235. +                    boolean , asymbol **);
  3236. + #define MY_bfd_get_relocated_section_contents get_relocated_section_contents
  3237. + /* Include the usual a.out support.  */
  3238. + #include "aoutf1.h"
  3239. diff -rc --new-file binutils-2.5.2-base/bfd/aoutx.h binutils-2.5.2/bfd/aoutx.h
  3240. *** binutils-2.5.2-base/bfd/aoutx.h    Mon Oct 31 07:00:21 1994
  3241. --- binutils-2.5.2/bfd/aoutx.h    Tue Feb 14 20:11:24 1995
  3242. ***************
  3243. *** 134,140 ****
  3244.   static boolean aout_get_external_symbols PARAMS ((bfd *));
  3245.   static boolean translate_from_native_sym_flags
  3246.     PARAMS ((bfd *, aout_symbol_type *));
  3247. ! static boolean translate_to_native_sym_flags
  3248.     PARAMS ((bfd *, asymbol *, struct external_nlist *));
  3249.   
  3250.   /*
  3251. --- 134,141 ----
  3252.   static boolean aout_get_external_symbols PARAMS ((bfd *));
  3253.   static boolean translate_from_native_sym_flags
  3254.     PARAMS ((bfd *, aout_symbol_type *));
  3255. ! /*Amiga hack - used in amigados.c, must be global */
  3256. ! /*static*/ boolean translate_to_native_sym_flags
  3257.     PARAMS ((bfd *, asymbol *, struct external_nlist *));
  3258.   
  3259.   /*
  3260. ***************
  3261. *** 1525,1531 ****
  3262.   
  3263.   /* Set the fields of SYM_POINTER according to CACHE_PTR.  */
  3264.   
  3265. ! static boolean
  3266.   translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
  3267.        bfd *abfd;
  3268.        asymbol *cache_ptr;
  3269. --- 1526,1532 ----
  3270.   
  3271.   /* Set the fields of SYM_POINTER according to CACHE_PTR.  */
  3272.   
  3273. ! /*static*/ boolean
  3274.   translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
  3275.        bfd *abfd;
  3276.        asymbol *cache_ptr;
  3277. ***************
  3278. *** 1916,1925 ****
  3279. --- 1917,1943 ----
  3280.   
  3281.     r_length = g->howto->size ;    /* Size as a power of two */
  3282.     r_pcrel  = (int) g->howto->pc_relative; /* Relative to PC? */
  3283. + #ifdef __amigados__
  3284. +   /* Changed for cooperation with AMIGA backend */
  3285. +   /* This only applies, if aout flavour    191194 ST*/
  3286.     /* XXX This relies on relocs coming from a.out files.  */
  3287. +   /* FIXME! "#ifdef __amigados__" is the wrong way to select this code. */
  3288. +   if (bfd_asymbol_bfd(sym)->xvec->flavour==bfd_target_aout_flavour)
  3289. +     {
  3290. +       r_baserel = (g->howto->type & 8) != 0;
  3291. +       r_jmptable = (g->howto->type & 16) != 0;
  3292. +       r_relative = (g->howto->type & 32) != 0;
  3293. +     }
  3294. +   else
  3295. +     {
  3296. +       r_baserel=r_jmptable=r_relative=0;
  3297. +     }
  3298. + #else
  3299.     r_baserel = (g->howto->type & 8) != 0;
  3300.     r_jmptable = (g->howto->type & 16) != 0;
  3301.     r_relative = (g->howto->type & 32) != 0;
  3302. + #endif
  3303.   
  3304.   #if 0
  3305.     /* For a standard reloc, the addend is in the object file.  */
  3306. ***************
  3307. *** 2399,2404 ****
  3308. --- 2417,2427 ----
  3309.   
  3310.     if (asect == obj_bsssec (abfd))
  3311.       return 0;
  3312. + #ifdef __amigados__    /* FIXME */
  3313. +   fprintf(stderr,"Hmmm, sec=%s, %lx, .text=%lx, .data=%lx, .bss=%lx\n",
  3314. +       asect->name,asect,obj_textsec(abfd),obj_datasec(abfd),obj_bsssec(abfd));
  3315. + #endif
  3316.   
  3317.     bfd_set_error (bfd_error_invalid_operation);
  3318.     return -1;
  3319. diff -rc --new-file binutils-2.5.2-base/bfd/archive.c binutils-2.5.2/bfd/archive.c
  3320. *** binutils-2.5.2-base/bfd/archive.c    Sat Oct 22 01:27:47 1994
  3321. --- binutils-2.5.2/bfd/archive.c    Wed Feb 15 18:23:32 1995
  3322. ***************
  3323. *** 1630,1637 ****
  3324. --- 1630,1640 ----
  3325.       {
  3326.         if (bfd_update_armap_timestamp (arch))
  3327.           break;
  3328. + #if 0    /* Amiga hack - this seems to always happen.  Need to investigate
  3329. +        why and fix it.  For now, stop the gripes... -fnf */
  3330.         fprintf (stderr,
  3331.              "Warning: writing archive was slow: rewriting timestamp\n");
  3332. + #endif
  3333.       }
  3334.         while (++tries < 6);
  3335.       }
  3336. diff -rc --new-file binutils-2.5.2-base/bfd/bfd-in2.h binutils-2.5.2/bfd/bfd-in2.h
  3337. *** binutils-2.5.2-base/bfd/bfd-in2.h    Sat Oct 22 01:27:50 1994
  3338. --- binutils-2.5.2/bfd/bfd-in2.h    Fri Feb 10 14:29:18 1995
  3339. ***************
  3340. *** 1787,1792 ****
  3341. --- 1787,1793 ----
  3342.         struct lynx_core_struct *lynx_core_data;
  3343.         struct osf_core_struct *osf_core_data;
  3344.         struct cisco_core_struct *cisco_core_data;
  3345. +       struct amiga_data_struct *amiga_data;
  3346.         PTR any;
  3347.         } tdata;
  3348.     
  3349. ***************
  3350. *** 1984,1990 ****
  3351.     bfd_target_tekhex_flavour,
  3352.     bfd_target_srec_flavour,
  3353.     bfd_target_som_flavour,
  3354. !   bfd_target_os9k_flavour};
  3355.   
  3356.    /* Forward declaration.  */
  3357.   typedef struct bfd_link_info _bfd_link_info;
  3358. --- 1985,1992 ----
  3359.     bfd_target_tekhex_flavour,
  3360.     bfd_target_srec_flavour,
  3361.     bfd_target_som_flavour,
  3362. !   bfd_target_os9k_flavour,
  3363. !   bfd_target_amiga_flavour};
  3364.   
  3365.    /* Forward declaration.  */
  3366.   typedef struct bfd_link_info _bfd_link_info;
  3367. diff -rc --new-file binutils-2.5.2-base/bfd/bfd.c binutils-2.5.2/bfd/bfd.c
  3368. *** binutils-2.5.2-base/bfd/bfd.c    Fri Oct 14 23:16:16 1994
  3369. --- binutils-2.5.2/bfd/bfd.c    Fri Feb 10 14:29:20 1995
  3370. ***************
  3371. *** 169,174 ****
  3372. --- 169,175 ----
  3373.   .      struct lynx_core_struct *lynx_core_data;
  3374.   .      struct osf_core_struct *osf_core_data;
  3375.   .      struct cisco_core_struct *cisco_core_data;
  3376. + .      struct amiga_data_struct *amiga_data;
  3377.   .      PTR any;
  3378.   .      } tdata;
  3379.   .  
  3380. diff -rc --new-file binutils-2.5.2-base/bfd/config/amigados.mh binutils-2.5.2/bfd/config/amigados.mh
  3381. *** binutils-2.5.2-base/bfd/config/amigados.mh    Thu Jan  1 00:00:00 1970
  3382. --- binutils-2.5.2/bfd/config/amigados.mh    Fri Feb 10 14:29:22 1995
  3383. ***************
  3384. *** 0 ****
  3385. --- 1,5 ----
  3386. + # Host makefile fragment for Commodore Amiga running AmigaDOS
  3387. + # Use the GNU C compiler.
  3388. + CC=gcc
  3389. + # Don't use -g, it doesn't do anything useful yet.  Optimize though.
  3390. + CFLAGS=-O
  3391. diff -rc --new-file binutils-2.5.2-base/bfd/config/amigados.mt binutils-2.5.2/bfd/config/amigados.mt
  3392. *** binutils-2.5.2-base/bfd/config/amigados.mt    Thu Jan  1 00:00:00 1970
  3393. --- binutils-2.5.2/bfd/config/amigados.mt    Fri Feb 10 14:29:24 1995
  3394. ***************
  3395. *** 0 ****
  3396. --- 1,5 ----
  3397. + # Target config file for Commodore Amiga running AmigaDOS
  3398. + SELECT_VECS =aout_amiga_vec
  3399. + #We use two backends on AMIGA: HUNK and gcc's a.out format
  3400. + DEFAULT_VECTOR=amiga_vec
  3401. + SELECT_ARCHITECTURES=bfd_m68k_arch
  3402. diff -rc --new-file binutils-2.5.2-base/bfd/config.bfd binutils-2.5.2/bfd/config.bfd
  3403. *** binutils-2.5.2-base/bfd/config.bfd    Tue Sep 13 18:30:07 1994
  3404. --- binutils-2.5.2/bfd/config.bfd    Fri Feb 10 14:29:26 1995
  3405. ***************
  3406. *** 81,86 ****
  3407. --- 81,87 ----
  3408.     m68*-*-vxworks*)    bfd_name=m68k-aout strip_underscore=yes ;;
  3409.     m68*-ericsson-*)    bfd_name=m68k-ose strip_underscore=yes ;;
  3410.     m68*-netx-*)        bfd_name=m68k-aout strip_underscore=yes ;;
  3411. +   m68*-cbm-amigados*)    bfd_name=amigados ;;
  3412.   
  3413.     m88*-harris-cxux*)    bfd_name=m88k-elf ;;
  3414.     # DGUX used to use COFF, but now (Jan 94) I believe it uses ELF by default.
  3415. diff -rc --new-file binutils-2.5.2-base/bfd/configure.in binutils-2.5.2/bfd/configure.in
  3416. *** binutils-2.5.2-base/bfd/configure.in    Wed Oct 19 18:00:22 1994
  3417. --- binutils-2.5.2/bfd/configure.in    Fri Feb 10 14:29:28 1995
  3418. ***************
  3419. *** 137,143 ****
  3420. --- 137,145 ----
  3421.       # with the two vector lists in targets.c.
  3422.       a29kcoff_big_vec)        tb="$tb coff-a29k.o cofflink.o" ;;
  3423.       a_out_adobe_vec)        tb="$tb aout-adobe.o aout32.o stab-syms.o" ;;
  3424. +     amiga_vec)            tb="$tb amigados.o amigadoslink.o" ;;
  3425.       aout0_big_vec)        tb="$tb aout0.o aout32.o stab-syms.o" ;;
  3426. +     aout_amiga_vec)             tb="$tb aout-amiga.o aout32.o stab-syms.o";;
  3427.       aout_mips_big_vec)        tb="$tb mipsbsd.o aout32.o stab-syms.o" ;;
  3428.       aout_mips_little_vec)    tb="$tb mipsbsd.o aout32.o stab-syms.o" ;;
  3429.       apollocoff_vec)        tb="$tb coff-apollo.o" ;;
  3430. ***************
  3431. *** 273,281 ****
  3432.   test -n "$DEFAULT_VECTOR" && defvec="$DEFAULT_VECTOR"
  3433.   
  3434.   echo "TDEFAULTS = \
  3435. ! ${defvec+-DDEFAULT_VECTOR=$defvec} \
  3436. ! ${selvecs+-DSELECT_VECS='$selvecs'} \
  3437. ! ${selarchs+-DSELECT_ARCHITECTURES='$selarchs'}" \
  3438.     >> Makefile.2
  3439.   
  3440.   cat Makefile.tmp >> Makefile.2
  3441. --- 275,283 ----
  3442.   test -n "$DEFAULT_VECTOR" && defvec="$DEFAULT_VECTOR"
  3443.   
  3444.   echo "TDEFAULTS = \
  3445. ! \"-DDEFAULT_VECTOR=$defvec\" \
  3446. ! \"-DSELECT_VECS=$selvecs\" \
  3447. ! \"-DSELECT_ARCHITECTURES=$selarchs\"" \
  3448.     >> Makefile.2
  3449.   
  3450.   cat Makefile.tmp >> Makefile.2
  3451. diff -rc --new-file binutils-2.5.2-base/bfd/doc/Makefile.in binutils-2.5.2/bfd/doc/Makefile.in
  3452. *** binutils-2.5.2-base/bfd/doc/Makefile.in    Mon Sep 12 15:48:32 1994
  3453. --- binutils-2.5.2/bfd/doc/Makefile.in    Tue Feb 14 19:29:08 1995
  3454. ***************
  3455. *** 67,73 ****
  3456.   
  3457.   DOCFILES = aoutx.texi  archive.texi archures.texi \
  3458.       bfd.texi  cache.texi coffcode.texi \
  3459. !     core.texi elf.texi elfcode.texi  format.texi  libbfd.texi  \
  3460.       opncls.texi  reloc.texi  section.texi  \
  3461.       syms.texi  targets.texi init.texi hash.texi linker.texi
  3462.   
  3463. --- 67,73 ----
  3464.   
  3465.   DOCFILES = aoutx.texi  archive.texi archures.texi \
  3466.       bfd.texi  cache.texi coffcode.texi \
  3467. !     core.texi elf.texi elfcode.texi  amiga.texi amigalink.texi format.texi  libbfd.texi  \
  3468.       opncls.texi  reloc.texi  section.texi  \
  3469.       syms.texi  targets.texi init.texi hash.texi linker.texi
  3470.   
  3471. ***************
  3472. *** 87,92 ****
  3473. --- 87,93 ----
  3474.       $(srcdir)/../cache.c $(srcdir)/../coffcode.h \
  3475.       $(srcdir)/../core.c $(srcdir)/../elf.c \
  3476.       $(srcdir)/../elfcode.h  $(srcdir)/../format.c \
  3477. +     $(srcdir)/../amigados.c $(srcdir)/../amigadoslink.c \
  3478.       $(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
  3479.       $(srcdir)/../reloc.c  $(srcdir)/../section.c \
  3480.       $(srcdir)/../syms.c  $(srcdir)/../targets.c \
  3481. ***************
  3482. *** 136,141 ****
  3483. --- 137,148 ----
  3484.   aoutx.texi: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
  3485.       $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.texi
  3486.   
  3487. + amiga.texi: $(MKDOC) $(srcdir)/../amigados.c $(srcdir)/doc.str
  3488. +     $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigados.c >amiga.texi
  3489. + amigalink.texi: $(MKDOC) $(srcdir)/../amigadoslink.c $(srcdir)/doc.str
  3490. +     $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../amigadoslink.c >amigalink.texi
  3491.   archive.texi: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str
  3492.       $(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.texi 
  3493.   
  3494. ***************
  3495. *** 264,269 ****
  3496. --- 271,279 ----
  3497.   
  3498.   bfd.info: $(DOCFILES) bfdsumm.texi bfd.texinfo
  3499.       $(MAKEINFO) -I$(srcdir) -o bfd.info $(srcdir)/bfd.texinfo
  3500. + bfd.guide: $(DOCFILES) bfdsumm.texi bfd.texinfo
  3501. +     $(MAKEINFO) --amiga -I$(srcdir) -o bfd.guide $(srcdir)/bfd.texinfo
  3502.   
  3503.   bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo
  3504.       $(TEXI2DVI) $(srcdir)/bfd.texinfo
  3505. diff -rc --new-file binutils-2.5.2-base/bfd/doc/bfd.texinfo binutils-2.5.2/bfd/doc/bfd.texinfo
  3506. *** binutils-2.5.2-base/bfd/doc/bfd.texinfo    Mon Sep 12 15:48:33 1994
  3507. --- binutils-2.5.2/bfd/doc/bfd.texinfo    Fri Feb 10 14:29:30 1995
  3508. ***************
  3509. *** 302,310 ****
  3510.   @chapter BFD back ends
  3511.   @menu
  3512.   * What to Put Where::
  3513. ! * aout ::    a.out backends
  3514. ! * coff ::    coff backends
  3515. ! * elf  ::    elf backends
  3516.   @ignore
  3517.   * oasys ::    oasys backends
  3518.   * ieee ::    ieee backend
  3519. --- 302,311 ----
  3520.   @chapter BFD back ends
  3521.   @menu
  3522.   * What to Put Where::
  3523. ! * aout  ::    a.out backends
  3524. ! * coff  ::    coff backends
  3525. ! * elf   ::    elf backends
  3526. ! * amiga ::      amigados backend
  3527.   @ignore
  3528.   * oasys ::    oasys backends
  3529.   * ieee ::    ieee backend
  3530. ***************
  3531. *** 320,329 ****
  3532.   @node coff, elf, aout, BFD back ends
  3533.   @include  coffcode.texi
  3534.   
  3535. ! @node elf,  , coff, BFD back ends
  3536.   @include  elf.texi
  3537.   @c Leave this out until the file has some actual contents...
  3538.   @c @include  elfcode.texi
  3539.   
  3540.   @node Index,  , BFD back ends , Top
  3541.   @unnumbered Index
  3542. --- 321,334 ----
  3543.   @node coff, elf, aout, BFD back ends
  3544.   @include  coffcode.texi
  3545.   
  3546. ! @node elf, amiga  , coff, BFD back ends
  3547.   @include  elf.texi
  3548.   @c Leave this out until the file has some actual contents...
  3549.   @c @include  elfcode.texi
  3550. + @node amiga,  , elf, BFD back ends
  3551. + @include amiga.texi
  3552. + @include amigalink.texi
  3553.   
  3554.   @node Index,  , BFD back ends , Top
  3555.   @unnumbered Index
  3556. diff -rc --new-file binutils-2.5.2-base/bfd/hosts/amigados.h binutils-2.5.2/bfd/hosts/amigados.h
  3557. *** binutils-2.5.2-base/bfd/hosts/amigados.h    Thu Jan  1 00:00:00 1970
  3558. --- binutils-2.5.2/bfd/hosts/amigados.h    Fri Feb 10 14:29:30 1995
  3559. ***************
  3560. *** 0 ****
  3561. --- 1,5 ----
  3562. + /* Host configuration for AmigaDOS */
  3563. + #ifndef hosts_amigados_h
  3564. + #define hosts_amigados_h
  3565. + #include "hosts/std-host.h"
  3566. + #endif /* hosts_amigados_h */
  3567. diff -rc --new-file binutils-2.5.2-base/bfd/libamiga.h binutils-2.5.2/bfd/libamiga.h
  3568. *** binutils-2.5.2-base/bfd/libamiga.h    Thu Jan  1 00:00:00 1970
  3569. --- binutils-2.5.2/bfd/libamiga.h    Fri Feb 10 14:29:32 1995
  3570. ***************
  3571. *** 0 ****
  3572. --- 1,173 ----
  3573. + /* BFD back-end data structures for AmigaOS.
  3574. +    Copyright (C) 1992-1994 Free Software Foundation, Inc.
  3575. +    Contributed by Leonard Norrgard.
  3576. +    Extended by Stephan Thesing Nov 94
  3577. + This file is part of BFD, the Binary File Descriptor library.
  3578. + This program is free software; you can redistribute it and/or modify
  3579. + it under the terms of the GNU General Public License as published by
  3580. + the Free Software Foundation; either version 2 of the License, or
  3581. + (at your option) any later version.
  3582. + This program is distributed in the hope that it will be useful,
  3583. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  3584. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3585. + GNU General Public License for more details.
  3586. + You should have received a copy of the GNU General Public License
  3587. + along with this program; if not, write to the Free Software
  3588. + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  3589. + #ifdef __STDC__
  3590. + #define CAT3(a,b,c) a##b##c
  3591. + #else
  3592. + #define CAT3(a,b,c) a/**/b/**/c
  3593. + #endif
  3594. + #define GET_WORD bfd_h_get_32
  3595. + #define GET_SWORD (int32_type)GET_WORD
  3596. + #define PUT_WORD bfd_h_put_32
  3597. + #define NAME(x,y) CAT3(x,_32_,y)
  3598. + #define JNAME(x) CAT(x,_32)
  3599. + #define BYTES_IN_WORD 4
  3600. + #include <exec/memory.h>
  3601. + #include <dos/doshunks.h>
  3602. + #if 0
  3603. + /* Hunk ID numbers.*/  
  3604. + #define HUNK_UNIT       999
  3605. + #define HUNK_NAME    1000
  3606. + #define HUNK_CODE    1001
  3607. + #define HUNK_DATA    1002
  3608. + #define HUNK_BSS    1003
  3609. + #define HUNK_RELOC32    1004
  3610. + #define HUNK_RELOC16    1005
  3611. + #define HUNK_RELOC8    1006
  3612. + #define HUNK_EXT    1007
  3613. + #define HUNK_SYMBOL    1008
  3614. + #define HUNK_DEBUG    1009
  3615. + #define HUNK_END    1010
  3616. + #define HUNK_HEADER    1011
  3617. + #define HUNK_OVERLAY    1013
  3618. + #define HUNK_BREAK    1014
  3619. + #define HUNK_DREL32    1015
  3620. + #define HUNK_DREL16    1016
  3621. + #define HUNK_DREL8    1017
  3622. + #define HUNK_LIB    1018
  3623. + #define HUNK_INDEX    1019
  3624. + #endif
  3625. + /* The hunk ID part.  */
  3626. + #define HUNK_VALUE(hunk_id) ((hunk_id) & 0x3fffffff)
  3627. + /* Attributes of a hunk.  */
  3628. + #define HUNK_ATTRIBUTE(hunk_id) ((hunk_id) >> 30)
  3629. + #define HUNK_ATTR_CHIP 0x01 /* Hunk contents must go into chip (graphics) memory.  */
  3630. + #define HUNK_ATTR_FAST 0x02 /* fast */
  3631. + #define HUNK_ATTR_FOLLOWS 0x03 /* Mem id follows */
  3632. + #if 0
  3633. + /* HUNK_EXT sub-types.*/  
  3634. + #define EXT_SYMB    0    /* Symbol table.  */
  3635. + #define EXT_DEF        1    /* Relocatable definition.  */
  3636. + #define EXT_ABS        2    /* Absolute definition. */
  3637. + #define EXT_RES        3    /* Obsolete.  */
  3638. + #define EXT_REF32    129    /* 32 bit reference to symbol.  */
  3639. + #define EXT_COMMON    130    /* 32 bit reference to COMMON block.  */
  3640. + #define EXT_REF16    131    /* 16 bit reference to symbol.  */
  3641. + #define EXT_REF8    132    /*  8 bit reference to symbol.  */
  3642. + #define EXT_DEXT32    133    /* 32 bit data releative reference.  */
  3643. + #define EXT_DEXT16    134    /* 16 bit data releative reference.  */
  3644. + #define EXT_DEXT8    135    /*  8 bit data releative reference.  */
  3645. + #endif
  3646. + typedef struct amiga_reloc {
  3647. +   arelent relent;
  3648. +   struct amiga_reloc *next;
  3649. +   struct amiga_symbol *symbol;
  3650. +   long target_hunk;
  3651. + } amiga_reloc_type;
  3652. + typedef struct amiga_symbol {
  3653. +   asymbol symbol;
  3654. +   struct amiga_symbol *next;
  3655. +   long hunk_number;
  3656. +   unsigned char type;
  3657. + } amiga_symbol_type;
  3658. + struct amiga_raw_symbol {
  3659. +   struct amiga_raw_symbol *next;
  3660. +   unsigned long data[1];
  3661. + };
  3662. + typedef struct amiga_per_section
  3663. + {
  3664. +   amiga_reloc_type *reloc_tail; /* last reloc */ /* first is in section->relocation */
  3665. +   int attribute; /* Memory type required by this section */
  3666. +   int real_length; /* This is the length, occuring in the hunk */
  3667. +                    /* _raw_size may be larger than this */
  3668. +   int max_raw_relocs; /* Size of array */
  3669. +   int num_raw_relocs; /* # of relocs, this points to : */
  3670. +   unsigned long  **raw_relocs; /* Points to array of raw_relocs */
  3671. +                              /* every array element points to the raw data */
  3672. +   struct amiga_raw_symbol *first;
  3673. +   struct amiga_raw_symbol *last; /* tail */
  3674. +   
  3675. + } amiga_per_section_type;
  3676. + #define amiga_per_section(x) ((amiga_per_section_type *)((x)->used_by_bfd))
  3677. + /* The `tdata' struct for all a.out-like object file formats.
  3678. +    Various things depend on this struct being around any time an a.out
  3679. +    file is being handled.  An example is dbxread.c in GDB.  */
  3680. + struct amiga_data {
  3681. +   struct internal_exec *hdr;        /* exec file header */
  3682. +   amiga_symbol_type *symbols;        /* symtab for input bfd */
  3683. +   /* Filler, so we can pretend to be an a.out to GDB.  */
  3684. +   asection *textsec;
  3685. +   asection *datasec;
  3686. +   asection *bsssec;
  3687. +   /* The positions of the string table and symbol table.  */
  3688. +   file_ptr sym_filepos;
  3689. +   file_ptr str_filepos;
  3690. +   unsigned int n_symbols;               /* number of symbols */
  3691. +   /* Size of a relocation entry in external form */
  3692. +   unsigned dummy_reloc_entry_size;
  3693. +   /* Size of a symbol table entry in external form */
  3694. +   unsigned symbol_entry_size;
  3695. +   unsigned exec_bytes_size;
  3696. +   unsigned vma_adjusted : 1;
  3697. + };
  3698. + typedef struct  amiga_data_struct {
  3699. +   struct amiga_data a;
  3700. +   unsigned long symtab_size;
  3701. +   unsigned long stringtab_size;
  3702. +   unsigned long *first_byte;
  3703. +   unsigned long *file_end;
  3704. +   unsigned long *file_pointer;
  3705. +   amiga_symbol_type *symbols;
  3706. +   amiga_symbol_type *symbol_tail;
  3707. +   boolean IsLoadFile; /* If true, this is a load file (for output bfd only) */
  3708. +   int maxsymbols;     /* Used by final_link routine to add symbols to output bfd.
  3709. +                          This is the # of entries, allocated in abdfd->osymbols */
  3710. + } amiga_data_type;
  3711. + #define    adata(bfd)        ((bfd)->tdata.amiga_data->a)
  3712. + /* We take the address of the first element of an asymbol to ensure that the
  3713. +    macro is only ever applied to an asymbol */
  3714. + #define amiga_symbol(asymbol) ((amiga_symbol_type *)(&(asymbol)->the_bfd))
  3715. + #define AMIGA_DATA(abfd) ((abfd)->tdata.amiga_data)
  3716. diff -rc --new-file binutils-2.5.2-base/bfd/linker.c binutils-2.5.2/bfd/linker.c
  3717. *** binutils-2.5.2-base/bfd/linker.c    Mon Oct 31 07:00:39 1994
  3718. --- binutils-2.5.2/bfd/linker.c    Tue Feb 14 20:12:52 1995
  3719. ***************
  3720. *** 434,440 ****
  3721.   static boolean default_fill_link_order
  3722.     PARAMS ((bfd *, struct bfd_link_info *, asection *,
  3723.          struct bfd_link_order *));
  3724. ! static boolean default_indirect_link_order
  3725.     PARAMS ((bfd *, struct bfd_link_info *, asection *,
  3726.          struct bfd_link_order *, boolean));
  3727.   
  3728. --- 434,441 ----
  3729.   static boolean default_fill_link_order
  3730.     PARAMS ((bfd *, struct bfd_link_info *, asection *,
  3731.          struct bfd_link_order *));
  3732. ! /*Amiga hack - used in amigadoslink.c so must be global */
  3733. ! /*static*/ boolean default_indirect_link_order
  3734.     PARAMS ((bfd *, struct bfd_link_info *, asection *,
  3735.          struct bfd_link_order *, boolean));
  3736.   
  3737. ***************
  3738. *** 2442,2448 ****
  3739.   
  3740.   /* Default routine to handle a bfd_indirect_link_order.  */
  3741.   
  3742. ! static boolean
  3743.   default_indirect_link_order (output_bfd, info, output_section, link_order,
  3744.                    generic_linker)
  3745.        bfd *output_bfd;
  3746. --- 2443,2449 ----
  3747.   
  3748.   /* Default routine to handle a bfd_indirect_link_order.  */
  3749.   
  3750. ! /*static*/ boolean
  3751.   default_indirect_link_order (output_bfd, info, output_section, link_order,
  3752.                    generic_linker)
  3753.        bfd *output_bfd;
  3754. diff -rc --new-file binutils-2.5.2-base/bfd/targets.c binutils-2.5.2/bfd/targets.c
  3755. *** binutils-2.5.2-base/bfd/targets.c    Sat Oct 22 01:28:21 1994
  3756. --- binutils-2.5.2/bfd/targets.c    Tue Feb 14 19:08:58 1995
  3757. ***************
  3758. *** 146,152 ****
  3759.   .  bfd_target_tekhex_flavour,
  3760.   .  bfd_target_srec_flavour,
  3761.   .  bfd_target_som_flavour,
  3762. ! .  bfd_target_os9k_flavour};
  3763.   .
  3764.   .{* Forward declaration.  *}
  3765.   .typedef struct bfd_link_info _bfd_link_info;
  3766. --- 146,153 ----
  3767.   .  bfd_target_tekhex_flavour,
  3768.   .  bfd_target_srec_flavour,
  3769.   .  bfd_target_som_flavour,
  3770. ! .  bfd_target_os9k_flavour,
  3771. ! .  bfd_target_amiga_flavour};
  3772.   .
  3773.   .{* Forward declaration.  *}
  3774.   .typedef struct bfd_link_info _bfd_link_info;
  3775. ***************
  3776. *** 424,429 ****
  3777. --- 425,432 ----
  3778.      we can't intermix extern's and initializers.  */
  3779.   extern const bfd_target a29kcoff_big_vec;
  3780.   extern const bfd_target a_out_adobe_vec;
  3781. + extern const bfd_target amiga_vec;
  3782. + extern const bfd_target aout_amiga_vec;
  3783.   extern const bfd_target aout_mips_big_vec;
  3784.   extern const bfd_target aout_mips_little_vec;
  3785.   extern const bfd_target aout0_big_vec;
  3786. ***************
  3787. *** 528,533 ****
  3788. --- 531,538 ----
  3789.          it wasn't omitted by mistake.  */
  3790.       &a29kcoff_big_vec,
  3791.       &a_out_adobe_vec,
  3792. +     &amiga_vec,
  3793. +     &aout_amiga_vec,
  3794.   #if 0                /* No one seems to use this.  */
  3795.       &aout_mips_big_vec,
  3796.   #endif
  3797. diff -rc --new-file binutils-2.5.2-base/binutils/Makefile.in binutils-2.5.2/binutils/Makefile.in
  3798. *** binutils-2.5.2-base/binutils/Makefile.in    Wed Nov  2 20:17:06 1994
  3799. --- binutils-2.5.2/binutils/Makefile.in    Mon Mar 27 12:35:22 1995
  3800. ***************
  3801. *** 62,68 ****
  3802.   CC_FOR_BUILD = $(CC)
  3803.   NM_FOR_TARGET = nm
  3804.   NM = $(NM_FOR_TARGET)
  3805. ! SYMLINK = ln -s
  3806.   
  3807.   BISON = bison -y
  3808.   # Comment these out if using lex.
  3809. --- 62,71 ----
  3810.   CC_FOR_BUILD = $(CC)
  3811.   NM_FOR_TARGET = nm
  3812.   NM = $(NM_FOR_TARGET)
  3813. ! #SYMLINK = ln -s
  3814. ! SYMLINK = cp
  3815. ! #HARDLINK = ln
  3816. ! HARDLINK = cp
  3817.   
  3818.   BISON = bison -y
  3819.   # Comment these out if using lex.
  3820. ***************
  3821. *** 106,111 ****
  3822. --- 109,120 ----
  3823.   
  3824.   MANPAGES= ar nm objdump ranlib size strings strip objcopy nlmconv
  3825.   
  3826. + # For now, install only a subset of the new binutils since we still use
  3827. + # some of the old 1.8.x utils
  3828. + INSTALL_PROGS = $(OBJDUMP_PROG) $(STRINGS_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) $(BUILD_NLMCONV) $(BUILD_SRCONV) $(SYSINFO_PROG)
  3829. + INSTALL_TOOL_PROGS =
  3830. + INSTALL_MANPAGES= objdump strings objcopy nlmconv
  3831.   PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) $(BUILD_NLMCONV) $(BUILD_SRCONV) $(SYSINFO_PROG) 
  3832.   STAGESTUFF = $(PROGS) *.o
  3833.   # Files that can be generated, but should be in the distribution.
  3834. ***************
  3835. *** 248,261 ****
  3836.   ar_with_ranlib: $(ADDL_LIBS) ar.o maybe-ranlib.o $(BFD)
  3837.       $(CC) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS)
  3838.       -rm -f $(RANLIB_PROG)
  3839. !     -ln $(AR_PROG) $(RANLIB_PROG)
  3840.   
  3841.   # objcopy and strip in one binary that uses argv[0] to decide its action.
  3842.   
  3843.   objcopy_with_strip: $(ADDL_LIBS) objcopy.o maybe-strip.o $(BFD)
  3844.       $(CC) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS)
  3845.       -rm -f $(STRIP_PROG)
  3846. !     -ln $(OBJCOPY_PROG) $(STRIP_PROG)
  3847.   
  3848.   sysroff.c: sysinfo sysroff.info 
  3849.       ./sysinfo -c <$(srcdir)/sysroff.info >sysroff.c
  3850. --- 257,270 ----
  3851.   ar_with_ranlib: $(ADDL_LIBS) ar.o maybe-ranlib.o $(BFD)
  3852.       $(CC) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS)
  3853.       -rm -f $(RANLIB_PROG)
  3854. !     -$(HARDLINK) $(AR_PROG) $(RANLIB_PROG)
  3855.   
  3856.   # objcopy and strip in one binary that uses argv[0] to decide its action.
  3857.   
  3858.   objcopy_with_strip: $(ADDL_LIBS) objcopy.o maybe-strip.o $(BFD)
  3859.       $(CC) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS)
  3860.       -rm -f $(STRIP_PROG)
  3861. !     -$(HARDLINK) $(OBJCOPY_PROG) $(STRIP_PROG)
  3862.   
  3863.   sysroff.c: sysinfo sysroff.info 
  3864.       ./sysinfo -c <$(srcdir)/sysroff.info >sysroff.c
  3865. ***************
  3866. *** 506,525 ****
  3867.       etags $(INCDIR)/*.h $(srcdir)/*.[hc] 
  3868.   
  3869.   install: all $(DEMANGLER_PROG).1
  3870. !     for i in $(PROGS) ; do \
  3871.         $(INSTALL_XFORM) $$i $(bindir)/`echo $$i | sed -e 's/.new//'` ; \
  3872.       done
  3873. !     for i in $(MANPAGES) ; do \
  3874.         $(INSTALL_XFORM1) $(srcdir)/$$i.1 $(man1dir)/$$i.1 ; \
  3875.       done
  3876.       $(INSTALL_XFORM1) $(DEMANGLER_PROG).1 $(man1dir)/$(DEMANGLER_PROG).1
  3877.       -if [ -d $(tooldir) ]; then \
  3878.         if [ -d $(tooldir)/bin ]; then true; else mkdir $(tooldir)/bin; fi; \
  3879. !       for i in $(TOOL_PROGS) ; do \
  3880.           j=`echo $$i | sed -e 's/.new//'`; \
  3881.           rm -f $(tooldir)/bin/$$j; \
  3882.           k=`t='$(program_transform_name)'; echo $$j | sed -e s/x/x/ $$t`; \
  3883. !         ln $(bindir)/$$k $(tooldir)/bin/$$j >/dev/null 2>/dev/null \
  3884.            || $(INSTALL_PROGRAM) $$i $(tooldir)/bin/$$j; \
  3885.         done; \
  3886.        else true; fi
  3887. --- 515,534 ----
  3888.       etags $(INCDIR)/*.h $(srcdir)/*.[hc] 
  3889.   
  3890.   install: all $(DEMANGLER_PROG).1
  3891. !     for i in $(INSTALL_PROGS) ; do \
  3892.         $(INSTALL_XFORM) $$i $(bindir)/`echo $$i | sed -e 's/.new//'` ; \
  3893.       done
  3894. !     for i in $(INSTALL_MANPAGES) ; do \
  3895.         $(INSTALL_XFORM1) $(srcdir)/$$i.1 $(man1dir)/$$i.1 ; \
  3896.       done
  3897.       $(INSTALL_XFORM1) $(DEMANGLER_PROG).1 $(man1dir)/$(DEMANGLER_PROG).1
  3898.       -if [ -d $(tooldir) ]; then \
  3899.         if [ -d $(tooldir)/bin ]; then true; else mkdir $(tooldir)/bin; fi; \
  3900. !       for i in $(INSTALL_TOOL_PROGS) ; do \
  3901.           j=`echo $$i | sed -e 's/.new//'`; \
  3902.           rm -f $(tooldir)/bin/$$j; \
  3903.           k=`t='$(program_transform_name)'; echo $$j | sed -e s/x/x/ $$t`; \
  3904. !         $(HARDLINK) $(bindir)/$$k $(tooldir)/bin/$$j >/dev/null 2>/dev/null \
  3905.            || $(INSTALL_PROGRAM) $$i $(tooldir)/bin/$$j; \
  3906.         done; \
  3907.        else true; fi
  3908. ***************
  3909. *** 551,557 ****
  3910.   diststuff: $(DISTSTUFF)
  3911.   
  3912.   $(DIST_NAME).tar.z:
  3913. !     cd ../..; rm -f $(DIST_NAME); ln -s devo $(DIST_NAME)
  3914.       make diststuff -f Makefile.in
  3915.       cd ../ld; make diststuff -f Makefile.in
  3916.       cd ../gprof; make diststuff -f Makefile.in
  3917. --- 560,566 ----
  3918.   diststuff: $(DISTSTUFF)
  3919.   
  3920.   $(DIST_NAME).tar.z:
  3921. !     cd ../..; rm -f $(DIST_NAME); $(SYMLINK) devo $(DIST_NAME)
  3922.       make diststuff -f Makefile.in
  3923.       cd ../ld; make diststuff -f Makefile.in
  3924.       cd ../gprof; make diststuff -f Makefile.in
  3925. diff -rc --new-file binutils-2.5.2-base/config/mh-amigados binutils-2.5.2/config/mh-amigados
  3926. *** binutils-2.5.2-base/config/mh-amigados    Thu Jan  1 00:00:00 1970
  3927. --- binutils-2.5.2/config/mh-amigados    Mon Mar 27 11:19:12 1995
  3928. ***************
  3929. *** 0 ****
  3930. --- 1,13 ----
  3931. + # Host makefile fragment for Commodore Amiga running AmigaDOS.
  3932. + # There is no standard system compiler.  Assume use GNU C.
  3933. + CC = gcc
  3934. + # There is no support for -g yet.  But use -O instead.
  3935. + CFLAGS = -O
  3936. + # We have both types of links under AmigaDOS with GNU
  3937. + # utils, however the links need to be made in canonical
  3938. + # AmigaDOS format (foo:bar/bell/file) rather than UNIX
  3939. + # format (/foo/bar/bell/file).  When this is fixed, then
  3940. + # these can go away.
  3941. + SYMLINK = cp
  3942. + HARDLINK = cp
  3943. diff -rc --new-file binutils-2.5.2-base/configure binutils-2.5.2/configure
  3944. *** binutils-2.5.2-base/configure    Wed Oct 19 16:05:50 1994
  3945. --- binutils-2.5.2/configure    Fri Feb 10 15:43:04 1995
  3946. ***************
  3947. *** 36,46 ****
  3948.   #       config.status is removed.
  3949.   #
  3950.   
  3951.   export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
  3952.   
  3953.   remove=rm
  3954. ! hard_link=ln
  3955. ! symbolic_link='ln -s'
  3956.   
  3957.   #for Test
  3958.   #remove="echo rm"
  3959. --- 36,49 ----
  3960.   #       config.status is removed.
  3961.   #
  3962.   
  3963. + # In places where the argument to echo may start with a '-', use /bin/echo
  3964. + # since the AmigaDOS pdksh builtin echo botches this case.
  3965.   export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
  3966.   
  3967.   remove=rm
  3968. ! hard_link=cp
  3969. ! symbolic_link=cp
  3970.   
  3971.   #for Test
  3972.   #remove="echo rm"
  3973. ***************
  3974. *** 65,71 ****
  3975.   norecursion=
  3976.   other_options=
  3977.   package_makefile_frag=
  3978. ! prefix=/usr/local
  3979.   progname=
  3980.   program_prefix=
  3981.   program_prefixoption=
  3982. --- 68,77 ----
  3983.   norecursion=
  3984.   other_options=
  3985.   package_makefile_frag=
  3986. ! # This is a hack so we don't have to remember to always configure using
  3987. ! # the "--prefix=/gnu" option.  Personally I feel this should be settable
  3988. ! # in a config file.  -fnf
  3989. ! prefix=/gnu
  3990.   progname=
  3991.   program_prefix=
  3992.   program_prefixoption=
  3993. ***************
  3994. *** 102,110 ****
  3995.   ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
  3996.   ##
  3997.   
  3998. ! progname=$0
  3999.   # if PWD already has a value, it is probably wrong.
  4000. ! if [ -n "$PWD" ]; then PWD=`pwd`; fi
  4001.   
  4002.   case "${progname}" in
  4003.   /*) ;;
  4004. --- 108,119 ----
  4005.   ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
  4006.   ##
  4007.   
  4008. ! # For some reason, the value of $0 in AmigaDOS pdksh ends up with a
  4009. ! # trailing '/' that needs to be stripped.
  4010. ! progname=`/bin/echo $0 | sed 's:/$::'`
  4011.   # if PWD already has a value, it is probably wrong.
  4012. ! # The AmigaDOS pksh can't change the value of PWD, it's readonly.
  4013. ! #if [ -n "$PWD" ]; then PWD=`pwd`; fi
  4014.   
  4015.   case "${progname}" in
  4016.   /*) ;;
  4017. ***************
  4018. *** 140,146 ****
  4019.   # Split out the argument for options that take them
  4020.       case $option in
  4021.       --*=*)
  4022. !         optarg=`echo $option | sed -e 's/^[^=]*=//'`
  4023.           ;;
  4024.   # These options have mandatory values.  Since we didn't find an = sign,
  4025.   # the value must be in the next argument
  4026. --- 149,155 ----
  4027.   # Split out the argument for options that take them
  4028.       case $option in
  4029.       --*=*)
  4030. !         optarg=`/bin/echo $option | sed -e 's/^[^=]*=//'`
  4031.           ;;
  4032.   # These options have mandatory values.  Since we didn't find an = sign,
  4033.   # the value must be in the next argument
  4034. ***************
  4035. *** 165,171 ****
  4036.       --cache*)
  4037.           ;;
  4038.       --disable-*)
  4039. !         enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
  4040.           eval $enableopt=no
  4041.           disableoptions="$disableoptions $option"
  4042.           ;;
  4043. --- 174,180 ----
  4044.       --cache*)
  4045.           ;;
  4046.       --disable-*)
  4047. !         enableopt=`/bin/echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
  4048.           eval $enableopt=no
  4049.           disableoptions="$disableoptions $option"
  4050.           ;;
  4051. ***************
  4052. *** 175,181 ****
  4053.           *)    optarg=yes ;;
  4054.           esac
  4055.   
  4056. !         enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  4057.           eval $enableopt="$optarg"
  4058.           enableoptions="$enableoptions $option"
  4059.           ;;
  4060. --- 184,190 ----
  4061.           *)    optarg=yes ;;
  4062.           esac
  4063.   
  4064. !         enableopt=`/bin/echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  4065.           eval $enableopt="$optarg"
  4066.           enableoptions="$enableoptions $option"
  4067.           ;;
  4068. ***************
  4069. *** 217,223 ****
  4070.           ;;
  4071.       --program-transform-name* | --program-t*)
  4072.           # Double any backslashes or dollar signs in the argument
  4073. !         program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  4074.           program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
  4075.           ;;
  4076.       --rm)
  4077. --- 226,232 ----
  4078.           ;;
  4079.       --program-transform-name* | --program-t*)
  4080.           # Double any backslashes or dollar signs in the argument
  4081. !         program_transform_name="${program_transform_name} -e `/bin/echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  4082.           program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
  4083.           ;;
  4084.       --rm)
  4085. ***************
  4086. *** 236,242 ****
  4087.                   # bolted into an object file as debug info, it has two slashes
  4088.                   # in it.  Ordinarily this is ok, but emacs takes double slash
  4089.                   # to mean "forget the first part".
  4090. !         srcdir=`echo $optarg | sed -e 's:/$::'`
  4091.           ;;
  4092.       --srcdir* | --sr*)
  4093.           srcdir=$optarg
  4094. --- 245,251 ----
  4095.                   # bolted into an object file as debug info, it has two slashes
  4096.                   # in it.  Ordinarily this is ok, but emacs takes double slash
  4097.                   # to mean "forget the first part".
  4098. !         srcdir=`/bin/echo $optarg | sed -e 's:/$::'`
  4099.           ;;
  4100.       --srcdir* | --sr*)
  4101.           srcdir=$optarg
  4102. ***************
  4103. *** 258,264 ****
  4104.           verbose=--verbose
  4105.           ;;
  4106.       --version | --V | --vers*)
  4107. !         echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
  4108.           exit 0
  4109.           ;;
  4110.       --with-*)
  4111. --- 267,273 ----
  4112.           verbose=--verbose
  4113.           ;;
  4114.       --version | --V | --vers*)
  4115. !         echo "This is Cygnus Configure version" `/bin/echo ${version} | sed 's/[ $:]//g'`
  4116.           exit 0
  4117.           ;;
  4118.       --with-*)
  4119. ***************
  4120. *** 267,278 ****
  4121.           *)    optarg=yes ;;
  4122.           esac
  4123.   
  4124. !         withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  4125.           eval $withopt="$optarg"
  4126.           withoptions="$withoptions $option"
  4127.           ;;
  4128.       --without-*)
  4129. !         withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
  4130.           eval $withopt=no
  4131.           withoutoptions="$withoutoptions $option"
  4132.           ;;
  4133. --- 276,287 ----
  4134.           *)    optarg=yes ;;
  4135.           esac
  4136.   
  4137. !         withopt=`/bin/echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  4138.           eval $withopt="$optarg"
  4139.           withoptions="$withoptions $option"
  4140.           ;;
  4141.       --without-*)
  4142. !         withopt=`/bin/echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
  4143.           eval $withopt=no
  4144.           withoutoptions="$withoutoptions $option"
  4145.           ;;
  4146. ***************
  4147. *** 331,337 ****
  4148.           NOUNDEFS)
  4149.               # Neither --host option nor undefs were present.
  4150.               # Call config.guess.
  4151. !             guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
  4152.               if host_alias=`${guesssys}`
  4153.               then
  4154.                   # If the string we are going to use for
  4155. --- 340,346 ----
  4156.           NOUNDEFS)
  4157.               # Neither --host option nor undefs were present.
  4158.               # Call config.guess.
  4159. !             guesssys=`/bin/echo ${progname} | sed 's/configure$/config.guess/'`
  4160.               if host_alias=`${guesssys}`
  4161.               then
  4162.                   # If the string we are going to use for
  4163. ***************
  4164. *** 411,418 ****
  4165.       exit 1
  4166.   fi
  4167.   
  4168. ! configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  4169. ! moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
  4170.   
  4171.   # this is a hack.  sun4 must always be a valid host alias or this will fail.
  4172.   if ${configsub} sun4 >/dev/null 2>&1 ; then
  4173. --- 420,427 ----
  4174.       exit 1
  4175.   fi
  4176.   
  4177. ! configsub=`/bin/echo ${progname} | sed 's/configure$/config.sub/'`
  4178. ! moveifchange=`/bin/echo ${progname} | sed 's/configure$/move-if-change/'`
  4179.   
  4180.   # this is a hack.  sun4 must always be a valid host alias or this will fail.
  4181.   if ${configsub} sun4 >/dev/null 2>&1 ; then
  4182. ***************
  4183. *** 437,443 ****
  4184.                   srcdir=.
  4185.           else
  4186.                   if [ -r ${progname}.in ] ; then
  4187. !                         srcdir=`echo ${progname} | sed 's:/configure$::'`
  4188.                   else
  4189.                           echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
  4190.                           exit 1
  4191. --- 446,452 ----
  4192.                   srcdir=.
  4193.           else
  4194.                   if [ -r ${progname}.in ] ; then
  4195. !                         srcdir=`/bin/echo ${progname} | sed 's:/configure$::'`
  4196.                   else
  4197.                           echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
  4198.                           exit 1
  4199. ***************
  4200. *** 523,531 ****
  4201.   *)
  4202.       if result=`${config_shell} ${configsub} ${build_alias}` ; then
  4203.           buildopt="--build=${build_alias}"
  4204. !         build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4205. !         build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  4206. !         build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  4207.           build=${build_cpu}-${build_vendor}-${build_os}
  4208.       else
  4209.           echo "Unrecognized build system name ${build_alias}." 1>&2
  4210. --- 532,540 ----
  4211.   *)
  4212.       if result=`${config_shell} ${configsub} ${build_alias}` ; then
  4213.           buildopt="--build=${build_alias}"
  4214. !         build_cpu=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4215. !         build_vendor=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  4216. !         build_os=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  4217.           build=${build_cpu}-${build_vendor}-${build_os}
  4218.       else
  4219.           echo "Unrecognized build system name ${build_alias}." 1>&2
  4220. ***************
  4221. *** 540,548 ****
  4222.       echo "Unrecognized host system name ${host_alias}." 1>&2
  4223.       exit 1
  4224.   fi
  4225. ! host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4226. ! host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  4227. ! host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  4228.   host=${host_cpu}-${host_vendor}-${host_os}
  4229.   
  4230.   . ${tmpfile}.hst
  4231. --- 549,557 ----
  4232.       echo "Unrecognized host system name ${host_alias}." 1>&2
  4233.       exit 1
  4234.   fi
  4235. ! host_cpu=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4236. ! host_vendor=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  4237. ! host_os=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  4238.   host=${host_cpu}-${host_vendor}-${host_os}
  4239.   
  4240.   . ${tmpfile}.hst
  4241. ***************
  4242. *** 553,561 ****
  4243.       echo "Unrecognized target system name ${target_alias}." 1>&2
  4244.       exit 1
  4245.   fi
  4246. ! target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4247. ! target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  4248. ! target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  4249.   target=${target_cpu}-${target_vendor}-${target_os}
  4250.   
  4251.   . ${tmpfile}.tgt
  4252. --- 562,570 ----
  4253.       echo "Unrecognized target system name ${target_alias}." 1>&2
  4254.       exit 1
  4255.   fi
  4256. ! target_cpu=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4257. ! target_vendor=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  4258. ! target_os=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  4259.   target=${target_cpu}-${target_vendor}-${target_os}
  4260.   
  4261.   . ${tmpfile}.tgt
  4262. ***************
  4263. *** 611,624 ****
  4264.       # ${subdir} is relative path from . to the directory we're currently
  4265.       # configuring.
  4266.       # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
  4267. !     invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
  4268.   
  4269.       ### figure out what to do with srcdir
  4270.       case "${srcdir}" in
  4271.           ".")  # no -srcdir option.  We're building in place.
  4272.                   makesrcdir=. ;;
  4273.           /*) # absolute path
  4274. !                 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
  4275.                   ;;
  4276.           *) # otherwise relative
  4277.                   case "${subdir}" in
  4278. --- 620,633 ----
  4279.       # ${subdir} is relative path from . to the directory we're currently
  4280.       # configuring.
  4281.       # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
  4282. !     invsubdir=`/bin/echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
  4283.   
  4284.       ### figure out what to do with srcdir
  4285.       case "${srcdir}" in
  4286.           ".")  # no -srcdir option.  We're building in place.
  4287.                   makesrcdir=. ;;
  4288.           /*) # absolute path
  4289. !                 makesrcdir=`/bin/echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
  4290.                   ;;
  4291.           *) # otherwise relative
  4292.                   case "${subdir}" in
  4293. ***************
  4294. *** 846,852 ****
  4295.           # make sure that some sort of reasonable default exists for these 
  4296.           # two variables
  4297.           CXX=${CXX-"g++ -O"}
  4298. !         CC=${CC-cc}
  4299.   
  4300.               # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
  4301.               # remove any form feeds.
  4302. --- 855,861 ----
  4303.           # make sure that some sort of reasonable default exists for these 
  4304.           # two variables
  4305.           CXX=${CXX-"g++ -O"}
  4306. !         CC=${CC-gcc}
  4307.   
  4308.               # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
  4309.               # remove any form feeds.
  4310. ***************
  4311. *** 891,897 ****
  4312.           *) using="${using} and \"${site_makefile_frag}\"" ;;
  4313.           esac
  4314.   
  4315. !         newusing=`echo "${using}" | sed 's/and/using/'`
  4316.           using=${newusing}
  4317.           echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
  4318.   
  4319. --- 900,906 ----
  4320.           *) using="${using} and \"${site_makefile_frag}\"" ;;
  4321.           esac
  4322.   
  4323. !         newusing=`/bin/echo "${using}" | sed 's/and/using/'`
  4324.           using=${newusing}
  4325.           echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
  4326.   
  4327. ***************
  4328. *** 983,989 ****
  4329.   
  4330.   ### The recursion line is here.
  4331.               if [ ! -z "${recprog}" ] ; then
  4332. !                             if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
  4333.                                       ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  4334.                                       ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then
  4335.                                       true
  4336. --- 992,1000 ----
  4337.   
  4338.   ### The recursion line is here.
  4339.               if [ ! -z "${recprog}" ] ; then
  4340. !                                 echo ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} ${prefixoption} ${tmpdiroption} ${exec_prefixoption} ${srcdiroption} ${program_prefixoption} ${program_suffixoption} \
  4341. !                     ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect}
  4342. !                     if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
  4343.                                       ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  4344.                                       ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then
  4345.                                       true
  4346. diff -rc --new-file binutils-2.5.2-base/configure.in binutils-2.5.2/configure.in
  4347. *** binutils-2.5.2-base/configure.in    Wed Nov  2 20:20:43 1994
  4348. --- binutils-2.5.2/configure.in    Fri Feb 10 15:43:04 1995
  4349. ***************
  4350. *** 123,128 ****
  4351. --- 123,129 ----
  4352.     *-*-lynxos*)            host_makefile_frag=config/mh-lynxos ;;
  4353.     *-*-sysv4*)             host_makefile_frag=config/mh-sysv4 ;;
  4354.     *-*-sysv*)              host_makefile_frag=config/mh-sysv ;;
  4355. +   *-*-amigados*)      host_makefile_frag=config/mh-amigados ;;
  4356.   esac
  4357.   fi
  4358.   
  4359. diff -rc --new-file binutils-2.5.2-base/gas/Makefile.in binutils-2.5.2/gas/Makefile.in
  4360. *** binutils-2.5.2-base/gas/Makefile.in    Wed Nov  2 20:17:06 1994
  4361. --- binutils-2.5.2/gas/Makefile.in    Mon Mar 27 12:21:04 1995
  4362. ***************
  4363. *** 72,78 ****
  4364.   TEXI2DVI = texi2dvi
  4365.   RANLIB = ranlib
  4366.   CC = @CC@
  4367. ! CFLAGS = -g
  4368.   
  4369.   MAKEOVERRIDES=
  4370.   
  4371. --- 72,82 ----
  4372.   TEXI2DVI = texi2dvi
  4373.   RANLIB = ranlib
  4374.   CC = @CC@
  4375. ! CFLAGS = -O2
  4376. ! #SYMLINK = ln -s
  4377. ! SYMLINK = cp
  4378. ! #HARDLINK = ln
  4379. ! HARDLINK = cp
  4380.   
  4381.   MAKEOVERRIDES=
  4382.   
  4383. ***************
  4384. *** 372,378 ****
  4385.      targ-env.h obj-format.h targ-cpu.h \
  4386.      struc-symbol.h write.h flonum.h bignum.h expr.h \
  4387.     frags.h hash.h read.h symbols.h tc.h obj.h input-file.h 
  4388. ! input-scrub.o : input-scrub.c /usr/include/errno.h /usr/include/sys/errno.h \
  4389.     as.h targ-env.h obj-format.h \
  4390.     targ-cpu.h  struc-symbol.h \
  4391.     write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  4392. --- 376,385 ----
  4393.      targ-env.h obj-format.h targ-cpu.h \
  4394.      struc-symbol.h write.h flonum.h bignum.h expr.h \
  4395.     frags.h hash.h read.h symbols.h tc.h obj.h input-file.h 
  4396. ! # Removed hardwired dependency of input-scrub.o on files in /usr/include
  4397. ! # This is a botch for code that may be compiled with (or as) part of
  4398. ! # a cross compilation system.
  4399. ! input-scrub.o : input-scrub.c \
  4400.     as.h targ-env.h obj-format.h \
  4401.     targ-cpu.h  struc-symbol.h \
  4402.     write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  4403. ***************
  4404. *** 465,476 ****
  4405.   install:
  4406.       srcroot=`cd $(srcroot); pwd`; export srcroot; \
  4407.       $(INSTALL_XFORM) as.new $(bindir)/as; \
  4408.       $(INSTALL_XFORM1) $(srcdir)/doc/as.1 $(man1dir)/as.1; \
  4409.       n=`echo as | sed '$(program_transform_name)'`; \
  4410.       if [ -d $(tooldir) ]; then \
  4411.         if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
  4412.         rm -f $(tooldir)/bin/as; \
  4413. !       ln $(bindir)/$$n $(tooldir)/bin/as >/dev/null 2>/dev/null \
  4414.          || $(INSTALL_PROGRAM) as.new $(tooldir)/bin/as; \
  4415.       else true; fi
  4416.       srcroot=`cd $(srcroot); pwd`; export srcroot; \
  4417. --- 472,484 ----
  4418.   install:
  4419.       srcroot=`cd $(srcroot); pwd`; export srcroot; \
  4420.       $(INSTALL_XFORM) as.new $(bindir)/as; \
  4421. +     $(INSTALL_XFORM) as.new $(bindir)/gas; \
  4422.       $(INSTALL_XFORM1) $(srcdir)/doc/as.1 $(man1dir)/as.1; \
  4423.       n=`echo as | sed '$(program_transform_name)'`; \
  4424.       if [ -d $(tooldir) ]; then \
  4425.         if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
  4426.         rm -f $(tooldir)/bin/as; \
  4427. !       $(HARDLINK) $(bindir)/$$n $(tooldir)/bin/as >/dev/null 2>/dev/null \
  4428.          || $(INSTALL_PROGRAM) as.new $(tooldir)/bin/as; \
  4429.       else true; fi
  4430.       srcroot=`cd $(srcroot); pwd`; export srcroot; \
  4431. ***************
  4432. *** 479,485 ****
  4433.       if [ -d $(tooldir) ]; then \
  4434.         if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
  4435.         rm -f $(tooldir)/bin/gasp; \
  4436. !       ln $(bindir)/$$n $(tooldir)/bin/gasp >/dev/null 2>/dev/null \
  4437.          || $(INSTALL_PROGRAM) gasp.new $(tooldir)/bin/gasp; \
  4438.       else true; fi
  4439.   
  4440. --- 487,493 ----
  4441.       if [ -d $(tooldir) ]; then \
  4442.         if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
  4443.         rm -f $(tooldir)/bin/gasp; \
  4444. !       $(HARDLINK) $(bindir)/$$n $(tooldir)/bin/gasp >/dev/null 2>/dev/null \
  4445.          || $(INSTALL_PROGRAM) gasp.new $(tooldir)/bin/gasp; \
  4446.       else true; fi
  4447.   
  4448. ***************
  4449. *** 498,520 ****
  4450.   
  4451.   bootstrap: as.new force
  4452.       $(MAKE) stage1
  4453. !     rm -f stage && ln -s stage1 stage
  4454.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4455.       $(MAKE) stage2
  4456. !     rm -f stage && ln -s stage2 stage
  4457.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4458.       $(MAKE) comparison against=stage2
  4459.   
  4460.   bootstrap2: force
  4461. !     rm -f stage && ln -s stage1 stage
  4462.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4463.       $(MAKE) stage2
  4464. !     rm -f stage && ln -s stage2 stage
  4465.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4466.       $(MAKE) comparison against=stage2
  4467.   
  4468.   bootstrap3: force
  4469. !     rm -f stage && ln -s stage2 stage
  4470.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4471.       $(MAKE) comparison against=stage2
  4472.   
  4473. --- 506,528 ----
  4474.   
  4475.   bootstrap: as.new force
  4476.       $(MAKE) stage1
  4477. !     rm -f stage && $(SYMLINK) stage1 stage
  4478.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4479.       $(MAKE) stage2
  4480. !     rm -f stage && $(SYMLINK) stage2 stage
  4481.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4482.       $(MAKE) comparison against=stage2
  4483.   
  4484.   bootstrap2: force
  4485. !     rm -f stage && $(SYMLINK) stage1 stage
  4486.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4487.       $(MAKE) stage2
  4488. !     rm -f stage && $(SYMLINK) stage2 stage
  4489.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4490.       $(MAKE) comparison against=stage2
  4491.   
  4492.   bootstrap3: force
  4493. !     rm -f stage && $(SYMLINK) stage2 stage
  4494.       $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
  4495.       $(MAKE) comparison against=stage2
  4496.   
  4497. ***************
  4498. *** 522,538 ****
  4499.   stage1: force
  4500.       -mkdir stage1
  4501.       -mv $(STAGESTUFF) stage1
  4502. !     if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
  4503.   
  4504.   stage2: force
  4505.       -mkdir stage2
  4506.       -mv $(STAGESTUFF) stage2
  4507. !     if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
  4508.   
  4509.   stage3: force
  4510.       -mkdir stage3
  4511.       -mv $(STAGESTUFF) stage3
  4512. !     if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
  4513.   
  4514.   against=stage2
  4515.   
  4516. --- 530,546 ----
  4517.   stage1: force
  4518.       -mkdir stage1
  4519.       -mv $(STAGESTUFF) stage1
  4520. !     if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; $(SYMLINK) as.new as) ; fi
  4521.   
  4522.   stage2: force
  4523.       -mkdir stage2
  4524.       -mv $(STAGESTUFF) stage2
  4525. !     if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; $(SYMLINK) as.new as) ; fi
  4526.   
  4527.   stage3: force
  4528.       -mkdir stage3
  4529.       -mv $(STAGESTUFF) stage3
  4530. !     if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; $(SYMLINK) as.new as) ; fi
  4531.   
  4532.   against=stage2
  4533.   
  4534. diff -rc --new-file binutils-2.5.2-base/gas/as.c binutils-2.5.2/gas/as.c
  4535. *** binutils-2.5.2-base/gas/as.c    Wed Oct 19 22:52:37 1994
  4536. --- binutils-2.5.2/gas/as.c    Tue Feb 14 19:14:26 1995
  4537. ***************
  4538. *** 51,56 ****
  4539. --- 51,60 ----
  4540.   #endif /* __STDC__ */
  4541.   #endif /* SIGTY */
  4542.   
  4543. + #ifndef __amigados__
  4544. + #define HAVE_SBRK
  4545. + #endif
  4546.   #if 0
  4547.   /* Not currently used.  */
  4548.   static SIGTY got_sig PARAMS ((int sig));
  4549. ***************
  4550. *** 447,459 ****
  4551. --- 451,467 ----
  4552.     if (flag_print_statistics)
  4553.       {
  4554.         extern char **environ;
  4555. + #ifdef HAVE_SBRK
  4556.         char *lim = (char *) sbrk (0);
  4557. + #endif
  4558.         long run_time = get_run_time () - start_time;
  4559.   
  4560.         fprintf (stderr, "%s: total time in assembly: %ld.%06ld\n",
  4561.              myname, run_time / 1000000, run_time % 1000000);
  4562. + #ifdef HAVE_SBRK
  4563.         fprintf (stderr, "%s: data size %ld\n",
  4564.              myname, (long) (lim - (char *) &environ));
  4565. + #endif
  4566.       }
  4567.   
  4568.     /* Use exit instead of return, because under VMS environments they
  4569. diff -rc --new-file binutils-2.5.2-base/gas/config/amigados.mh binutils-2.5.2/gas/config/amigados.mh
  4570. *** binutils-2.5.2-base/gas/config/amigados.mh    Thu Jan  1 00:00:00 1970
  4571. --- binutils-2.5.2/gas/config/amigados.mh    Mon Mar 27 11:27:26 1995
  4572. ***************
  4573. *** 0 ****
  4574. --- 1,13 ----
  4575. + # Host makefile fragment for Commodore Amiga running AmigaDOS.
  4576. + # There is no standard system compiler.  Assume use GNU C.
  4577. + CC = gcc
  4578. + # There is no support for -g yet.  But use -O instead.
  4579. + CFLAGS = -O
  4580. + # We have both types of links under AmigaDOS with GNU
  4581. + # utils, however the links need to be made in canonical
  4582. + # AmigaDOS format (foo:bar/bell/file) rather than UNIX
  4583. + # format (/foo/bar/bell/file).  When this is fixed, then
  4584. + # these can go away.
  4585. + SYMLINK = cp
  4586. + HARDLINK = cp
  4587. diff -rc --new-file binutils-2.5.2-base/gas/config/tc-m68k.c binutils-2.5.2/gas/config/tc-m68k.c
  4588. *** binutils-2.5.2-base/gas/config/tc-m68k.c    Thu Oct 27 23:11:43 1994
  4589. --- binutils-2.5.2/gas/config/tc-m68k.c    Fri Feb 10 15:43:30 1995
  4590. ***************
  4591. *** 554,561 ****
  4592. --- 554,563 ----
  4593.     {"even", s_even, 0},
  4594.     {"skip", s_space, 0},
  4595.     {"proc", s_proc, 0},
  4596. + #ifndef amigados
  4597.   #ifdef TE_SUN3
  4598.     {"align", s_align_bytes, 0},
  4599. + #endif
  4600.   #endif
  4601.     {0, 0, 0}
  4602.   };
  4603. diff -rc --new-file binutils-2.5.2-base/gas/configure binutils-2.5.2/gas/configure
  4604. *** binutils-2.5.2-base/gas/configure    Tue Nov  1 23:17:52 1994
  4605. --- binutils-2.5.2/gas/configure    Fri Feb 10 15:43:32 1995
  4606. ***************
  4607. *** 1,7 ****
  4608.   #!/bin/sh
  4609.   
  4610.   # Guess values for system-dependent variables and create Makefiles.
  4611. ! # Generated automatically using autoconf version 2.0 
  4612.   # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  4613.   #
  4614.   # This configure script is free software; the Free Software Foundation
  4615. --- 1,7 ----
  4616.   #!/bin/sh
  4617.   
  4618.   # Guess values for system-dependent variables and create Makefiles.
  4619. ! # Generated automatically using autoconf version 2.1 
  4620.   # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  4621.   #
  4622.   # This configure script is free software; the Free Software Foundation
  4623. ***************
  4624. *** 9,50 ****
  4625.   
  4626.   # Defaults:
  4627.   ac_help=
  4628. ! ac_default_prefix=/usr/local
  4629.   # Any additions from configure.in:
  4630.   ac_help="$ac_help
  4631.       bfd-assembler    use BFD back end for writing object files"
  4632.   
  4633. - # Omit some internal or obsolete options to make the list less imposing.
  4634. - ac_usage="Usage: configure [options] [host]
  4635. - Options: [defaults in brackets after descriptions]
  4636. - Configuration:
  4637. -   --cache-file=FILE       cache test results in FILE
  4638. -   --help                  print this message
  4639. -   --no-create             do not create output files
  4640. -   --quiet, --silent       do not print \`checking...' messages
  4641. -   --version               print the version of autoconf that created configure
  4642. - Directory and file names:
  4643. -   --prefix=PREFIX         install architecture-independent files in PREFIX
  4644. -                           [$ac_default_prefix]
  4645. -   --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
  4646. -                           [same as prefix]
  4647. -   --srcdir=DIR            find the sources in DIR [configure dir or ..]
  4648. -   --program-prefix=PREFIX prepend PREFIX to installed program names
  4649. -   --program-suffix=SUFFIX append SUFFIX to installed program names
  4650. -   --program-transform-name=PROGRAM run sed PROGRAM on installed program names
  4651. - Host type:
  4652. -   --build=BUILD           configure for building on BUILD [BUILD=HOST]
  4653. -   --host=HOST             configure for HOST [guessed]
  4654. -   --target=TARGET         configure for TARGET [TARGET=HOST]
  4655. - Features and packages:
  4656. -   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  4657. -   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  4658. -   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  4659. -   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  4660. -   --x-includes=DIR        X include files are in DIR
  4661. -   --x-libraries=DIR       X library files are in DIR
  4662. - --enable and --with options recognized:$ac_help"
  4663.   # Initialize some variables set by options.
  4664.   # The variables have the same names as the options, with
  4665.   # dashes changed to underlines.
  4666. --- 9,19 ----
  4667.   
  4668.   # Defaults:
  4669.   ac_help=
  4670. ! ac_default_prefix=/gnu
  4671.   # Any additions from configure.in:
  4672.   ac_help="$ac_help
  4673.       bfd-assembler    use BFD back end for writing object files"
  4674.   
  4675.   # Initialize some variables set by options.
  4676.   # The variables have the same names as the options, with
  4677.   # dashes changed to underlines.
  4678. ***************
  4679. *** 82,88 ****
  4680.     fi
  4681.   
  4682.     case "$ac_option" in
  4683. !   -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  4684.     *) ac_optarg= ;;
  4685.     esac
  4686.   
  4687. --- 51,57 ----
  4688.     fi
  4689.   
  4690.     case "$ac_option" in
  4691. !   -*=*) ac_optarg=`/bin/echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  4692.     *) ac_optarg= ;;
  4693.     esac
  4694.   
  4695. ***************
  4696. *** 103,123 ****
  4697.       cache_file="$ac_optarg" ;;
  4698.   
  4699.     -disable-* | --disable-*)
  4700. !     ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
  4701.       # Reject names that are not valid shell variable names.
  4702. !     if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
  4703.         { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
  4704.       fi
  4705. !     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
  4706.       eval "enable_${ac_feature}=no" ;;
  4707.   
  4708.     -enable-* | --enable-*)
  4709. !     ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
  4710.       # Reject names that are not valid shell variable names.
  4711. !     if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
  4712.         { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
  4713.       fi
  4714. !     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
  4715.       case "$ac_option" in
  4716.         *=*) ;;
  4717.         *) ac_optarg=yes ;;
  4718. --- 72,92 ----
  4719.       cache_file="$ac_optarg" ;;
  4720.   
  4721.     -disable-* | --disable-*)
  4722. !     ac_feature=`/bin/echo $ac_option|sed -e 's/-*disable-//'`
  4723.       # Reject names that are not valid shell variable names.
  4724. !     if test -n "`/bin/echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
  4725.         { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
  4726.       fi
  4727. !     ac_feature=`/bin/echo $ac_feature| sed 's/-/_/g'`
  4728.       eval "enable_${ac_feature}=no" ;;
  4729.   
  4730.     -enable-* | --enable-*)
  4731. !     ac_feature=`/bin/echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
  4732.       # Reject names that are not valid shell variable names.
  4733. !     if test -n "`/bin/echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
  4734.         { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
  4735.       fi
  4736. !     ac_feature=`/bin/echo $ac_feature| sed 's/-/_/g'`
  4737.       case "$ac_option" in
  4738.         *=*) ;;
  4739.         *) ac_optarg=yes ;;
  4740. ***************
  4741. *** 138,145 ****
  4742.       with_gas=yes ;;
  4743.   
  4744.     -help | --help | --hel | --he)
  4745.       cat << EOF
  4746. ! $ac_usage
  4747.   EOF
  4748.       exit 0 ;;
  4749.   
  4750. --- 107,144 ----
  4751.       with_gas=yes ;;
  4752.   
  4753.     -help | --help | --hel | --he)
  4754. +     # Omit some internal or obsolete options to make the list less imposing.
  4755. +     # This message is too long to be a string in the A/UX 3.1 sh.
  4756.       cat << EOF
  4757. ! Usage: configure [options] [host]
  4758. ! Options: [defaults in brackets after descriptions]
  4759. ! Configuration:
  4760. !   --cache-file=FILE       cache test results in FILE
  4761. !   --help                  print this message
  4762. !   --no-create             do not create output files
  4763. !   --quiet, --silent       do not print \`checking...' messages
  4764. !   --version               print the version of autoconf that created configure
  4765. ! Directory and file names:
  4766. !   --prefix=PREFIX         install architecture-independent files in PREFIX
  4767. !                           [$ac_default_prefix]
  4768. !   --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
  4769. !                           [same as prefix]
  4770. !   --srcdir=DIR            find the sources in DIR [configure dir or ..]
  4771. !   --program-prefix=PREFIX prepend PREFIX to installed program names
  4772. !   --program-suffix=SUFFIX append SUFFIX to installed program names
  4773. !   --program-transform-name=PROGRAM run sed PROGRAM on installed program names
  4774. ! Host type:
  4775. !   --build=BUILD           configure for building on BUILD [BUILD=HOST]
  4776. !   --host=HOST             configure for HOST [guessed]
  4777. !   --target=TARGET         configure for TARGET [TARGET=HOST]
  4778. ! Features and packages:
  4779. !   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  4780. !   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  4781. !   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  4782. !   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  4783. !   --x-includes=DIR        X include files are in DIR
  4784. !   --x-libraries=DIR       X library files are in DIR
  4785. ! --enable and --with options recognized:$ac_help
  4786.   EOF
  4787.       exit 0 ;;
  4788.   
  4789. ***************
  4790. *** 219,234 ****
  4791.       verbose=yes ;;
  4792.   
  4793.     -version | --version | --versio | --versi | --vers)
  4794. !     echo "configure generated by autoconf version 2.0"
  4795.       exit 0 ;;
  4796.   
  4797.     -with-* | --with-*)
  4798. !     ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
  4799.       # Reject names that are not valid shell variable names.
  4800. !     if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
  4801.         { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  4802.       fi
  4803. !     ac_package=`echo $ac_package| sed 's/-/_/g'`
  4804.       case "$ac_option" in
  4805.         *=*) ;;
  4806.         *) ac_optarg=yes ;;
  4807. --- 218,233 ----
  4808.       verbose=yes ;;
  4809.   
  4810.     -version | --version | --versio | --versi | --vers)
  4811. !     echo "configure generated by autoconf version 2.1"
  4812.       exit 0 ;;
  4813.   
  4814.     -with-* | --with-*)
  4815. !     ac_package=`/bin/echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
  4816.       # Reject names that are not valid shell variable names.
  4817. !     if test -n "`/bin/echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
  4818.         { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  4819.       fi
  4820. !     ac_package=`/bin/echo $ac_package| sed 's/-/_/g'`
  4821.       case "$ac_option" in
  4822.         *=*) ;;
  4823.         *) ac_optarg=yes ;;
  4824. ***************
  4825. *** 236,247 ****
  4826.       eval "with_${ac_package}='$ac_optarg'" ;;
  4827.   
  4828.     -without-* | --without-*)
  4829. !     ac_package=`echo $ac_option|sed -e 's/-*without-//'`
  4830.       # Reject names that are not valid shell variable names.
  4831. !     if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  4832.         { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  4833.       fi
  4834. !     ac_package=`echo $ac_package| sed 's/-/_/g'`
  4835.       eval "with_${ac_package}=no" ;;
  4836.   
  4837.     --x)
  4838. --- 235,246 ----
  4839.       eval "with_${ac_package}='$ac_optarg'" ;;
  4840.   
  4841.     -without-* | --without-*)
  4842. !     ac_package=`/bin/echo $ac_option|sed -e 's/-*without-//'`
  4843.       # Reject names that are not valid shell variable names.
  4844. !     if test -n "`/bin/echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  4845.         { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
  4846.       fi
  4847. !     ac_package=`/bin/echo $ac_package| sed 's/-/_/g'`
  4848.       eval "with_${ac_package}=no" ;;
  4849.   
  4850.     --x)
  4851. ***************
  4852. *** 266,272 ****
  4853.       ;;
  4854.   
  4855.     *) 
  4856. !     if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
  4857.         echo "configure: warning: $ac_option: invalid host type" 1>&2
  4858.       fi
  4859.       if test "x$nonopt" != xNONE; then
  4860. --- 265,271 ----
  4861.       ;;
  4862.   
  4863.     *) 
  4864. !     if test -n "`/bin/echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
  4865.         echo "configure: warning: $ac_option: invalid host type" 1>&2
  4866.       fi
  4867.       if test "x$nonopt" != xNONE; then
  4868. ***************
  4869. *** 279,285 ****
  4870.   done
  4871.   
  4872.   if test -n "$ac_prev"; then
  4873. !   { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
  4874.   fi
  4875.   
  4876.   trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
  4877. --- 278,284 ----
  4878.   done
  4879.   
  4880.   if test -n "$ac_prev"; then
  4881. !   { echo "configure: error: missing argument to --`/bin/echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
  4882.   fi
  4883.   
  4884.   trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
  4885. ***************
  4886. *** 329,335 ****
  4887.   # confdefs.h avoids OS command line length limits that DEFS can exceed.
  4888.   rm -rf conftest* confdefs.h
  4889.   # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  4890. ! echo > confdefs.h
  4891.   
  4892.   # A filename unique to this package, relative to the directory that
  4893.   # configure is in, which we can look for to find out if srcdir is correct.
  4894. --- 328,334 ----
  4895.   # confdefs.h avoids OS command line length limits that DEFS can exceed.
  4896.   rm -rf conftest* confdefs.h
  4897.   # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  4898. ! /bin/echo > confdefs.h
  4899.   
  4900.   # A filename unique to this package, relative to the directory that
  4901.   # configure is in, which we can look for to find out if srcdir is correct.
  4902. ***************
  4903. *** 340,346 ****
  4904.     ac_srcdir_defaulted=yes
  4905.     # Try the directory containing this script, then its parent.
  4906.     ac_prog=$0
  4907. !   ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
  4908.     test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
  4909.     srcdir=$ac_confdir
  4910.     if test ! -r $srcdir/$ac_unique_file; then
  4911. --- 339,345 ----
  4912.     ac_srcdir_defaulted=yes
  4913.     # Try the directory containing this script, then its parent.
  4914.     ac_prog=$0
  4915. !   ac_confdir=`/bin/echo $ac_prog|sed 's%/[^/][^/]*$%%'`
  4916.     test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
  4917.     srcdir=$ac_confdir
  4918.     if test ! -r $srcdir/$ac_unique_file; then
  4919. ***************
  4920. *** 356,362 ****
  4921.       { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
  4922.     fi
  4923.   fi
  4924. ! srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
  4925.   
  4926.   # Prefer explicitly selected file to automatically selected ones.
  4927.   if test -z "$CONFIG_SITE"; then
  4928. --- 355,361 ----
  4929.       { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
  4930.     fi
  4931.   fi
  4932. ! srcdir=`/bin/echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
  4933.   
  4934.   # Prefer explicitly selected file to automatically selected ones.
  4935.   if test -z "$CONFIG_SITE"; then
  4936. ***************
  4937. *** 460,466 ****
  4938.   else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
  4939.   fi
  4940.   
  4941. ! echo $ac_n "checking host system type""... $ac_c" 1>&4
  4942.   
  4943.   host_alias=$host
  4944.   case "$host_alias" in
  4945. --- 459,465 ----
  4946.   else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
  4947.   fi
  4948.   
  4949. ! /bin/echo $ac_n "checking host system type""... $ac_c" 1>&4
  4950.   
  4951.   host_alias=$host
  4952.   case "$host_alias" in
  4953. ***************
  4954. *** 475,486 ****
  4955.   esac
  4956.   
  4957.   host=`$ac_config_sub $host_alias`
  4958. ! host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4959. ! host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  4960. ! host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  4961. ! echo "$ac_t""$host" 1>&4
  4962.   
  4963. ! echo $ac_n "checking target system type""... $ac_c" 1>&4
  4964.   
  4965.   target_alias=$target
  4966.   case "$target_alias" in
  4967. --- 474,485 ----
  4968.   esac
  4969.   
  4970.   host=`$ac_config_sub $host_alias`
  4971. ! host_cpu=`/bin/echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4972. ! host_vendor=`/bin/echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  4973. ! host_os=`/bin/echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  4974. ! /bin/echo "$ac_t""$host" 1>&4
  4975.   
  4976. ! /bin/echo $ac_n "checking target system type""... $ac_c" 1>&4
  4977.   
  4978.   target_alias=$target
  4979.   case "$target_alias" in
  4980. ***************
  4981. *** 492,503 ****
  4982.   esac
  4983.   
  4984.   target=`$ac_config_sub $target_alias`
  4985. ! target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4986. ! target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  4987. ! target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  4988. ! echo "$ac_t""$target" 1>&4
  4989.   
  4990. ! echo $ac_n "checking build system type""... $ac_c" 1>&4
  4991.   
  4992.   build_alias=$build
  4993.   case "$build_alias" in
  4994. --- 491,502 ----
  4995.   esac
  4996.   
  4997.   target=`$ac_config_sub $target_alias`
  4998. ! target_cpu=`/bin/echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  4999. ! target_vendor=`/bin/echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  5000. ! target_os=`/bin/echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  5001. ! /bin/echo "$ac_t""$target" 1>&4
  5002.   
  5003. ! /bin/echo $ac_n "checking build system type""... $ac_c" 1>&4
  5004.   
  5005.   build_alias=$build
  5006.   case "$build_alias" in
  5007. ***************
  5008. *** 509,518 ****
  5009.   esac
  5010.   
  5011.   build=`$ac_config_sub $build_alias`
  5012. ! build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  5013. ! build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  5014. ! build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  5015. ! echo "$ac_t""$build" 1>&4
  5016.   
  5017.   test "$host_alias" != "$target_alias" &&
  5018.     test "$program_prefix$program_suffix$program_transform_name" = \
  5019. --- 508,517 ----
  5020.   esac
  5021.   
  5022.   build=`$ac_config_sub $build_alias`
  5023. ! build_cpu=`/bin/echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  5024. ! build_vendor=`/bin/echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  5025. ! build_os=`/bin/echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  5026. ! /bin/echo "$ac_t""$build" 1>&4
  5027.   
  5028.   test "$host_alias" != "$target_alias" &&
  5029.     test "$program_prefix$program_suffix$program_transform_name" = \
  5030. ***************
  5031. *** 523,529 ****
  5032.   else
  5033.     # Double any \ or $.
  5034.     echo 's,\\,\\\\,g; s,\$,$$,g' > conftestsed
  5035. !   program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
  5036.     rm -f conftestsed
  5037.   fi
  5038.   test "$program_prefix" != NONE &&
  5039. --- 522,528 ----
  5040.   else
  5041.     # Double any \ or $.
  5042.     echo 's,\\,\\\\,g; s,\$,$$,g' > conftestsed
  5043. !   program_transform_name="`/bin/echo $program_transform_name|sed -f conftestsed`"
  5044.     rm -f conftestsed
  5045.   fi
  5046.   test "$program_prefix" != NONE &&
  5047. ***************
  5048. *** 621,627 ****
  5049.     i960-*-vxworks5.*)    obj_format=coff emulation=ic960 gas_target=ic960coff ;;
  5050.     i960-*-vxworks*)    obj_format=bout ;;
  5051.   
  5052. !   m68k-wrs-vxworks | m68k-ericsson-ose | m68k-*-sunos*)
  5053.               obj_format=aout emulation=sun3 ;;
  5054.     m68k-motorola-sysv)    obj_format=coff gas_target=m68kcoff emulation=delta ;;
  5055.     m68k-bull-sysv3*)    obj_format=coff gas_target=m68kcoff emulation=dpx2 ;;
  5056. --- 620,626 ----
  5057.     i960-*-vxworks5.*)    obj_format=coff emulation=ic960 gas_target=ic960coff ;;
  5058.     i960-*-vxworks*)    obj_format=bout ;;
  5059.   
  5060. !   m68k-wrs-vxworks | m68k-ericsson-ose | m68k-*-sunos* | m68*-cbm-amigados*)
  5061.               obj_format=aout emulation=sun3 ;;
  5062.     m68k-motorola-sysv)    obj_format=coff gas_target=m68kcoff emulation=delta ;;
  5063.     m68k-bull-sysv3*)    obj_format=coff gas_target=m68kcoff emulation=dpx2 ;;
  5064. ***************
  5065. *** 816,825 ****
  5066.   EOF
  5067.   
  5068.   
  5069. ! echo $ac_n "checking for CC""... $ac_c" 1>&4
  5070.   test -z "$CC" && CC=`egrep '^CC *=' ../Makefile | tail -1 | sed 's/^CC *= *//'`
  5071.   test -z "$CC" && CC=cc
  5072. ! echo "$ac_t""setting CC to $CC" 1>&4
  5073.   
  5074.   # Find out if we are using GNU C, under whatever name.
  5075.   cat > conftest.c <<EOF
  5076. --- 815,824 ----
  5077.   EOF
  5078.   
  5079.   
  5080. ! /bin/echo $ac_n "checking for CC""... $ac_c" 1>&4
  5081.   test -z "$CC" && CC=`egrep '^CC *=' ../Makefile | tail -1 | sed 's/^CC *= *//'`
  5082.   test -z "$CC" && CC=cc
  5083. ! /bin/echo "$ac_t""setting CC to $CC" 1>&4
  5084.   
  5085.   # Find out if we are using GNU C, under whatever name.
  5086.   cat > conftest.c <<EOF
  5087. ***************
  5088. *** 845,859 ****
  5089.   # AFS /usr/afsws/bin/install, which mishandles nonexistent args
  5090.   # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  5091.   # ./install, which can be erroneously created by make from ./install.sh.
  5092. ! echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&4
  5093.   if test -z "$INSTALL"; then
  5094.   if eval "test \"`echo '${'ac_cv_path_install'+set}'`\" = set"; then
  5095. !   echo $ac_n "(cached) $ac_c" 1>&4
  5096.   else
  5097.       IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  5098.     for ac_dir in $PATH; do
  5099.       case "$ac_dir" in
  5100. !     ''|.|/etc|/usr/sbin|/usr/etc|/sbin|/usr/afsws/bin|/usr/ucb) ;;
  5101.       *)
  5102.         # OSF1 and SCO ODT 3.0 have their own names for install.
  5103.         for ac_prog in ginstall installbsd scoinst install; do
  5104. --- 844,858 ----
  5105.   # AFS /usr/afsws/bin/install, which mishandles nonexistent args
  5106.   # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  5107.   # ./install, which can be erroneously created by make from ./install.sh.
  5108. ! /bin/echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&4
  5109.   if test -z "$INSTALL"; then
  5110.   if eval "test \"`echo '${'ac_cv_path_install'+set}'`\" = set"; then
  5111. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5112.   else
  5113.       IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  5114.     for ac_dir in $PATH; do
  5115.       case "$ac_dir" in
  5116. !     ''|.|/gnu/etc) ;;
  5117.       *)
  5118.         # OSF1 and SCO ODT 3.0 have their own names for install.
  5119.         for ac_prog in ginstall installbsd scoinst install; do
  5120. ***************
  5121. *** 878,884 ****
  5122.   fi
  5123.     INSTALL="$ac_cv_path_install"
  5124.   fi
  5125. ! echo "$ac_t""$INSTALL" 1>&4
  5126.   
  5127.   # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
  5128.   # It thinks the first close brace ends the variable substitution.
  5129. --- 877,883 ----
  5130.   fi
  5131.     INSTALL="$ac_cv_path_install"
  5132.   fi
  5133. ! /bin/echo "$ac_t""$INSTALL" 1>&4
  5134.   
  5135.   # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
  5136.   # It thinks the first close brace ends the variable substitution.
  5137. ***************
  5138. *** 887,900 ****
  5139.   test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
  5140.   
  5141.   
  5142. ! echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&4
  5143.   # On Suns, sometimes $CPP names a directory.
  5144.   if test -n "$CPP" && test -d "$CPP"; then
  5145.     CPP=
  5146.   fi
  5147.   if test -z "$CPP"; then
  5148.   if eval "test \"`echo '${'ac_cv_prog_CPP'+set}'`\" = set"; then
  5149. !   echo $ac_n "(cached) $ac_c" 1>&4
  5150.   else
  5151.       # This must be in double quotes, not single quotes, because CPP may get
  5152.     # substituted into the Makefile and "${CC-cc}" will confuse make.
  5153. --- 886,899 ----
  5154.   test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
  5155.   
  5156.   
  5157. ! /bin/echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&4
  5158.   # On Suns, sometimes $CPP names a directory.
  5159.   if test -n "$CPP" && test -d "$CPP"; then
  5160.     CPP=
  5161.   fi
  5162.   if test -z "$CPP"; then
  5163.   if eval "test \"`echo '${'ac_cv_prog_CPP'+set}'`\" = set"; then
  5164. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5165.   else
  5166.       # This must be in double quotes, not single quotes, because CPP may get
  5167.     # substituted into the Makefile and "${CC-cc}" will confuse make.
  5168. ***************
  5169. *** 902,908 ****
  5170.     # On the NeXT, cc -E runs the code through the compiler's parser,
  5171.     # not just through cpp.
  5172.     cat > conftest.$ac_ext <<EOF
  5173. ! #line 906 "configure"
  5174.   #include "confdefs.h"
  5175.   #include <assert.h>
  5176.   Syntax Error
  5177. --- 901,907 ----
  5178.     # On the NeXT, cc -E runs the code through the compiler's parser,
  5179.     # not just through cpp.
  5180.     cat > conftest.$ac_ext <<EOF
  5181. ! #line 905 "configure"
  5182.   #include "confdefs.h"
  5183.   #include <assert.h>
  5184.   Syntax Error
  5185. ***************
  5186. *** 912,922 ****
  5187.   if test -z "$ac_err"; then
  5188.     :
  5189.   else
  5190. !   echo "$ac_err" >&5
  5191.     rm -rf conftest*
  5192.     CPP="${CC-cc} -E -traditional-cpp"
  5193.     cat > conftest.$ac_ext <<EOF
  5194. ! #line 920 "configure"
  5195.   #include "confdefs.h"
  5196.   #include <assert.h>
  5197.   Syntax Error
  5198. --- 911,921 ----
  5199.   if test -z "$ac_err"; then
  5200.     :
  5201.   else
  5202. !   /bin/echo "$ac_err" >&5
  5203.     rm -rf conftest*
  5204.     CPP="${CC-cc} -E -traditional-cpp"
  5205.     cat > conftest.$ac_ext <<EOF
  5206. ! #line 919 "configure"
  5207.   #include "confdefs.h"
  5208.   #include <assert.h>
  5209.   Syntax Error
  5210. ***************
  5211. *** 926,932 ****
  5212.   if test -z "$ac_err"; then
  5213.     :
  5214.   else
  5215. !   echo "$ac_err" >&5
  5216.     rm -rf conftest*
  5217.     CPP=/lib/cpp
  5218.   fi
  5219. --- 925,931 ----
  5220.   if test -z "$ac_err"; then
  5221.     :
  5222.   else
  5223. !   /bin/echo "$ac_err" >&5
  5224.     rm -rf conftest*
  5225.     CPP=/lib/cpp
  5226.   fi
  5227. ***************
  5228. *** 937,953 ****
  5229.   fi
  5230.   fi
  5231.   CPP="$ac_cv_prog_CPP"
  5232. ! echo "$ac_t""$CPP" 1>&4
  5233.   
  5234.   for ac_hdr in string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h
  5235.   do
  5236. ! ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
  5237. ! echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&4
  5238.   if eval "test \"`echo '${'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  5239. !   echo $ac_n "(cached) $ac_c" 1>&4
  5240.   else
  5241.     cat > conftest.$ac_ext <<EOF
  5242. ! #line 951 "configure"
  5243.   #include "confdefs.h"
  5244.   #include <$ac_hdr>
  5245.   EOF
  5246. --- 936,952 ----
  5247.   fi
  5248.   fi
  5249.   CPP="$ac_cv_prog_CPP"
  5250. ! /bin/echo "$ac_t""$CPP" 1>&4
  5251.   
  5252.   for ac_hdr in string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h
  5253.   do
  5254. ! ac_safe=`/bin/echo "$ac_hdr" | tr './\055' '___'`
  5255. ! /bin/echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&4
  5256.   if eval "test \"`echo '${'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  5257. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5258.   else
  5259.     cat > conftest.$ac_ext <<EOF
  5260. ! #line 950 "configure"
  5261.   #include "confdefs.h"
  5262.   #include <$ac_hdr>
  5263.   EOF
  5264. ***************
  5265. *** 957,984 ****
  5266.     rm -rf conftest*
  5267.     eval "ac_cv_header_$ac_safe=yes"
  5268.   else
  5269. !   echo "$ac_err" >&5
  5270.     rm -rf conftest*
  5271.     eval "ac_cv_header_$ac_safe=no"
  5272.   fi
  5273.   rm -f conftest*
  5274.   fi
  5275.   if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  5276. !   echo "$ac_t""yes" 1>&4
  5277. !     ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
  5278.     cat >> confdefs.h <<EOF
  5279.   #define $ac_tr_hdr 1
  5280.   EOF
  5281.    
  5282.   else
  5283. !   echo "$ac_t""no" 1>&4
  5284.   fi
  5285.   done
  5286.   
  5287.   
  5288.   # Put this here so that autoconf's "cross-compiling" message doesn't confuse
  5289.   # people who are not cross-compiling but are compiling cross-assemblers.
  5290. ! echo $ac_n "checking whether compiling a cross-assembler""... $ac_c" 1>&4
  5291.   if test "${host}" = "${target}"; then
  5292.     cross_gas=no
  5293.   else
  5294. --- 956,983 ----
  5295.     rm -rf conftest*
  5296.     eval "ac_cv_header_$ac_safe=yes"
  5297.   else
  5298. !   /bin/echo "$ac_err" >&5
  5299.     rm -rf conftest*
  5300.     eval "ac_cv_header_$ac_safe=no"
  5301.   fi
  5302.   rm -f conftest*
  5303.   fi
  5304.   if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  5305. !   /bin/echo "$ac_t""yes" 1>&4
  5306. !     ac_tr_hdr=HAVE_`/bin/echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
  5307.     cat >> confdefs.h <<EOF
  5308.   #define $ac_tr_hdr 1
  5309.   EOF
  5310.    
  5311.   else
  5312. !   /bin/echo "$ac_t""no" 1>&4
  5313.   fi
  5314.   done
  5315.   
  5316.   
  5317.   # Put this here so that autoconf's "cross-compiling" message doesn't confuse
  5318.   # people who are not cross-compiling but are compiling cross-assemblers.
  5319. ! /bin/echo $ac_n "checking whether compiling a cross-assembler""... $ac_c" 1>&4
  5320.   if test "${host}" = "${target}"; then
  5321.     cross_gas=no
  5322.   else
  5323. ***************
  5324. *** 988,1005 ****
  5325.   EOF
  5326.   
  5327.   fi
  5328. ! echo "$ac_t""$cross_gas" 1>&4
  5329.   
  5330.   # If we cannot run a trivial program, we must be cross compiling.
  5331. ! echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&4
  5332.   if eval "test \"`echo '${'ac_cv_c_cross'+set}'`\" = set"; then
  5333. !   echo $ac_n "(cached) $ac_c" 1>&4
  5334.   else
  5335.     if test "$cross_compiling" = yes; then
  5336.     ac_cv_cross=yes
  5337.   else
  5338.   cat > conftest.$ac_ext <<EOF
  5339. ! #line 1003 "configure"
  5340.   #include "confdefs.h"
  5341.   main(){return(0);}
  5342.   EOF
  5343. --- 987,1004 ----
  5344.   EOF
  5345.   
  5346.   fi
  5347. ! /bin/echo "$ac_t""$cross_gas" 1>&4
  5348.   
  5349.   # If we cannot run a trivial program, we must be cross compiling.
  5350. ! /bin/echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&4
  5351.   if eval "test \"`echo '${'ac_cv_c_cross'+set}'`\" = set"; then
  5352. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5353.   else
  5354.     if test "$cross_compiling" = yes; then
  5355.     ac_cv_cross=yes
  5356.   else
  5357.   cat > conftest.$ac_ext <<EOF
  5358. ! #line 1002 "configure"
  5359.   #include "confdefs.h"
  5360.   main(){return(0);}
  5361.   EOF
  5362. ***************
  5363. *** 1013,1028 ****
  5364.   rm -fr conftest*
  5365.   fi
  5366.   cross_compiling=$ac_cv_c_cross
  5367. ! echo "$ac_t""$ac_cv_c_cross" 1>&4
  5368.   
  5369.   # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  5370.   # for constant arguments.  Useless!
  5371. ! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&4
  5372.   if eval "test \"`echo '${'ac_cv_header_alloca_h'+set}'`\" = set"; then
  5373. !   echo $ac_n "(cached) $ac_c" 1>&4
  5374.   else
  5375.     cat > conftest.$ac_ext <<EOF
  5376. ! #line 1026 "configure"
  5377.   #include "confdefs.h"
  5378.   #include <alloca.h>
  5379.   int main() { return 0; }
  5380. --- 1012,1027 ----
  5381.   rm -fr conftest*
  5382.   fi
  5383.   cross_compiling=$ac_cv_c_cross
  5384. ! /bin/echo "$ac_t""$ac_cv_c_cross" 1>&4
  5385.   
  5386.   # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  5387.   # for constant arguments.  Useless!
  5388. ! /bin/echo $ac_n "checking for working alloca.h""... $ac_c" 1>&4
  5389.   if eval "test \"`echo '${'ac_cv_header_alloca_h'+set}'`\" = set"; then
  5390. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5391.   else
  5392.     cat > conftest.$ac_ext <<EOF
  5393. ! #line 1025 "configure"
  5394.   #include "confdefs.h"
  5395.   #include <alloca.h>
  5396.   int main() { return 0; }
  5397. ***************
  5398. *** 1040,1046 ****
  5399.   rm -f conftest*
  5400.   
  5401.   fi
  5402. ! echo "$ac_t""$ac_cv_header_alloca_h" 1>&4
  5403.   if test $ac_cv_header_alloca_h = yes; then
  5404.     cat >> confdefs.h <<\EOF
  5405.   #define HAVE_ALLOCA_H 1
  5406. --- 1039,1045 ----
  5407.   rm -f conftest*
  5408.   
  5409.   fi
  5410. ! /bin/echo "$ac_t""$ac_cv_header_alloca_h" 1>&4
  5411.   if test $ac_cv_header_alloca_h = yes; then
  5412.     cat >> confdefs.h <<\EOF
  5413.   #define HAVE_ALLOCA_H 1
  5414. ***************
  5415. *** 1048,1059 ****
  5416.   
  5417.   fi
  5418.   
  5419. ! echo $ac_n "checking for alloca""... $ac_c" 1>&4
  5420.   if eval "test \"`echo '${'ac_cv_func_alloca'+set}'`\" = set"; then
  5421. !   echo $ac_n "(cached) $ac_c" 1>&4
  5422.   else
  5423.     cat > conftest.$ac_ext <<EOF
  5424. ! #line 1057 "configure"
  5425.   #include "confdefs.h"
  5426.   
  5427.   #ifdef __GNUC__
  5428. --- 1047,1058 ----
  5429.   
  5430.   fi
  5431.   
  5432. ! /bin/echo $ac_n "checking for alloca""... $ac_c" 1>&4
  5433.   if eval "test \"`echo '${'ac_cv_func_alloca'+set}'`\" = set"; then
  5434. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5435.   else
  5436.     cat > conftest.$ac_ext <<EOF
  5437. ! #line 1056 "configure"
  5438.   #include "confdefs.h"
  5439.   
  5440.   #ifdef __GNUC__
  5441. ***************
  5442. *** 1087,1093 ****
  5443.   rm -f conftest*
  5444.   
  5445.   fi
  5446. ! echo "$ac_t""$ac_cv_func_alloca" 1>&4
  5447.   if test $ac_cv_func_alloca = yes; then
  5448.     cat >> confdefs.h <<\EOF
  5449.   #define HAVE_ALLOCA 1
  5450. --- 1086,1092 ----
  5451.   rm -f conftest*
  5452.   
  5453.   fi
  5454. ! /bin/echo "$ac_t""$ac_cv_func_alloca" 1>&4
  5455.   if test $ac_cv_func_alloca = yes; then
  5456.     cat >> confdefs.h <<\EOF
  5457.   #define HAVE_ALLOCA 1
  5458. ***************
  5459. *** 1106,1117 ****
  5460.   EOF
  5461.   
  5462.   
  5463. ! echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&4
  5464.   if eval "test \"`echo '${'ac_cv_os_cray'+set}'`\" = set"; then
  5465. !   echo $ac_n "(cached) $ac_c" 1>&4
  5466.   else
  5467.     cat > conftest.$ac_ext <<EOF
  5468. ! #line 1115 "configure"
  5469.   #include "confdefs.h"
  5470.   #if defined(CRAY) && ! defined(CRAY2)
  5471.   webecray
  5472. --- 1105,1116 ----
  5473.   EOF
  5474.   
  5475.   
  5476. ! /bin/echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&4
  5477.   if eval "test \"`echo '${'ac_cv_os_cray'+set}'`\" = set"; then
  5478. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5479.   else
  5480.     cat > conftest.$ac_ext <<EOF
  5481. ! #line 1114 "configure"
  5482.   #include "confdefs.h"
  5483.   #if defined(CRAY) && ! defined(CRAY2)
  5484.   webecray
  5485. ***************
  5486. *** 1131,1146 ****
  5487.   rm -f conftest*
  5488.   
  5489.   fi
  5490. ! echo "$ac_t""$ac_cv_os_cray" 1>&4
  5491.   if test $ac_cv_os_cray = yes; then
  5492. ! echo $ac_n "checking for _getb67""... $ac_c" 1>&4
  5493.   if eval "test \"`echo '${'ac_cv_func__getb67'+set}'`\" = set"; then
  5494. !   echo $ac_n "(cached) $ac_c" 1>&4
  5495.   else
  5496.     cat > conftest.$ac_ext <<EOF
  5497. ! #line 1142 "configure"
  5498.   #include "confdefs.h"
  5499.   #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  5500.   int main() { return 0; }
  5501.   int t() {
  5502.   
  5503. --- 1130,1148 ----
  5504.   rm -f conftest*
  5505.   
  5506.   fi
  5507. ! /bin/echo "$ac_t""$ac_cv_os_cray" 1>&4
  5508.   if test $ac_cv_os_cray = yes; then
  5509. ! /bin/echo $ac_n "checking for _getb67""... $ac_c" 1>&4
  5510.   if eval "test \"`echo '${'ac_cv_func__getb67'+set}'`\" = set"; then
  5511. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5512.   else
  5513.     cat > conftest.$ac_ext <<EOF
  5514. ! #line 1141 "configure"
  5515.   #include "confdefs.h"
  5516.   #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  5517. + /* Override any gcc2 internal prototype to avoid an error.  */
  5518. + char _getb67(); 
  5519.   int main() { return 0; }
  5520.   int t() {
  5521.   
  5522. ***************
  5523. *** 1150,1157 ****
  5524.   #if defined (__stub__getb67) || defined (__stub____getb67)
  5525.   choke me
  5526.   #else
  5527. ! /* Override any gcc2 internal prototype to avoid an error.  */
  5528. ! char _getb67(); _getb67();
  5529.   #endif
  5530.   
  5531.   ; return 0; }
  5532. --- 1152,1158 ----
  5533.   #if defined (__stub__getb67) || defined (__stub____getb67)
  5534.   choke me
  5535.   #else
  5536. ! _getb67();
  5537.   #endif
  5538.   
  5539.   ; return 0; }
  5540. ***************
  5541. *** 1167,1187 ****
  5542.   
  5543.   fi
  5544.   if eval "test \"`echo '$ac_cv_func_'_getb67`\" = yes"; then
  5545. !   echo "$ac_t""yes" 1>&4
  5546.     cat >> confdefs.h <<\EOF
  5547.   #define CRAY_STACKSEG_END _getb67
  5548.   EOF
  5549.   
  5550.   else
  5551. !   echo "$ac_t""no" 1>&4
  5552. ! echo $ac_n "checking for GETB67""... $ac_c" 1>&4
  5553.   if eval "test \"`echo '${'ac_cv_func_GETB67'+set}'`\" = set"; then
  5554. !   echo $ac_n "(cached) $ac_c" 1>&4
  5555.   else
  5556.     cat > conftest.$ac_ext <<EOF
  5557. ! #line 1183 "configure"
  5558.   #include "confdefs.h"
  5559.   #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  5560.   int main() { return 0; }
  5561.   int t() {
  5562.   
  5563. --- 1168,1191 ----
  5564.   
  5565.   fi
  5566.   if eval "test \"`echo '$ac_cv_func_'_getb67`\" = yes"; then
  5567. !   /bin/echo "$ac_t""yes" 1>&4
  5568.     cat >> confdefs.h <<\EOF
  5569.   #define CRAY_STACKSEG_END _getb67
  5570.   EOF
  5571.   
  5572.   else
  5573. !   /bin/echo "$ac_t""no" 1>&4
  5574. ! /bin/echo $ac_n "checking for GETB67""... $ac_c" 1>&4
  5575.   if eval "test \"`echo '${'ac_cv_func_GETB67'+set}'`\" = set"; then
  5576. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5577.   else
  5578.     cat > conftest.$ac_ext <<EOF
  5579. ! #line 1184 "configure"
  5580.   #include "confdefs.h"
  5581.   #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  5582. + /* Override any gcc2 internal prototype to avoid an error.  */
  5583. + char GETB67(); 
  5584.   int main() { return 0; }
  5585.   int t() {
  5586.   
  5587. ***************
  5588. *** 1191,1198 ****
  5589.   #if defined (__stub_GETB67) || defined (__stub___GETB67)
  5590.   choke me
  5591.   #else
  5592. ! /* Override any gcc2 internal prototype to avoid an error.  */
  5593. ! char GETB67(); GETB67();
  5594.   #endif
  5595.   
  5596.   ; return 0; }
  5597. --- 1195,1201 ----
  5598.   #if defined (__stub_GETB67) || defined (__stub___GETB67)
  5599.   choke me
  5600.   #else
  5601. ! GETB67();
  5602.   #endif
  5603.   
  5604.   ; return 0; }
  5605. ***************
  5606. *** 1208,1228 ****
  5607.   
  5608.   fi
  5609.   if eval "test \"`echo '$ac_cv_func_'GETB67`\" = yes"; then
  5610. !   echo "$ac_t""yes" 1>&4
  5611.     cat >> confdefs.h <<\EOF
  5612.   #define CRAY_STACKSEG_END GETB67
  5613.   EOF
  5614.   
  5615.   else
  5616. !   echo "$ac_t""no" 1>&4
  5617. ! echo $ac_n "checking for getb67""... $ac_c" 1>&4
  5618.   if eval "test \"`echo '${'ac_cv_func_getb67'+set}'`\" = set"; then
  5619. !   echo $ac_n "(cached) $ac_c" 1>&4
  5620.   else
  5621.     cat > conftest.$ac_ext <<EOF
  5622. ! #line 1224 "configure"
  5623.   #include "confdefs.h"
  5624.   #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  5625.   int main() { return 0; }
  5626.   int t() {
  5627.   
  5628. --- 1211,1234 ----
  5629.   
  5630.   fi
  5631.   if eval "test \"`echo '$ac_cv_func_'GETB67`\" = yes"; then
  5632. !   /bin/echo "$ac_t""yes" 1>&4
  5633.     cat >> confdefs.h <<\EOF
  5634.   #define CRAY_STACKSEG_END GETB67
  5635.   EOF
  5636.   
  5637.   else
  5638. !   /bin/echo "$ac_t""no" 1>&4
  5639. ! /bin/echo $ac_n "checking for getb67""... $ac_c" 1>&4
  5640.   if eval "test \"`echo '${'ac_cv_func_getb67'+set}'`\" = set"; then
  5641. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5642.   else
  5643.     cat > conftest.$ac_ext <<EOF
  5644. ! #line 1227 "configure"
  5645.   #include "confdefs.h"
  5646.   #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  5647. + /* Override any gcc2 internal prototype to avoid an error.  */
  5648. + char getb67(); 
  5649.   int main() { return 0; }
  5650.   int t() {
  5651.   
  5652. ***************
  5653. *** 1232,1239 ****
  5654.   #if defined (__stub_getb67) || defined (__stub___getb67)
  5655.   choke me
  5656.   #else
  5657. ! /* Override any gcc2 internal prototype to avoid an error.  */
  5658. ! char getb67(); getb67();
  5659.   #endif
  5660.   
  5661.   ; return 0; }
  5662. --- 1238,1244 ----
  5663.   #if defined (__stub_getb67) || defined (__stub___getb67)
  5664.   choke me
  5665.   #else
  5666. ! getb67();
  5667.   #endif
  5668.   
  5669.   ; return 0; }
  5670. ***************
  5671. *** 1249,1261 ****
  5672.   
  5673.   fi
  5674.   if eval "test \"`echo '$ac_cv_func_'getb67`\" = yes"; then
  5675. !   echo "$ac_t""yes" 1>&4
  5676.     cat >> confdefs.h <<\EOF
  5677.   #define CRAY_STACKSEG_END getb67
  5678.   EOF
  5679.   
  5680.   else
  5681. !   echo "$ac_t""no" 1>&4
  5682.   fi
  5683.   
  5684.   fi
  5685. --- 1254,1266 ----
  5686.   
  5687.   fi
  5688.   if eval "test \"`echo '$ac_cv_func_'getb67`\" = yes"; then
  5689. !   /bin/echo "$ac_t""yes" 1>&4
  5690.     cat >> confdefs.h <<\EOF
  5691.   #define CRAY_STACKSEG_END getb67
  5692.   EOF
  5693.   
  5694.   else
  5695. !   /bin/echo "$ac_t""no" 1>&4
  5696.   fi
  5697.   
  5698.   fi
  5699. ***************
  5700. *** 1264,1278 ****
  5701.   
  5702.   fi
  5703.   
  5704. ! echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&4
  5705.   if eval "test \"`echo '${'ac_cv_c_stack_direction'+set}'`\" = set"; then
  5706. !   echo $ac_n "(cached) $ac_c" 1>&4
  5707.   else
  5708.     if test "$cross_compiling" = yes; then
  5709.     ac_cv_c_stack_direction=0
  5710.   else
  5711.   cat > conftest.$ac_ext <<EOF
  5712. ! #line 1276 "configure"
  5713.   #include "confdefs.h"
  5714.   find_stack_direction ()
  5715.   {
  5716. --- 1269,1283 ----
  5717.   
  5718.   fi
  5719.   
  5720. ! /bin/echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&4
  5721.   if eval "test \"`echo '${'ac_cv_c_stack_direction'+set}'`\" = set"; then
  5722. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5723.   else
  5724.     if test "$cross_compiling" = yes; then
  5725.     ac_cv_c_stack_direction=0
  5726.   else
  5727.   cat > conftest.$ac_ext <<EOF
  5728. ! #line 1281 "configure"
  5729.   #include "confdefs.h"
  5730.   find_stack_direction ()
  5731.   {
  5732. ***************
  5733. *** 1300,1319 ****
  5734.   fi
  5735.   rm -fr conftest*
  5736.   fi
  5737. ! echo "$ac_t""$ac_cv_c_stack_direction" 1>&4
  5738.   cat >> confdefs.h <<EOF
  5739.   #define STACK_DIRECTION $ac_cv_c_stack_direction
  5740.   EOF
  5741.   
  5742.   fi
  5743.   
  5744. ! echo $ac_n "checking for inline""... $ac_c" 1>&4
  5745.   if eval "test \"`echo '${'ac_cv_c_inline'+set}'`\" = set"; then
  5746. !   echo $ac_n "(cached) $ac_c" 1>&4
  5747.   else
  5748.     if test "$GCC" = yes; then
  5749.   cat > conftest.$ac_ext <<EOF
  5750. ! #line 1317 "configure"
  5751.   #include "confdefs.h"
  5752.   
  5753.   int main() { return 0; }
  5754. --- 1305,1324 ----
  5755.   fi
  5756.   rm -fr conftest*
  5757.   fi
  5758. ! /bin/echo "$ac_t""$ac_cv_c_stack_direction" 1>&4
  5759.   cat >> confdefs.h <<EOF
  5760.   #define STACK_DIRECTION $ac_cv_c_stack_direction
  5761.   EOF
  5762.   
  5763.   fi
  5764.   
  5765. ! /bin/echo $ac_n "checking for inline""... $ac_c" 1>&4
  5766.   if eval "test \"`echo '${'ac_cv_c_inline'+set}'`\" = set"; then
  5767. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5768.   else
  5769.     if test "$GCC" = yes; then
  5770.   cat > conftest.$ac_ext <<EOF
  5771. ! #line 1322 "configure"
  5772.   #include "confdefs.h"
  5773.   
  5774.   int main() { return 0; }
  5775. ***************
  5776. *** 1334,1340 ****
  5777.     ac_cv_c_inline=no
  5778.   fi
  5779.   fi
  5780. ! echo "$ac_t""$ac_cv_c_inline" 1>&4
  5781.   if test $ac_cv_c_inline = no; then
  5782.     cat >> confdefs.h <<\EOF
  5783.   #define inline __inline
  5784. --- 1339,1345 ----
  5785.     ac_cv_c_inline=no
  5786.   fi
  5787.   fi
  5788. ! /bin/echo "$ac_t""$ac_cv_c_inline" 1>&4
  5789.   if test $ac_cv_c_inline = no; then
  5790.     cat >> confdefs.h <<\EOF
  5791.   #define inline __inline
  5792. ***************
  5793. *** 1346,1359 ****
  5794.   # VMS doesn't have unlink.
  5795.   for ac_func in unlink remove
  5796.   do
  5797. ! echo $ac_n "checking for $ac_func""... $ac_c" 1>&4
  5798.   if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then
  5799. !   echo $ac_n "(cached) $ac_c" 1>&4
  5800.   else
  5801.     cat > conftest.$ac_ext <<EOF
  5802. ! #line 1355 "configure"
  5803.   #include "confdefs.h"
  5804.   #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  5805.   int main() { return 0; }
  5806.   int t() {
  5807.   
  5808. --- 1351,1367 ----
  5809.   # VMS doesn't have unlink.
  5810.   for ac_func in unlink remove
  5811.   do
  5812. ! /bin/echo $ac_n "checking for $ac_func""... $ac_c" 1>&4
  5813.   if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then
  5814. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5815.   else
  5816.     cat > conftest.$ac_ext <<EOF
  5817. ! #line 1360 "configure"
  5818.   #include "confdefs.h"
  5819.   #include <ctype.h> /* Arbitrary system header to define __stub macros. */
  5820. + /* Override any gcc2 internal prototype to avoid an error.  */
  5821. + char $ac_func(); 
  5822.   int main() { return 0; }
  5823.   int t() {
  5824.   
  5825. ***************
  5826. *** 1363,1370 ****
  5827.   #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  5828.   choke me
  5829.   #else
  5830. ! /* Override any gcc2 internal prototype to avoid an error.  */
  5831. ! char $ac_func(); $ac_func();
  5832.   #endif
  5833.   
  5834.   ; return 0; }
  5835. --- 1371,1377 ----
  5836.   #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  5837.   choke me
  5838.   #else
  5839. ! $ac_func();
  5840.   #endif
  5841.   
  5842.   ; return 0; }
  5843. ***************
  5844. *** 1380,1393 ****
  5845.   
  5846.   fi
  5847.   if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  5848. !   echo "$ac_t""yes" 1>&4
  5849. !     ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
  5850.     cat >> confdefs.h <<EOF
  5851.   #define $ac_tr_func 1
  5852.   EOF
  5853.    break
  5854.   else
  5855. !   echo "$ac_t""no" 1>&4
  5856.   fi
  5857.   done
  5858.   
  5859. --- 1387,1400 ----
  5860.   
  5861.   fi
  5862.   if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  5863. !   /bin/echo "$ac_t""yes" 1>&4
  5864. !     ac_tr_func=HAVE_`/bin/echo $ac_func | tr '[a-z]' '[A-Z]'`
  5865.     cat >> confdefs.h <<EOF
  5866.   #define $ac_tr_func 1
  5867.   EOF
  5868.    break
  5869.   else
  5870. !   /bin/echo "$ac_t""no" 1>&4
  5871.   fi
  5872.   done
  5873.   
  5874. ***************
  5875. *** 1395,1406 ****
  5876.   # Some non-ANSI preprocessors botch requoting inside strings.  That's bad
  5877.   # enough, but on some of those systems, the assert macro relies on requoting
  5878.   # working properly!
  5879. ! echo $ac_n "checking for working assert macro""... $ac_c" 1>&4
  5880.   if eval "test \"`echo '${'gas_cv_assert_ok'+set}'`\" = set"; then
  5881. !   echo $ac_n "(cached) $ac_c" 1>&4
  5882.   else
  5883.     cat > conftest.$ac_ext <<EOF
  5884. ! #line 1404 "configure"
  5885.   #include "confdefs.h"
  5886.   #include <assert.h>
  5887.   #include <stdio.h>
  5888. --- 1402,1413 ----
  5889.   # Some non-ANSI preprocessors botch requoting inside strings.  That's bad
  5890.   # enough, but on some of those systems, the assert macro relies on requoting
  5891.   # working properly!
  5892. ! /bin/echo $ac_n "checking for working assert macro""... $ac_c" 1>&4
  5893.   if eval "test \"`echo '${'gas_cv_assert_ok'+set}'`\" = set"; then
  5894. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5895.   else
  5896.     cat > conftest.$ac_ext <<EOF
  5897. ! #line 1411 "configure"
  5898.   #include "confdefs.h"
  5899.   #include <assert.h>
  5900.   #include <stdio.h>
  5901. ***************
  5902. *** 1427,1433 ****
  5903.   rm -f conftest*
  5904.   
  5905.   fi
  5906. ! echo "$ac_t""$gas_cv_assert_ok" 1>&4
  5907.   test $gas_cv_assert_ok = yes || cat >> confdefs.h <<\EOF
  5908.   #define BROKEN_ASSERT 1
  5909.   EOF
  5910. --- 1434,1440 ----
  5911.   rm -f conftest*
  5912.   
  5913.   fi
  5914. ! /bin/echo "$ac_t""$gas_cv_assert_ok" 1>&4
  5915.   test $gas_cv_assert_ok = yes || cat >> confdefs.h <<\EOF
  5916.   #define BROKEN_ASSERT 1
  5917.   EOF
  5918. ***************
  5919. *** 1452,1463 ****
  5920.   #endif
  5921.   "
  5922.   
  5923. ! echo $ac_n "checking whether declaration is required for malloc""... $ac_c" 1>&4
  5924.   if eval "test \"`echo '${'gas_cv_decl_needed_malloc'+set}'`\" = set"; then
  5925. !   echo $ac_n "(cached) $ac_c" 1>&4
  5926.   else
  5927.     cat > conftest.$ac_ext <<EOF
  5928. ! #line 1461 "configure"
  5929.   #include "confdefs.h"
  5930.   $gas_test_headers
  5931.   int main() { return 0; }
  5932. --- 1459,1470 ----
  5933.   #endif
  5934.   "
  5935.   
  5936. ! /bin/echo $ac_n "checking whether declaration is required for malloc""... $ac_c" 1>&4
  5937.   if eval "test \"`echo '${'gas_cv_decl_needed_malloc'+set}'`\" = set"; then
  5938. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5939.   else
  5940.     cat > conftest.$ac_ext <<EOF
  5941. ! #line 1468 "configure"
  5942.   #include "confdefs.h"
  5943.   $gas_test_headers
  5944.   int main() { return 0; }
  5945. ***************
  5946. *** 1479,1485 ****
  5947.   rm -f conftest*
  5948.   
  5949.   fi
  5950. ! echo "$ac_t""$gas_cv_decl_needed_malloc" 1>&4
  5951.   test $gas_cv_decl_needed_malloc = no || {
  5952.    cat >> confdefs.h <<\EOF
  5953.   #define NEED_DECLARATION_MALLOC 1
  5954. --- 1486,1492 ----
  5955.   rm -f conftest*
  5956.   
  5957.   fi
  5958. ! /bin/echo "$ac_t""$gas_cv_decl_needed_malloc" 1>&4
  5959.   test $gas_cv_decl_needed_malloc = no || {
  5960.    cat >> confdefs.h <<\EOF
  5961.   #define NEED_DECLARATION_MALLOC 1
  5962. ***************
  5963. *** 1488,1499 ****
  5964.   }
  5965.   
  5966.   
  5967. ! echo $ac_n "checking whether declaration is required for free""... $ac_c" 1>&4
  5968.   if eval "test \"`echo '${'gas_cv_decl_needed_free'+set}'`\" = set"; then
  5969. !   echo $ac_n "(cached) $ac_c" 1>&4
  5970.   else
  5971.     cat > conftest.$ac_ext <<EOF
  5972. ! #line 1497 "configure"
  5973.   #include "confdefs.h"
  5974.   $gas_test_headers
  5975.   int main() { return 0; }
  5976. --- 1495,1506 ----
  5977.   }
  5978.   
  5979.   
  5980. ! /bin/echo $ac_n "checking whether declaration is required for free""... $ac_c" 1>&4
  5981.   if eval "test \"`echo '${'gas_cv_decl_needed_free'+set}'`\" = set"; then
  5982. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  5983.   else
  5984.     cat > conftest.$ac_ext <<EOF
  5985. ! #line 1504 "configure"
  5986.   #include "confdefs.h"
  5987.   $gas_test_headers
  5988.   int main() { return 0; }
  5989. ***************
  5990. *** 1515,1521 ****
  5991.   rm -f conftest*
  5992.   
  5993.   fi
  5994. ! echo "$ac_t""$gas_cv_decl_needed_free" 1>&4
  5995.   test $gas_cv_decl_needed_free = no || {
  5996.    cat >> confdefs.h <<\EOF
  5997.   #define NEED_DECLARATION_FREE 1
  5998. --- 1522,1528 ----
  5999.   rm -f conftest*
  6000.   
  6001.   fi
  6002. ! /bin/echo "$ac_t""$gas_cv_decl_needed_free" 1>&4
  6003.   test $gas_cv_decl_needed_free = no || {
  6004.    cat >> confdefs.h <<\EOF
  6005.   #define NEED_DECLARATION_FREE 1
  6006. ***************
  6007. *** 1527,1538 ****
  6008.   # Does errno.h declare errno, or do we have to add a separate declaration
  6009.   # for it?
  6010.   
  6011. ! echo $ac_n "checking whether declaration is required for errno""... $ac_c" 1>&4
  6012.   if eval "test \"`echo '${'gas_cv_decl_needed_errno'+set}'`\" = set"; then
  6013. !   echo $ac_n "(cached) $ac_c" 1>&4
  6014.   else
  6015.     cat > conftest.$ac_ext <<EOF
  6016. ! #line 1536 "configure"
  6017.   #include "confdefs.h"
  6018.   
  6019.   #ifdef HAVE_ERRNO_H
  6020. --- 1534,1545 ----
  6021.   # Does errno.h declare errno, or do we have to add a separate declaration
  6022.   # for it?
  6023.   
  6024. ! /bin/echo $ac_n "checking whether declaration is required for errno""... $ac_c" 1>&4
  6025.   if eval "test \"`echo '${'gas_cv_decl_needed_errno'+set}'`\" = set"; then
  6026. !   /bin/echo $ac_n "(cached) $ac_c" 1>&4
  6027.   else
  6028.     cat > conftest.$ac_ext <<EOF
  6029. ! #line 1543 "configure"
  6030.   #include "confdefs.h"
  6031.   
  6032.   #ifdef HAVE_ERRNO_H
  6033. ***************
  6034. *** 1558,1564 ****
  6035.   rm -f conftest*
  6036.   
  6037.   fi
  6038. ! echo "$ac_t""$gas_cv_decl_needed_errno" 1>&4
  6039.   test $gas_cv_decl_needed_errno = no || {
  6040.    cat >> confdefs.h <<\EOF
  6041.   #define NEED_DECLARATION_ERRNO 1
  6042. --- 1565,1571 ----
  6043.   rm -f conftest*
  6044.   
  6045.   fi
  6046. ! /bin/echo "$ac_t""$gas_cv_decl_needed_errno" 1>&4
  6047.   test $gas_cv_decl_needed_errno = no || {
  6048.    cat >> confdefs.h <<\EOF
  6049.   #define NEED_DECLARATION_ERRNO 1
  6050. ***************
  6051. *** 1618,1624 ****
  6052.   : ${CONFIG_STATUS=./config.status}
  6053.   
  6054.   echo creating $CONFIG_STATUS
  6055. ! rm -f $CONFIG_STATUS
  6056.   cat > $CONFIG_STATUS <<EOF
  6057.   #!/bin/sh
  6058.   # Generated automatically by configure.
  6059. --- 1625,1633 ----
  6060.   : ${CONFIG_STATUS=./config.status}
  6061.   
  6062.   echo creating $CONFIG_STATUS
  6063. ! # Some systems, like AmigaDOS, won't allow you to remove a script that is
  6064. ! # being executed, so just move it out of the way instead.
  6065. ! if test -f $CONFIG_STATUS; then mv $CONFIG_STATUS $CONFIG_STATUS.old; else true; fi
  6066.   cat > $CONFIG_STATUS <<EOF
  6067.   #!/bin/sh
  6068.   # Generated automatically by configure.
  6069. ***************
  6070. *** 1639,1645 ****
  6071.       echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
  6072.       exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
  6073.     -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
  6074. !     echo "$CONFIG_STATUS generated by autoconf version 2.0"
  6075.       exit 0 ;;
  6076.     -help | --help | --hel | --he | --h)
  6077.       echo "\$ac_cs_usage"; exit 0 ;;
  6078. --- 1648,1654 ----
  6079.       echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
  6080.       exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
  6081.     -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
  6082. !     /bin/echo "$CONFIG_STATUS generated by autoconf version 2.1"
  6083.       exit 0 ;;
  6084.     -help | --help | --hel | --he | --h)
  6085.       echo "\$ac_cs_usage"; exit 0 ;;
  6086. ***************
  6087. *** 1703,1723 ****
  6088.   for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
  6089.     # Support "outfile[:infile]", defaulting infile="outfile.in".
  6090.     case "$ac_file" in
  6091. !   *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
  6092. !        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  6093.     *) ac_file_in="${ac_file}.in" ;;
  6094.     esac
  6095.   
  6096.     # Adjust relative srcdir, etc. for subdirectories.
  6097.   
  6098.     # Remove last slash and all that follows it.  Not all systems have dirname.
  6099. !   ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
  6100.     if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
  6101.       # The file is in a subdirectory.
  6102.       test ! -d "$ac_dir" && mkdir "$ac_dir"
  6103.       ac_dir_suffix="/$ac_dir"
  6104.       # A "../" for each directory in $ac_dir_suffix.
  6105. !     ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
  6106.     else
  6107.       ac_dir_suffix= ac_dots=
  6108.     fi
  6109. --- 1712,1732 ----
  6110.   for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
  6111.     # Support "outfile[:infile]", defaulting infile="outfile.in".
  6112.     case "$ac_file" in
  6113. !   *:*) ac_file_in=`/bin/echo "$ac_file"|sed 's%.*:%%'`
  6114. !        ac_file=`/bin/echo "$ac_file"|sed 's%:.*%%'` ;;
  6115.     *) ac_file_in="${ac_file}.in" ;;
  6116.     esac
  6117.   
  6118.     # Adjust relative srcdir, etc. for subdirectories.
  6119.   
  6120.     # Remove last slash and all that follows it.  Not all systems have dirname.
  6121. !   ac_dir=`/bin/echo $ac_file|sed 's%/[^/][^/]*$%%'`
  6122.     if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
  6123.       # The file is in a subdirectory.
  6124.       test ! -d "$ac_dir" && mkdir "$ac_dir"
  6125.       ac_dir_suffix="/$ac_dir"
  6126.       # A "../" for each directory in $ac_dir_suffix.
  6127. !     ac_dots=`/bin/echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
  6128.     else
  6129.       ac_dir_suffix= ac_dots=
  6130.     fi
  6131. ***************
  6132. *** 1725,1731 ****
  6133.     case "$ac_given_srcdir" in
  6134.     .)  srcdir=.
  6135.         if test -z "$ac_dots"; then top_srcdir=.
  6136. !       else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
  6137.     /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
  6138.     *) # Relative path.
  6139.       srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
  6140. --- 1734,1740 ----
  6141.     case "$ac_given_srcdir" in
  6142.     .)  srcdir=.
  6143.         if test -z "$ac_dots"; then top_srcdir=.
  6144. !       else top_srcdir=`/bin/echo $ac_dots|sed 's%/$%%'`; fi ;;
  6145.     /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
  6146.     *) # Relative path.
  6147.       srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
  6148. ***************
  6149. *** 1738,1744 ****
  6150.     esac
  6151.     echo creating "$ac_file"
  6152.     rm -f "$ac_file"
  6153. !   configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
  6154.     case "$ac_file" in
  6155.     *Makefile*) ac_comsub="1i\\
  6156.   # $configure_input" ;;
  6157. --- 1747,1753 ----
  6158.     esac
  6159.     echo creating "$ac_file"
  6160.     rm -f "$ac_file"
  6161. !   configure_input="Generated automatically from `/bin/echo $ac_file_in|sed 's%.*/%%'` by configure."
  6162.     case "$ac_file" in
  6163.     *Makefile*) ac_comsub="1i\\
  6164.   # $configure_input" ;;
  6165. ***************
  6166. *** 1776,1783 ****
  6167.   for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
  6168.     # Support "outfile[:infile]", defaulting infile="outfile.in".
  6169.     case "$ac_file" in
  6170. !   *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
  6171. !        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  6172.     *) ac_file_in="${ac_file}.in" ;;
  6173.     esac
  6174.   
  6175. --- 1785,1792 ----
  6176.   for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
  6177.     # Support "outfile[:infile]", defaulting infile="outfile.in".
  6178.     case "$ac_file" in
  6179. !   *:*) ac_file_in=`/bin/echo "$ac_file"|sed 's%.*:%%'`
  6180. !        ac_file=`/bin/echo "$ac_file"|sed 's%:.*%%'` ;;
  6181.     *) ac_file_in="${ac_file}.in" ;;
  6182.     esac
  6183.   
  6184. ***************
  6185. *** 1841,1847 ****
  6186.     cat conftest.in >> conftest.h
  6187.     rm -f conftest.in
  6188.     if cmp -s $ac_file conftest.h 2>/dev/null; then
  6189. !     echo "$ac_file is unchanged"
  6190.       rm -f conftest.h
  6191.     else
  6192.       rm -f $ac_file
  6193. --- 1850,1856 ----
  6194.     cat conftest.in >> conftest.h
  6195.     rm -f conftest.in
  6196.     if cmp -s $ac_file conftest.h 2>/dev/null; then
  6197. !     /bin/echo "$ac_file is unchanged"
  6198.       rm -f conftest.h
  6199.     else
  6200.       rm -f $ac_file
  6201. ***************
  6202. *** 1873,1885 ****
  6203.   
  6204.     # Make relative symlinks.
  6205.     # Remove last slash and all that follows it.  Not all systems have dirname.
  6206. !   ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
  6207.     if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
  6208.       # The dest file is in a subdirectory.
  6209.       test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
  6210.       ac_dest_dir_suffix="/$ac_dest_dir"
  6211.       # A "../" for each directory in $ac_dest_dir_suffix.
  6212. !     ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
  6213.     else
  6214.       ac_dest_dir_suffix= ac_dots=
  6215.     fi
  6216. --- 1882,1894 ----
  6217.   
  6218.     # Make relative symlinks.
  6219.     # Remove last slash and all that follows it.  Not all systems have dirname.
  6220. !   ac_dest_dir=`/bin/echo $ac_dest|sed 's%/[^/][^/]*$%%'`
  6221.     if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
  6222.       # The dest file is in a subdirectory.
  6223.       test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
  6224.       ac_dest_dir_suffix="/$ac_dest_dir"
  6225.       # A "../" for each directory in $ac_dest_dir_suffix.
  6226. !     ac_dots=`/bin/echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
  6227.     else
  6228.       ac_dest_dir_suffix= ac_dots=
  6229.     fi
  6230. ***************
  6231. *** 1890,1897 ****
  6232.     esac
  6233.   
  6234.     # Make a symlink if possible; otherwise try a hard link.
  6235. !   if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
  6236. !     ln $srcdir/$ac_source $ac_dest; then :
  6237.     else
  6238.       { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
  6239.     fi
  6240. --- 1899,1908 ----
  6241.     esac
  6242.   
  6243.     # Make a symlink if possible; otherwise try a hard link.
  6244. !   # On the Amiga, we instead try a hard link first and then
  6245. !   # just do a cp, since symbolic links still have rough edges.
  6246. !   if ln $ac_rel_source $ac_dest 2>/dev/null ||
  6247. !     cp -p $srcdir/$ac_source $ac_dest; then :
  6248.     else
  6249.       { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
  6250.     fi
  6251. diff -rc --new-file binutils-2.5.2-base/gas/configure.in binutils-2.5.2/gas/configure.in
  6252. *** binutils-2.5.2-base/gas/configure.in    Tue Nov  1 23:17:54 1994
  6253. --- binutils-2.5.2/gas/configure.in    Fri Feb 10 15:43:32 1995
  6254. ***************
  6255. *** 39,44 ****
  6256. --- 39,45 ----
  6257.     m683??)       cpu_type=m68k ;;
  6258.   changequote([,])dnl
  6259.     m8*)        cpu_type=m88k ;;
  6260. +   m68*)        cpu_type=m68k ;;
  6261.     mips*el)    cpu_type=mips endian=little;;
  6262.     mips*)    cpu_type=mips endian=big ;;
  6263.     powerpc*)    cpu_type=ppc ;;
  6264. ***************
  6265. *** 109,115 ****
  6266.     i960-*-vxworks5.*)    obj_format=coff emulation=ic960 gas_target=ic960coff ;;
  6267.     i960-*-vxworks*)    obj_format=bout ;;
  6268.   
  6269. !   m68k-wrs-vxworks | m68k-ericsson-ose | m68k-*-sunos*)
  6270.               obj_format=aout emulation=sun3 ;;
  6271.     m68k-motorola-sysv)    obj_format=coff gas_target=m68kcoff emulation=delta ;;
  6272.     m68k-bull-sysv3*)    obj_format=coff gas_target=m68kcoff emulation=dpx2 ;;
  6273. --- 110,116 ----
  6274.     i960-*-vxworks5.*)    obj_format=coff emulation=ic960 gas_target=ic960coff ;;
  6275.     i960-*-vxworks*)    obj_format=bout ;;
  6276.   
  6277. !   m68k-wrs-vxworks | m68k-ericsson-ose | m68k-*-sunos* | m68*-cbm-amigados*)
  6278.               obj_format=aout emulation=sun3 ;;
  6279.     m68k-motorola-sysv)    obj_format=coff gas_target=m68kcoff emulation=delta ;;
  6280.     m68k-bull-sysv3*)    obj_format=coff gas_target=m68kcoff emulation=dpx2 ;;
  6281. diff -rc --new-file binutils-2.5.2-base/ld/Makefile.in binutils-2.5.2/ld/Makefile.in
  6282. *** binutils-2.5.2-base/ld/Makefile.in    Wed Oct 19 18:36:47 1994
  6283. --- binutils-2.5.2/ld/Makefile.in    Sun Feb 12 22:20:00 1995
  6284. ***************
  6285. *** 21,27 ****
  6286.   srcdir = .
  6287.   objdir = .
  6288.   
  6289. ! prefix = /usr/local
  6290.   
  6291.   program_transform_name =
  6292.   exec_prefix = $(prefix)
  6293. --- 21,27 ----
  6294.   srcdir = .
  6295.   objdir = .
  6296.   
  6297. ! prefix = /gnu
  6298.   
  6299.   program_transform_name =
  6300.   exec_prefix = $(prefix)
  6301. ***************
  6302. *** 58,64 ****
  6303.   AR = ar
  6304.   AR_FLAGS = qv
  6305.   CC = cc
  6306. ! CFLAGS = -g
  6307.   MAKEINFO = makeinfo
  6308.   TEXI2DVI = texi2dvi
  6309.   RANLIB = ranlib
  6310. --- 58,64 ----
  6311.   AR = ar
  6312.   AR_FLAGS = qv
  6313.   CC = cc
  6314. ! CFLAGS = -O2
  6315.   MAKEINFO = makeinfo
  6316.   TEXI2DVI = texi2dvi
  6317.   RANLIB = ranlib
  6318. ***************
  6319. *** 66,72 ****
  6320.   BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
  6321.   LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ;  else echo flex ; fi`
  6322.   
  6323. ! # Seach path to override the default search path for -lfoo libraries.
  6324.   # If LIB_PATH is empty, the ones in the script (if any) are left alone.
  6325.   # (The default is usually /lib:usr/lib:/usr/local/lib, unless building
  6326.   # a cross-linker, in which case the default is empty.  See genscripts.sh.)
  6327. --- 66,72 ----
  6328.   BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
  6329.   LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ;  else echo flex ; fi`
  6330.   
  6331. ! # Search path to override the default search path for -lfoo libraries.
  6332.   # If LIB_PATH is empty, the ones in the script (if any) are left alone.
  6333.   # (The default is usually /lib:usr/lib:/usr/local/lib, unless building
  6334.   # a cross-linker, in which case the default is empty.  See genscripts.sh.)
  6335. ***************
  6336. *** 203,209 ****
  6337.       ehppaelf.o emipsidtl.o esh.o eelf_i386.o ealpha.o \
  6338.       ei386lynx.o em68klynx.o esparclynx.o ecoff_sparc.o \
  6339.       eelf32ppc.o ei386go32.o em68kaout.o ei386linux.o \
  6340. !     eelf32_sparc.o eelf64_sparc.o eriscix.o eelf32bmip.o eelf32lmip.o
  6341.   
  6342.   CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \
  6343.       ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \
  6344. --- 203,210 ----
  6345.       ehppaelf.o emipsidtl.o esh.o eelf_i386.o ealpha.o \
  6346.       ei386lynx.o em68klynx.o esparclynx.o ecoff_sparc.o \
  6347.       eelf32ppc.o ei386go32.o em68kaout.o ei386linux.o \
  6348. !     eelf32_sparc.o eelf64_sparc.o eriscix.o eelf32bmip.o eelf32lmip.o\
  6349. !     eamiga.o eamiga_bss.o
  6350.   
  6351.   CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \
  6352.       ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \
  6353. ***************
  6354. *** 271,279 ****
  6355.   
  6356.   # These all start with e so 'make clean' can find them.
  6357.   
  6358. ! GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} ${host_alias} ${target_alias} ${EMUL} "$(NATIVE_LIB_DIRS)"
  6359.   GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed
  6360.   
  6361.   esun4.c: $(srcdir)/emulparams/sun4.sh \
  6362.     $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
  6363.       ${GENSCRIPTS} sun4
  6364. --- 272,286 ----
  6365.   
  6366.   # These all start with e so 'make clean' can find them.
  6367.   
  6368. ! GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} ${host_alias} ${target_alias} ${EMUL} "$(NATIVE_LIB_DIRS)" "$(LIB_PATH)"
  6369.   GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed
  6370.   
  6371. + eamiga.c: $(srcdir)/emulparams/amiga.sh\
  6372. +    $(srcdir)/emultempl/amiga.em $(srcdir)/scripttempl/amiga.sc ${GEN_DEPENDS} 
  6373. +     ${GENSCRIPTS} amiga
  6374. + eamiga_bss.c: $(srcdir)/emulparams/amiga_bss.sh\
  6375. +    $(srcdir)/emultempl/amiga.em $(srcdir)/scripttempl/amiga_bss.sc ${GEN_DEPENDS}
  6376. +     ${GENSCRIPTS} amiga_bss
  6377.   esun4.c: $(srcdir)/emulparams/sun4.sh \
  6378.     $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
  6379.       ${GENSCRIPTS} sun4
  6380. diff -rc --new-file binutils-2.5.2-base/ld/config/amigados.mh binutils-2.5.2/ld/config/amigados.mh
  6381. *** binutils-2.5.2-base/ld/config/amigados.mh    Thu Jan  1 00:00:00 1970
  6382. --- binutils-2.5.2/ld/config/amigados.mh    Sun Feb 12 22:23:28 1995
  6383. ***************
  6384. *** 0 ****
  6385. --- 1,24 ----
  6386. + # Host: Commodore Amiga running AmigaDOS.
  6387. + NAT_FILE= nm-amigados.h
  6388. + NATDEPFILES=
  6389. + XDEPFILES=
  6390. + XM_FILE= xm-amigados.h
  6391. + REGEX=regex.o
  6392. + REGEX1=regex.o
  6393. + # Use GNU C compiler
  6394. + CC = gcc
  6395. + # Use GNU install
  6396. + INSTALL = /bin/install -c
  6397. + # Don't use the mmalloc library, there is no sbrk() or mmap().
  6398. + MMALLOC=
  6399. + MMALLOC_DISABLE = -DNO_MMALLOC
  6400. + # Host makefile fragment for Commodore Amiga running AmigaDOS
  6401. + # Use the GNU C compiler.
  6402. + CC=gcc
  6403. + # Don't use -g, it doesn't do anything useful yet.  Optimize though.
  6404. + CFLAGS=-O2
  6405. + # Search /local/os-lib, /local/lib, $(exec_prefix)/os-lib, and
  6406. + # $(exec_prefix)/lib, in that order.  I.E. user installed libraries
  6407. + # take precedence over ones supplied with the compiler kit, and OS
  6408. + # libraries take precedence over non-OS ones.
  6409. + LIB_PATH=/local/os-lib:/local/lib:$(exec_prefix)/os-lib:$(exec_prefix)/lib
  6410. diff -rc --new-file binutils-2.5.2-base/ld/config/amigados.mt binutils-2.5.2/ld/config/amigados.mt
  6411. *** binutils-2.5.2-base/ld/config/amigados.mt    Thu Jan  1 00:00:00 1970
  6412. --- binutils-2.5.2/ld/config/amigados.mt    Fri Feb 10 14:29:46 1995
  6413. ***************
  6414. *** 0 ****
  6415. --- 1,9 ----
  6416. + # Target: Commodore Amiga running AmigaDOS
  6417. + TDEPFILES= m68k-pinsn.o exec.o m68k-tdep.o
  6418. + TM_FILE= tm-amigados.h
  6419. + EMUL=amiga
  6420. + EMUL_EXTRA=amiga_bss
  6421. + # Target config file for Commodore Amiga running AmigaDOS
  6422. + DEFAULT_VECTOR=amiga_vec
  6423. + SELECT_VECS=aout_amiga_vec
  6424. + SELECT_ARCHITECTURES=bfd_m68k_arch
  6425. diff -rc --new-file binutils-2.5.2-base/ld/configure.in binutils-2.5.2/ld/configure.in
  6426. *** binutils-2.5.2-base/ld/configure.in    Fri Oct 21 22:19:47 1994
  6427. --- binutils-2.5.2/ld/configure.in    Fri Feb 10 14:29:46 1995
  6428. ***************
  6429. *** 94,99 ****
  6430. --- 94,100 ----
  6431.     m68*-*-coff)        ld_target=m68k-coff ;;
  6432.     m68*-*-hpux*)        ld_target=hp300hpux ;;
  6433.     m68*-*-lynxos*)    ld_target=m68k-lynx ;;
  6434. +   m68*-cbm-amigados*)    ld_target=amigados ;;
  6435.     m68*-*-*)
  6436.       echo '***' "Unknown m68k target vendor for ld:" ${target_vendor} 1>&2
  6437.               exit 1 ;;
  6438. diff -rc --new-file binutils-2.5.2-base/ld/emulparams/amiga.sh binutils-2.5.2/ld/emulparams/amiga.sh
  6439. *** binutils-2.5.2-base/ld/emulparams/amiga.sh    Thu Jan  1 00:00:00 1970
  6440. --- binutils-2.5.2/ld/emulparams/amiga.sh    Fri Feb 10 14:29:48 1995
  6441. ***************
  6442. *** 0 ****
  6443. --- 1,8 ----
  6444. + SCRIPT_NAME=amiga
  6445. + OUTPUT_FORMAT="amiga"
  6446. + TEXT_START_ADDR=0x400
  6447. + PAGE_SIZE=0x400
  6448. + SEGMENT_SIZE=0x400
  6449. + NONPAGED_TEXT_START_ADDR=0x400
  6450. + TEMPLATE_NAME=amiga
  6451. + ARCH=m68k
  6452. diff -rc --new-file binutils-2.5.2-base/ld/emulparams/amiga_bss.sh binutils-2.5.2/ld/emulparams/amiga_bss.sh
  6453. *** binutils-2.5.2-base/ld/emulparams/amiga_bss.sh    Thu Jan  1 00:00:00 1970
  6454. --- binutils-2.5.2/ld/emulparams/amiga_bss.sh    Fri Feb 10 14:29:50 1995
  6455. ***************
  6456. *** 0 ****
  6457. --- 1,8 ----
  6458. + SCRIPT_NAME=amiga_bss
  6459. + OUTPUT_FORMAT="amiga"
  6460. + TEXT_START_ADDR=0x400
  6461. + PAGE_SIZE=0x400
  6462. + SEGMENT_SIZE=0x400
  6463. + NONPAGED_TEXT_START_ADDR=0x400
  6464. + TEMPLATE_NAME=amiga
  6465. + ARCH=m68k
  6466. diff -rc --new-file binutils-2.5.2-base/ld/emultempl/amiga.em binutils-2.5.2/ld/emultempl/amiga.em
  6467. *** binutils-2.5.2-base/ld/emultempl/amiga.em    Thu Jan  1 00:00:00 1970
  6468. --- binutils-2.5.2/ld/emultempl/amiga.em    Fri Feb 10 14:29:50 1995
  6469. ***************
  6470. *** 0 ****
  6471. --- 1,168 ----
  6472. + # This shell script emits a C file. -*- C -*-
  6473. + # It does some substitutions.
  6474. + cat >e${EMULATION_NAME}.c <<EOF
  6475. + /* This file is is generated by a shell script.  DO NOT EDIT! */
  6476. + /* emulate the original gld for the given ${EMULATION_NAME}
  6477. +    Copyright (C) 1991, 1993 Free Software Foundation, Inc.
  6478. +    Written by Steve Chamberlain steve@cygnus.com
  6479. + This file is part of GLD, the Gnu Linker.
  6480. + This program is free software; you can redistribute it and/or modify
  6481. + it under the terms of the GNU General Public License as published by
  6482. + the Free Software Foundation; either version 2 of the License, or
  6483. + (at your option) any later version.
  6484. + This program is distributed in the hope that it will be useful,
  6485. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  6486. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6487. + GNU General Public License for more details.
  6488. + You should have received a copy of the GNU General Public License
  6489. + along with this program; if not, write to the Free Software
  6490. + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  6491. + #define TARGET_IS_${EMULATION_NAME}
  6492. + #include "bfd.h"
  6493. + #include "sysdep.h"
  6494. + #include "bfdlink.h"
  6495. + #include "ld.h"
  6496. + #include "config.h"
  6497. + #include "ldmain.h"
  6498. + #include "ldemul.h"
  6499. + #include "ldfile.h"
  6500. + #include "ldmisc.h"
  6501. + #include "ldexp.h"
  6502. + #include "ldlang.h"
  6503. + #ifdef TARGET_IS_amiga
  6504. + #include "libamiga.h"
  6505. + #else
  6506. + extern int amiga_base_relative; /* defined in amigadoslink.c */
  6507. + #endif
  6508. + /* This is defined in bfd/amigados.c */
  6509. + /* 1 means, write out debug hunk, when producing a load file */
  6510. + extern int write_debug_hunk;
  6511. + /* This is the attribute to use for the next file */
  6512. + extern int amiga_attribute;
  6513. + static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
  6514. + static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
  6515. + static void
  6516. + gld${EMULATION_NAME}_before_parse()
  6517. + {
  6518. + #ifdef TARGET_IS_amiga_bss
  6519. +   amiga_base_relative=1;
  6520. + #endif
  6521. + #ifndef TARGET_            /* I.e., if not generic.  */
  6522. +   ldfile_output_architecture = bfd_arch_${ARCH};
  6523. + #endif /* not TARGET_ */
  6524. + }
  6525. + #ifdef TARGET_IS_amiga
  6526. + static void
  6527. +  amiga_assign_attribute(lang_input_statement_type *);
  6528. + void
  6529. + amiga_after_allocation()
  6530. + {
  6531. + #if 0 /* Does not work at the moment */
  6532. +   lang_for_each_input_file (amiga_assign_attribute);
  6533. + #endif
  6534. + }
  6535. + static void
  6536. + amiga_assign_attribute(inp)
  6537. +      lang_input_statement_type *inp;
  6538. + {
  6539. +   asection *s;
  6540. +   if (inp->the_bfd->xvec->flavour==bfd_target_amiga_flavour)
  6541. +     {
  6542. +       for (s=inp->the_bfd->sections;s!=NULL;s=s->next)
  6543. +     amiga_per_section(s)->attribute=inp->amiga_attribute;
  6544. +     }
  6545. + }
  6546. + #else
  6547. + extern void
  6548. + amiga_after_allocation();
  6549. + #endif
  6550. + static char *
  6551. + gld${EMULATION_NAME}_get_script(isfile)
  6552. +      int *isfile;
  6553. + EOF
  6554. + if test -n "$COMPILE_IN"
  6555. + then
  6556. + # Scripts compiled in.
  6557. + # sed commands to quote an ld script as a C string.
  6558. + sc="-f ${srcdir}/emultempl/stringify.sed"
  6559. + cat >>e${EMULATION_NAME}.c <<EOF
  6560. + {                 
  6561. +   *isfile = 0;
  6562. +   if (link_info.relocateable == true && config.build_constructors == true)
  6563. +     return
  6564. + EOF
  6565. + sed $sc ldscripts/${EMULATION_NAME}.xu                     >> e${EMULATION_NAME}.c
  6566. + echo '  ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
  6567. + sed $sc ldscripts/${EMULATION_NAME}.xr                     >> e${EMULATION_NAME}.c
  6568. + echo '  ; else if (!config.text_read_only) return'         >> e${EMULATION_NAME}.c
  6569. + sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
  6570. + echo '  ; else if (!config.magic_demand_paged) return'     >> e${EMULATION_NAME}.c
  6571. + sed $sc ldscripts/${EMULATION_NAME}.xn                     >> e${EMULATION_NAME}.c
  6572. + echo '  ; else return'                                     >> e${EMULATION_NAME}.c
  6573. + sed $sc ldscripts/${EMULATION_NAME}.x                      >> e${EMULATION_NAME}.c
  6574. + echo '; }'                                                 >> e${EMULATION_NAME}.c
  6575. + else
  6576. + # Scripts read from the filesystem.
  6577. + cat >>e${EMULATION_NAME}.c <<EOF
  6578. + {                 
  6579. +   *isfile = 1;
  6580. +   if (link_info.relocateable == true && config.build_constructors == true)
  6581. +     return "ldscripts/${EMULATION_NAME}.xu";
  6582. +   else if (link_info.relocateable == true)
  6583. +     return "ldscripts/${EMULATION_NAME}.xr";
  6584. +   else if (!config.text_read_only)
  6585. +     return "ldscripts/${EMULATION_NAME}.xbn";
  6586. +   else if (!config.magic_demand_paged)
  6587. +     return "ldscripts/${EMULATION_NAME}.xn";
  6588. +   else
  6589. +     return "ldscripts/${EMULATION_NAME}.x";
  6590. + }
  6591. + EOF
  6592. + fi
  6593. + cat >>e${EMULATION_NAME}.c <<EOF
  6594. + struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = 
  6595. + {
  6596. +   gld${EMULATION_NAME}_before_parse,
  6597. +   syslib_default,
  6598. +   hll_default,
  6599. +   after_parse_default,
  6600. +   amiga_after_allocation,
  6601. +   set_output_arch_default,
  6602. +   ldemul_default_target,
  6603. +   before_allocation_default,
  6604. +   gld${EMULATION_NAME}_get_script,
  6605. +   "${EMULATION_NAME}",
  6606. +   "${OUTPUT_FORMAT}"
  6607. + };
  6608. + EOF
  6609. diff -rc --new-file binutils-2.5.2-base/ld/genscripts.sh binutils-2.5.2/ld/genscripts.sh
  6610. *** binutils-2.5.2-base/ld/genscripts.sh    Mon Sep 26 18:00:13 1994
  6611. --- binutils-2.5.2/ld/genscripts.sh    Sun Feb 12 22:31:44 1995
  6612. ***************
  6613. *** 15,21 ****
  6614.   target_alias=$4
  6615.   DEFAULT_EMULATION=$5
  6616.   NATIVE_LIB_DIRS=$6
  6617. ! EMULATION_NAME=$7
  6618.   
  6619.   # Include the emulation-specific parameters:
  6620.   . ${srcdir}/emulparams/${EMULATION_NAME}.sh
  6621. --- 15,22 ----
  6622.   target_alias=$4
  6623.   DEFAULT_EMULATION=$5
  6624.   NATIVE_LIB_DIRS=$6
  6625. ! LIB_PATH=$7
  6626. ! EMULATION_NAME=$8
  6627.   
  6628.   # Include the emulation-specific parameters:
  6629.   . ${srcdir}/emulparams/${EMULATION_NAME}.sh
  6630. diff -rc --new-file binutils-2.5.2-base/ld/ldlang.c binutils-2.5.2/ld/ldlang.c
  6631. *** binutils-2.5.2-base/ld/ldlang.c    Tue Sep 20 21:15:58 1994
  6632. --- binutils-2.5.2/ld/ldlang.c    Fri Feb 10 14:29:52 1995
  6633. ***************
  6634. *** 296,301 ****
  6635. --- 296,302 ----
  6636.        boolean add_to_list;
  6637.   {
  6638.     lang_input_statement_type *p;
  6639. +   extern int amiga_attribute;
  6640.   
  6641.     if (add_to_list)
  6642.       p = new_stat (lang_input_statement, stat_ptr);
  6643. ***************
  6644. *** 309,314 ****
  6645. --- 310,318 ----
  6646.     lang_has_input_file = true;
  6647.     p->target = target;
  6648.     p->complained = false;
  6649. +   p->amiga_attribute=amiga_attribute; /* Amiga section attribute */
  6650. +   amiga_attribute=0; /* reset it */
  6651.     switch (file_type)
  6652.       {
  6653.       case lang_input_file_is_symbols_only_enum:
  6654. diff -rc --new-file binutils-2.5.2-base/ld/ldlang.h binutils-2.5.2/ld/ldlang.h
  6655. *** binutils-2.5.2-base/ld/ldlang.h    Tue Sep 20 21:16:01 1994
  6656. --- binutils-2.5.2/ld/ldlang.h    Fri Feb 10 14:29:54 1995
  6657. ***************
  6658. *** 229,234 ****
  6659. --- 229,236 ----
  6660.     asection *common_section;
  6661.     asection *common_output_section;
  6662.     boolean complained;
  6663. +   /* Added for AMIGA support of section attributes */
  6664. +   int amiga_attribute;
  6665.   } lang_input_statement_type;
  6666.   
  6667.   typedef struct
  6668. diff -rc --new-file binutils-2.5.2-base/ld/ldmain.c binutils-2.5.2/ld/ldmain.c
  6669. *** binutils-2.5.2-base/ld/ldmain.c    Wed Oct 26 05:23:55 1994
  6670. --- binutils-2.5.2/ld/ldmain.c    Tue Feb 14 18:53:44 1995
  6671. ***************
  6672. *** 45,50 ****
  6673. --- 45,54 ----
  6674.   
  6675.   #include <string.h>
  6676.   
  6677. + #ifndef __amigados__
  6678. + #define HAVE_SBRK
  6679. + #endif
  6680.   static char *get_emulation PARAMS ((int, char **));
  6681.   static void set_scripts_dir PARAMS ((void));
  6682.   
  6683. ***************
  6684. *** 319,331 ****
  6685. --- 323,339 ----
  6686.     if (config.stats)
  6687.       {
  6688.         extern char **environ;
  6689. + #ifdef HAVE_SBRK
  6690.         char *lim = (char *) sbrk (0);
  6691. + #endif
  6692.         long run_time = get_run_time () - start_time;
  6693.   
  6694.         fprintf (stderr, "%s: total time in link: %ld.%06ld\n",
  6695.              program_name, run_time / 1000000, run_time % 1000000);
  6696. + #ifdef HAVE_SBRK
  6697.         fprintf (stderr, "%s: data size %ld\n", program_name,
  6698.              (long) (lim - (char *) &environ));
  6699. + #endif
  6700.       }
  6701.   
  6702.     /* Prevent remove_output from doing anything, after a successful link.  */
  6703. diff -rc --new-file binutils-2.5.2-base/ld/lexsup.c binutils-2.5.2/ld/lexsup.c
  6704. *** binutils-2.5.2-base/ld/lexsup.c    Wed Oct 12 20:26:42 1994
  6705. --- binutils-2.5.2/ld/lexsup.c    Fri Feb 10 14:29:56 1995
  6706. ***************
  6707. *** 46,51 ****
  6708. --- 46,55 ----
  6709.   static void set_default_dirlist PARAMS ((char *dirlist_ptr));
  6710.   static void set_section_start PARAMS ((char *sect, char *valstr));
  6711.   
  6712. + /* Used by AMIGA linker */
  6713. + extern int write_debug_hunk;
  6714. + extern int amiga_attribute;
  6715.   void
  6716.   parse_args (argc, argv)
  6717.        int argc;
  6718. ***************
  6719. *** 91,101 ****
  6720. --- 95,113 ----
  6721.   #define OPTION_VERSION            (OPTION_VERBOSE + 1)
  6722.   #define OPTION_WARN_COMMON        (OPTION_VERSION + 1)
  6723.   #define OPTION_WARN_ONCE        (OPTION_WARN_COMMON + 1)
  6724. + /* These are added for AMIGA support of special features, like memory attributes and debug hunk*/
  6725. + #define OPTION_AMIGA_CHIP               (OPTION_WARN_ONCE + 1)
  6726. + #define OPTION_AMIGA_FAST               (OPTION_AMIGA_CHIP + 1)
  6727. + #define OPTION_AMIGA_ATTRIBUTE          (OPTION_AMIGA_FAST + 1)
  6728. + #define OPTION_AMIGA_DEBUG              (OPTION_AMIGA_ATTRIBUTE + 1)
  6729.   
  6730.     static struct option longopts[] = {
  6731. +     {"amiga-debug-hunk", no_argument, NULL, OPTION_AMIGA_DEBUG},
  6732. +     {"attribute", required_argument, NULL, OPTION_AMIGA_ATTRIBUTE},
  6733.       {"Bdynamic", no_argument, NULL, OPTION_CALL_SHARED},
  6734.       {"Bstatic", no_argument, NULL, OPTION_NON_SHARED},
  6735.       {"call_shared", no_argument, NULL, OPTION_CALL_SHARED},
  6736. +     {"chip", no_argument, NULL, OPTION_AMIGA_CHIP},
  6737.       {"dc", no_argument, NULL, 'd'},
  6738.       {"defsym", required_argument, NULL, OPTION_DEFSYM},
  6739.       {"dll-verbose", no_argument, NULL, OPTION_VERSION}, /* Linux.  */
  6740. ***************
  6741. *** 106,111 ****
  6742. --- 118,124 ----
  6743.       {"EB", no_argument, NULL, OPTION_EB},
  6744.       {"EL", no_argument, NULL, OPTION_EL},
  6745.       {"end-group", no_argument, NULL, ')'},
  6746. +     {"fast", no_argument, NULL, OPTION_AMIGA_FAST},
  6747.       {"format", required_argument, NULL, 'b'},
  6748.       {"help", no_argument, NULL, OPTION_HELP},
  6749.       {"Map", required_argument, NULL, OPTION_MAP},
  6750. ***************
  6751. *** 420,425 ****
  6752. --- 433,455 ----
  6753.           }
  6754.         lang_leave_group ();
  6755.         ingroup = 0;
  6756. +       break;
  6757. +     case OPTION_AMIGA_CHIP:
  6758. +       amiga_attribute=2; /* We do not use MEMF_FAST, so we do not have to include exec/memory.h*/
  6759. +       break;
  6760. +     case OPTION_AMIGA_FAST:
  6761. +       amiga_attribute=4;
  6762. +       break;
  6763. +     case OPTION_AMIGA_ATTRIBUTE:
  6764. +       {
  6765. +         char *end;
  6766. +         amiga_attribute = strtoul (optarg, &end, 0);
  6767. +         if (*end)
  6768. +           einfo ("%P%F: invalid number `%s'\n", optarg);
  6769. +       }
  6770. +       break;
  6771. +     case OPTION_AMIGA_DEBUG:
  6772. +       write_debug_hunk=1; /* Write out debug hunk */
  6773.         break;
  6774.       }
  6775.       }
  6776. diff -rc --new-file binutils-2.5.2-base/ld/scripttempl/amiga.sc binutils-2.5.2/ld/scripttempl/amiga.sc
  6777. *** binutils-2.5.2-base/ld/scripttempl/amiga.sc    Thu Jan  1 00:00:00 1970
  6778. --- binutils-2.5.2/ld/scripttempl/amiga.sc    Fri Feb 10 14:29:58 1995
  6779. ***************
  6780. *** 0 ****
  6781. --- 1,42 ----
  6782. + cat <<EOF
  6783. + OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  6784. + OUTPUT_ARCH(${ARCH})
  6785. + ${RELOCATING+${LIB_SEARCH_DIRS}}
  6786. + ${STACKZERO+${RELOCATING+${STACKZERO}}}
  6787. + ${SHLIB_PATH+${RELOCATING+${SHLIB_PATH}}}
  6788. + SECTIONS
  6789. + {
  6790. +   ${RELOCATING+. = ${TEXT_START_ADDR};}
  6791. +   .text :
  6792. +   {
  6793. +     ${RELOCATING+___machtype = ABSOLUTE(0x0);}
  6794. +     ${RELOCATING+_stext = .;}
  6795. +     *(.text)
  6796. +     ${RELOCATING+_etext = .;}
  6797. +     ${RELOCATING+__etext = .;}
  6798. +     ${RELOCATING+___text_size = ABSOLUTE(_etext - _stext);}
  6799. +     ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}}
  6800. +   }
  6801. +   ${RELOCATING+. = ${DATA_ALIGNMENT};}
  6802. +   .data :
  6803. +   {
  6804. +     ${RELOCATING+_sdata = .;}
  6805. +     ${CONSTRUCTING+CONSTRUCTORS}
  6806. +     *(.data)
  6807. +     ${RELOCATING+_edata  =  .;}
  6808. +     ${RELOCATING+__edata  =  .;}
  6809. +     ${RELOCATING+___data_size = ABSOLUTE(_edata - _sdata);}
  6810. +   }
  6811. +   .bss :
  6812. +   {
  6813. +    ${RELOCATING+ __bss_start = .};
  6814. +    *(.bss)
  6815. +    *(COMMON)
  6816. +    ${RELOCATING+_end = ALIGN(4) };
  6817. +    ${RELOCATING+__end = ALIGN(4) };
  6818. +    ${RELOCATING+___bss_size = ABSOLUTE(_end - __bss_start);}
  6819. +   }
  6820. + }
  6821. + EOF
  6822. diff -rc --new-file binutils-2.5.2-base/ld/scripttempl/amiga_bss.sc binutils-2.5.2/ld/scripttempl/amiga_bss.sc
  6823. *** binutils-2.5.2-base/ld/scripttempl/amiga_bss.sc    Thu Jan  1 00:00:00 1970
  6824. --- binutils-2.5.2/ld/scripttempl/amiga_bss.sc    Fri Feb 10 14:29:58 1995
  6825. ***************
  6826. *** 0 ****
  6827. --- 1,43 ----
  6828. + cat <<EOF
  6829. + OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  6830. + OUTPUT_ARCH(${ARCH})
  6831. + ${RELOCATING+${LIB_SEARCH_DIRS}}
  6832. + ${STACKZERO+${RELOCATING+${STACKZERO}}}
  6833. + ${SHLIB_PATH+${RELOCATING+${SHLIB_PATH}}}
  6834. + SECTIONS
  6835. + {
  6836. +   ${RELOCATING+. = ${TEXT_START_ADDR};}
  6837. +   .text :
  6838. +   {
  6839. +     ${RELOCATING+___machtype = ABSOLUTE(0x0);}
  6840. +     ${RELOCATING+_stext = .;}
  6841. +     *(.text)
  6842. +     ${RELOCATING+_etext = .;}
  6843. +     ${RELOCATING+__etext = .;}
  6844. +     ${RELOCATING+___text_size = ABSOLUTE(_etext - _stext);}
  6845. +     ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}}
  6846. +   }
  6847. +   ${RELOCATING+. = ${DATA_ALIGNMENT};}
  6848. +   .data :
  6849. +   {
  6850. +     ${RELOCATING+_sdata = .;}
  6851. +     ${CONSTRUCTING+CONSTRUCTORS}
  6852. +     *(.data)
  6853. +     ${RELOCATING+_edata  =  .;}
  6854. +     ${RELOCATING+__edata  =  .;}
  6855. +     ${RELOCATING+___data_size = ABSOLUTE(_edata - _sdata);}
  6856. +     ${RELOCATING+___bss_size = ABSOLUTE(_end - __bss_start);}
  6857. +     ${RELOCATING+___a4_init = (ABSOLUTE(ABSOLUTE(___data_size) + ABSOLUTE(___bss_size)) > ABSOLUTE(0x7fff)) ? 0x0 : 0x8000 ;}
  6858. +   }
  6859. +   .bss :
  6860. +   {
  6861. +     ${RELOCATING+ __bss_start = .};
  6862. +     *(.bss)
  6863. +     *(COMMON)
  6864. +     ${RELOCATING+_end = ALIGN(4) };
  6865. +     ${RELOCATING+__end = ALIGN(4) };
  6866. +   }
  6867. + }
  6868. + EOF
  6869. diff -rc --new-file binutils-2.5.2-base/libiberty/config/mh-amigados binutils-2.5.2/libiberty/config/mh-amigados
  6870. *** binutils-2.5.2-base/libiberty/config/mh-amigados    Thu Jan  1 00:00:00 1970
  6871. --- binutils-2.5.2/libiberty/config/mh-amigados    Tue Feb 14 18:49:48 1995
  6872. ***************
  6873. *** 0 ****
  6874. --- 1,15 ----
  6875. + # Host configuration for Commodore Amiga running AmigaDOS.
  6876. + # We don't actually use libmmalloc.a, since there is no sbrk(),
  6877. + # but this allows us to compile it (and then ignore it).
  6878. + CC=gcc
  6879. + # We don't need -g yet, so do -O instead.
  6880. + CFLAGS=-O
  6881. + MMALLOC=
  6882. + MMALLOC_DISABLE = -DNO_MMALLOC
  6883. + # Host makefile fragment for Commodore Amiga running AmigaDOS.
  6884. + # There is no standard system compiler.  Assume use GNU C.
  6885. + CC = gcc
  6886. + # There is no support for -g yet.  But use -O2 instead.
  6887. + CFLAGS = -O2
  6888. diff -rc --new-file binutils-2.5.2-base/libiberty/config.table binutils-2.5.2/libiberty/config.table
  6889. *** binutils-2.5.2-base/libiberty/config.table    Mon Sep  5 10:52:49 1994
  6890. --- binutils-2.5.2/libiberty/config.table    Fri Feb 10 14:30:00 1995
  6891. ***************
  6892. *** 22,27 ****
  6893. --- 22,28 ----
  6894.     *-*-sysv4*)        frag=mh-sysv4 ;;
  6895.     *-*-sysv*)        frag=mh-sysv ;;
  6896.     *-*-go32)        frag=mh-go32 ;;
  6897. +   *-*-amigados*)    frag=mh-amigados ;;
  6898.   esac
  6899.   
  6900.   # xiberty sets xhost.  Try to handle funky case of solaris 2 -> sun 4.
  6901. diff -rc --new-file binutils-2.5.2-base/libiberty/xmalloc.c binutils-2.5.2/libiberty/xmalloc.c
  6902. *** binutils-2.5.2-base/libiberty/xmalloc.c    Wed Sep 14 21:06:41 1994
  6903. --- binutils-2.5.2/libiberty/xmalloc.c    Tue Feb 14 19:23:10 1995
  6904. ***************
  6905. *** 28,33 ****
  6906. --- 28,37 ----
  6907.   #define size_t unsigned long
  6908.   #endif
  6909.   
  6910. + #ifndef __amigados__
  6911. + #define HAVE_SBRK
  6912. + #endif
  6913.   /* For systems with larger pointers than ints, these must be declared.  */
  6914.   PTR malloc PARAMS ((size_t));
  6915.   PTR realloc PARAMS ((PTR, size_t));
  6916. ***************
  6917. *** 42,50 ****
  6918. --- 46,58 ----
  6919.   xmalloc_set_program_name (s)
  6920.        const char *s;
  6921.   {
  6922. + #ifdef HAVE_SBRK
  6923.     name = s;
  6924.     if (first_break == NULL)
  6925.       first_break = (char *) sbrk (0);
  6926. + #else
  6927. +   return;
  6928. + #endif
  6929.   }
  6930.   
  6931.   PTR
  6932. ***************
  6933. *** 58,63 ****
  6934. --- 66,72 ----
  6935.     newmem = malloc (size);
  6936.     if (!newmem)
  6937.       {
  6938. + #ifdef HAVE_SBRK
  6939.         extern char **environ;
  6940.         size_t allocated;
  6941.   
  6942. ***************
  6943. *** 69,74 ****
  6944. --- 78,84 ----
  6945.              "\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n",
  6946.              name, *name ? ": " : "",
  6947.              (unsigned long) size, (unsigned long) allocated);
  6948. + #endif
  6949.         xexit (1);
  6950.       }
  6951.     return (newmem);
  6952. ***************
  6953. *** 89,94 ****
  6954. --- 99,105 ----
  6955.       newmem = realloc (oldmem, size);
  6956.     if (!newmem)
  6957.       {
  6958. + #ifdef HAVE_SBRK
  6959.         extern char **environ;
  6960.         size_t allocated;
  6961.   
  6962. ***************
  6963. *** 100,105 ****
  6964. --- 111,117 ----
  6965.              "\n%s%sCan not reallocate %lu bytes after allocating %lu bytes\n",
  6966.              name, *name ? ": " : "",
  6967.              (unsigned long) size, (unsigned long) allocated);
  6968. + #endif
  6969.         xexit (1);
  6970.       }
  6971.     return (newmem);
  6972.