TODO:
- Should add a -no_fix_prebinding flag to ld(1) so fix_prebinding can be
  built with it.
- MH_BUNDLEs should have a two-level namespace hint table by default or at
  least with MACOSX_DEPLOYMENT_TARGET 10.2 (the -twolevel_namespace_hints flag).
  Note this is only a problem with 10.0 which is NOT a deployment target.
- Test coalesced symbols with -static code gen and with rld()?
- Might be a bug in search_dynamic_libs() if it is searching an archive then
  it does not take into account -all_load or -Objc.
- The sreloc->r_address field is only 24-bits (16 meg) and can overflow
  producing bad relocation entries in the output file.  To test for this a
  handful of checks would need to be added to the *_reloc.c file after
  update_reloc and other files that put out relocation entries.
- The LC_PREBOUND_DYLIB commands do not have the modules used via N_INDR
  symbols marked in the linked_modules bit vector.
- Add check for undefined dyld_stub_binding_helper and __dyld_func_lookup if
  output_for_dyld is set.
- Think about how indirect section would be ordered if allowed.

Build problems:
- For i386 builds with -dynamic -fomit-frame-pointer produces bad code (bug
  #52986)
- For m68k builds -finline-functions crashes the compiler (used in the Makefile
  on the ld_build target).

Changes for the 5.24 release (the cctools-663 release):
- Changed the code in ld.[ch], pass1.c, symbols.c, layout.c and pass2.c for
  the new get_macosx_deployment_target() interface.  Radar bug #5132019.

Changes for the 5.24 release (the cctools-662 release):
- Changed kld so it will propagate the LC_UUID from the last object file being
  linked into the output.  Radar bug #5137807.
  - Changed check_cur_obj() in pass1.c for #ifdef KLD to always clear the
    output_uuid_info to zeros and then if the object file being checked has an
    LC_UUID command copy that into the output_uuid_info.
  - Changed layout() in layout.c for #ifndef KLD so it does not clear the
    output_uuid_info and create the uuid load command if the
    output_uuid_info.uuid_command.cmdsize is non-zero.

Changes for the 5.24 release (the cctools-653 release):
- Backed out the change for Radar bug #4930693 in internal_kld_load() in kld.c
  to #ifdef KLD so that RLD_DEBUG_OUTPUT_FILENAME_flag is always set to 1.  This
  was causing problems the way the prelinked kernel is generated.  Radar bug
  #4930693.
- Updated dylibs.c and pass1.c to handle the LC_REEXPORT_DYLIB load command.
  Radar bug #4986624.

Changes for the 5.24 release (the cctools-651 release):
- Changed pass1() in pass1.c to swap the load command part of load commands
  it doen't look at so when the other code in merge_dylib() in dylibs.c steps
  over them it does not crash.  Radar bug #4953247.

Changes for the 5.24 release (the cctools-650 release):
- Changed internal_kld_load() in kld.c to #ifdef KLD so that
  RLD_DEBUG_OUTPUT_FILENAME_flag is always set to 1.  Radar bug #4930693.

Changes for the 5.24 release (the cctools-649 release):
- Added some checks in generic_reloc.c to cause an error if the r_address field
  were to be truncated.  Radar bug #4921122.
- Fixed an internal error when using -s and a private external symbol is marked
  with REFERENCED_DYNAMICALLY.  The change was in output_merged_symbols() in
  symbols.c to not save a private external that has REFERENCED_DYNAMICALLY set
  so this matches what assign_output_symbol_indexes() did for the -s case and
  does not get the internal error when trying to find the string for this
  symbol.  Radar bug #4885434.

Changes for the 5.24 release (the cctools-639 release):
- Added support for -install_name, -compatibility_version, -current_version
  and -noall_load. Radar bug #4758790

Changes for the 5.24 release (the cctools-636 release):
- Fixed the check added below for warning about shared libraries with no table
  of contents entries to not issue that warning when the shared library does not
  defined any external symbols (which is the case for umbrella's).  Radar bug
  #4733384.

Changes for the 5.24 release (the cctools-634 release):
- Changed check_cur_obj() in pass1.c to add a case statement for
  LC_SEGMENT_SPLIT_INFO and simply ignore it as it is not looked at for linking.
  Also added a warning for shared libraries with no table of contents entries
  saying can't resolve symbols from it.  Radar bug #4695477.

Changes for the 5.24 release (the cctools-633 release):
- Changed indirect_sections.c and pass1.c to deal with the change of type for
  indirect symbols to uint32_t * when ported to 64-bit. Radar bug #4407440.

Changes for the 5.24 release (the cctools-631 release):
- Fixed a bug with the symbol align_to_input_mod() not being defined for RLD
  builds.  The fix was to add #ifdef RLD around it in sections.c.  Radar bug
 #4685060

Changes for the 5.24 release (the cctools-629 release):
- Fixed a bug that did not get the internal alignment correct for fine reloc
  blocks in coalesced sections.  coalesced_section_merge() in
  coalesced_sections.c needed to use the align_to_input_mod() routine that was
  in sections.c instead of calling round() in two places.  Radar bug #4599790.

Changes for the 5.24 release (the cctools-626 release):
- Changed check_cur_obj() in pass1.c to add a case statement for
  LC_CODE_SIGNATURE and simply ignore it as it is not looked at for linking.
  Radar bug #4588023.

Changes for the 5.24 release (the cctools-623 release):
- Changed the Makefile it installs in /usr/bin/ld_classic . Radar bug #4606627.

Changes for the 5.23 release (the cctools-619 release):
- Fixed a bug that caused the "internal error: output_local_symbols()'
  inconsistent local symbol count" when discarding a weak symbol from an object
  file for a symbol in a shared library.  The fix was to remove the call to
  maybe_remove_dwarf_symbol() in merge_dylib_module_symbols() in symbols.c 
  and let this call happen when it get to the label
  use_symbol_definition_from_this_dylib.  The same change was also done in
  merge_bundle_loader_symbols() in symbols.c .  Radar bug #4570143.
- Fixed a bug in the parsing of the -allow_stack_execute flag.  In main() in
  ld.c in the second loop over the argv[] to pick up the object files was
  missing a test for "allow_stack_execute" and it was incorrectly thinking it
  had an argument.  Radar bug #4571206.

Changes for the 5.23 release (the cctools-617 release):
- Changed pass1_archive() in pass1.c to no longer check the timestamp of the
  archive against the table of contents archive member.  Radar bug #4462449.

Changes for the 5.23 release (the cctools-613 release):
- Changed layout.c to add macros that rename structure members of the 
  ppc and i386 thread states for Unix conformance.  Radar bug #4508798.

Changes for the 5.22 release picked up from cctools-590.42 (the cctools-610
release):
- Fixed another bug in the handling of the -Y undefined symbol tracing.  This 
  is more fall out of Radar bug #3737622.  Where the code was changed when
  linking two-level, to not search libraries that can't be encode as ordinals.  
  The code just inside the outer loop needed to have one of its checks changed
  so that it ignores any object with cur_obj->dylib set to TRUE no matter if the
  if is for a module linked from a dylib or not (cur_obj->dylib_module != NULL).
  Radar bug #4521358.

Changes for the 5.22 release (the cctools-590.40.1 release):
- Ignore multiple -syslibroot flags if they specify the same argument. Radar
  bug #4354876.

Changes for the 5.22 release (the cctools-590.31.1 release):
- Changed to invoke ld64 without any extra arguments when given a 64-bit
  object file.

Changes for the 5.21 release (the cctools-590.41 release):
- Fixed problems with the handling of the ___dso_handle linker defined symbol
  when it appears in an object used with -bundle_loader.  It needs to not cause
  an error when it only appears in the -bundle_loader file and still only be
  defined in the output file when it is referenced by the linked objects.  To
  handle the case when it appears in the -bundle_loader file but is not
  referenced by the objects, a test was added for this special case in
  setup_link_editor_symbol() in symbols.c to treat it like the symbol was not
  present.  Then to handle the case when the symbol is referenced an additional
  condition was added to the error check in define_link_editor_symbol() in
  symbols.c to not cause the error if the symbol was defined in the
  -bundle_loader file and also move the return from the function for that case
  to only happen when the error happens.  Radar bug #4482300.

Changes for the 5.21 release (the cctools-590.39 release):
- Removed the -I flag for private headers as it would no longer compile with it.
- Fixed a bug in the handling of the -Y undefined symbol tracing.  This appears
  to be more fall out of Radar bug #3737622.  Where the code was changed when
  linking two-level, to not search libraries that can't be encode as ordinals.  
  The fix done is safe, in that merged_symbols with twolevel_reference field set
  to TRUE are not ever to be traced with the -Y option.  So an extra test was
  added to the loop for -Y symbol tracing in process_undefineds() in symbols.c .
  Radar bug #4495010.

Changes for the 5.21 release (the cctools-590.38 release):
- Don't warn about an empty debug_info section.  The change was in
  read_dwarf_info() in pass1.c to add the extra condtional
  "debug_info->size == 0" to the if statement with the comment "No DWARF means
  nothing to do".  Radar bug #4492686.
- Fixed a bug that caused the "internal error: output_local_symbols()
  inconsistent local symbol count" when there were multiply defined symbols and
  the -m flag was used.  The fix was to add a new local boolean variable,
  discarded_multiply_defined_symbol, to merged_symbols() in symbols.c that gets
  set to FALSE at the start of merging each symbol and gets set to TRUE if the
  symbol is multiply defined.  Then in the if conditional before
  count_dwarf_symbols() is called the additional test of
  ! discarded_multiply_defined_symbol was added.  Radar bug #4487503.
- Fixed a bug that caused the "internal error: output_local_symbols()'
  inconsistent local symbol count" when converting common to undefined in an
  object compiled with DWARF.  The fix was to move the call to
  maybe_remove_dwarf_symbol() in merge_dylib_module_symbols() in symbols.c 
  right after the label use_symbol_definition_from_this_dylib.  This call needs
  to be made BEFORE a merged_symbol has its definition_object changed to the
  cur_obj.  The same change was also done in merge_bundle_loader_symbols()
  in symbols.c .  Radar bug #4446605.
- Changed the handling of symbols names listed in the -unexported_symbols_list
  file and now no longer check to see of they are seen in the linked objects.
  The change is in main() in ld.c and is just the removal of the loop of code
  that checks the remove_symbols[] array for seen symbols.  Radar bug #4465511.
- Changed the handling of the -Y flag to not cause an error when multiple -Y
  flags are specified.  When multiple -Y flags are specified the last one is
  used.  The change is in main() in ld.c and is just the removal of the test
  for Yflag != 0 and the error message.  Radar bug #4461031.

Changes for the 5.21 release (the cctools-590.37 release):
- Fixed a problem with causing the link editor defined symbol ___dso_handle to
  be made into a private extern with the -exported_symbols_list or
  -unexported_symbols_list options.  The code in define_link_editor_symbol() in
  symbols.c around the call to exports_list_processing() needed to adjust
  the private extern symbols count if the symbol was made into a private extern.
  And not be called at all if the symbol started out as a private extern.
  Radar bug #4461173.
- Fixed problems with -dead_strip removing sections with contents created from
  files.  Radar bug #4439885.
  - In layout_ordered_sections() in sections.c the loop that looks for merged
    sections with order files or when -dead_strip is specified had an expression
    added to the if() to skip certian sections.  If the section was created from
    a file it is also skipped so that layout_ordered_section() is not called
    which was zeroing out the section size.
  - In resize_live_sections() in sections.c the loop that looks for S_REGULAR
    section types was changed.  An extra condition was added to the if()
    expression so it would not call resize_live_section() when the section was
    created from a file.
  - In flush_scatter_copied_sections() in sections.c the if() test for calling
    sections with order files or when dead code stripping was specified was
    changed.  A test was added when the section was created from a file so
    output_flush() in not called in this case.
  - Added setting S_ATTR_NO_DEAD_STRIP in process_section_specs() in spec.c for
    sections created from files.  

Changes for the 5.21 release (the cctools-590.36 release):
- Changed the link editor defined symbol from __dso_handle to ___dso_handle.
  Radar bug #3992244.

Changes for the 5.21 release (the cctools-590.35 release):
- Added the link editor defined symbol __dso_handle for all images used with
  dyld.  Radar #3992244.
  - Changed setup_link_editor_symbols() in symbols.c to define __dso_handle in
    addition to the existing symbol.  Broke out most of the existing code into
    a new static routine setup_link_editor_symbol() passed a symbol_name.
  - The new static routine setup_link_editor_symbol() used most of the code
    from the previous setup_link_editor_symbols() but was changed to handle
    one or more symbols defined in the link_edit_symbols_object.
  - Changed define_link_editor_dylib_symbols() in symbols.c to also set the
    value of __dso_handle symbols.  Broke out some of the code into the new
    static routine define_link_editor_dylib_symbol().

Changes for the 5.21 release (the cctools-590.33 release):
- Split maybe_remove_dwarf_symbol out of merge_symbols in symbols.c.  Call
  maybe_remove_dwarf_symbol from similar code in merge_dylib_module_symbols
  and merge_bundle_loader_symbols.  Radar bug #4428677.
- Change merge_symbols and output_local_symbols in symbols.c to suppress
  compilation directory SO stab when none is provided/necessary and append
  '/' to it otherwise.  Change read_dwarf_info in pass1.c to set
  dwarf_comp_dir to NULL when no compilation directory is provided.
  Radar bug #4426731.

Changes for the 5.21 release (the cctools-590.32 release):
- Added the environment variable LD_LIBRARY_PATH as list of colon separated
  paths to be searched just before the standard paths.  Radar bug #4314159.
  - Added the variables ld_library_paths and nld_library_paths to pass1.[ch]
  - Added code to main() in ld.c to look for the environment variable
    LD_LIBRARY_PATH and if found parse out the colon separated paths and filling
    in the two variables above.
  - Changed in search_for_file() and search_paths_for_lname() in pass1.c adding
    another loop between the one for search_dirs[] and standard_dirs[] for
    ld_library_paths[].
- Changed to allow LD_PRINT_OPTIONS as an environment variable. This prints
  the options to stderr.
- Fixed Bug #4420393 by changing prefix from Build & Integration to XBS.
- Fixed Bug #4214105 by changing allowable environment variables from
  RC_TRACE_* to LD_TRACE_*. For now, backwards compatible with RC_TRACE_*
- Fixed Bug #4214101 by allowing LD_TRACE_FILE
- Updated all rc_trace_* variables to use ld_trace_*.
- Make set_obj_resolved_path in objects.c a stub when SA_RLD is defined.
  Radar bug #4402489.
- Suppress dwarf map entries for S_ATTR_STRIP_STATIC_SYMS sections.
  Radar bug #4419133.
  - Change count_dwarf_symbols to ignore symbols in such sections.
  - Change add_dwarf_map_for_sym to take a parameter indicating the section
    and ignore symbols in such sections.
  - Change output_local_symbols to pass the original section to
    add_dwarf_map_for_sym.
- Change merge_symbols in symbols.c so that when a weak coalesced
  symbol is ignored in favour of a strong coalesced symbol, the debug map
  entries relating to that symbol are removed from the count.  Radar
  bug #4421606.

Changes for the 5.21 release (the cctools-590.31 release):
- Changed to only emit an LC_UUID command if a debug section is seen on input
  or an LC_UUID command is seen on input.  Radar bug #4415529.
  - Added the suppress and emit boolean field to the uuid_info struct in
    layout.[ch]
  - Changed main() in ld.c to set output_uuid_info.suppress if -no_uuid is
    specified.
  - Changed merge_sections() in sections.c to set output_uuid_info.emit to TRUE
    if a debug section is seen in the input file.
  - Changed check_cur_obj() in pass1.c to set output_uuid_info.emit to TRUE if
    an LC_UUID load command is seen in the input file.
  - Changed layout_segments() in layout.c to test output_uuid_info.suppress for
    != TRUE and output_uuid_info.emit for TRUE before creating the LC_UUID
    command.
- Fixed two places in layout_segments() in layout.c that were calling
  lookup_symbol() and were not updated with the changes to Radar bug #4299546 on
  how the check for an undefined symbol is made.  Both the lookup of the entry
  point and the shared library init routine name code needed a fix to use
  merged_symbol->name_len == 0 not merged_symbol != NULL.  Radar bug #4401068.

Changes for the 5.21 release (the cctools-590.30 release):
- Change output_local_symbols in symbols.c to give the N_OSO stab in the
  DWARF map a n_desc of 1.  Bug # 4414139.
- DWARF updates now 4383509 is fixed.  Bug # 4409967.
  - Update debugcompunit.c and debugline.c to latest version; fix
    read_sleb128, and have read_comp_unit add the abbrev offset.
  - Have read_dwarf_info in pass1.c add the line number information offset
    and verify that it's reasonable.
  - Remove unused variable 'limit' from add_dwarf_map_for_sym in symbols.c.
- Add support for generating the DWARF debug map.  Bug #4370126.
  - New files debugcompunit.[ch], debugline.[ch], dwarf2.h.
  - Additional fields dwarf_name, dwarf_num_paths and dwarf_comp_dir in
    'struct object' in objects.h.  The format of dwarf_source_data is a
    sequence of size_t-sized words made up of subsequences.  Each
    subsequence describes the source files which the debug_line information
    says contributed to the code of the entity starting at a particular
    symbol.

    The subsequences are sorted by the index of the symbol to which they
    refer.  The format of a subsequence is a word containing the index
    of the symbol, a word giving the end of the entity starting with
    that symbol, and then one or more words which are file numbers
    with their high bit set.

    A file number is simply an index into cur_obj->dwarf_paths; each
    dwarf_paths entry is either NULL (if not used) or the path of the
    source file.  dwarf_num_paths is the length of dwarf_paths.
  - New function read_dwarf_info in pass1.c which looks for DWARF
    sections in cur_obj and if found, fills in the dwarf_name and
    dwarf_comp_dir fields in cur_obj.
  - Change function merge in pass1.c to call read_dwarf_info when debug
    symbols are generated.
  - New function count_dwarf_symbols in symbols.c which returns the
    number of DWARF symbols that would be generated by a symbol, which
    must be in the current object.  It is the pass1 counterpart of
    add_dwarf_map_for_sym.
  - Change function merge_symbols in symbols.c to allocate space for
    DWARF debug map symbols.
  - Change function discard_local_symbols_for_section in symbols.c to
    remove space for DWARF debug map symbols associated with local symbols
    which will no longer be needed.
  - Change function remove_dead_N_GSYM_stabs_for_cur_obj in symbols.c to
    remove space for DWARF debug map symbols associated with global symbols
    which will no longer be needed.
  - New function add_dwarf_map_entry in symbols.c which adds a single
    DWARF map symbol to the symbol list.
  - New function add_dwarf_map_for_sym in symbols.c which adds the
    DWARF symbols for a single object file symbol to the symbol list.
    It is the pass2 counterterpart of count_dwarf_symbols.
  - Change function output_local_symbols in symbols.c to output the DWARF
    debug map: add initial DWARF map symbols, add SOL strings to the
    local string table, add debug map entries for global and local symbols
    whose definitions in this object were actually output, add a terminal
    DWARF map symbol.

Changes for the 5.21 release (the cctools-590.29 release):
- Removed the check added to the relocation routines for Radar bug #4213478 that
  to cause an error if there was a relocation entry for a coalesced symbol plus
  a non-zero offset.  Turns out this is used in libstdc++ and now it has been
  determined that the problem that was trying to detect will not happen. Changes
  were in ppc_reloc.c, generic_reloc.c, i860_reloc.c, hppa_reloc.c, m88k_reloc.c
  and sparc_reloc.c .  Radar bug #4405403.

Changes for the 5.21 release (the cctools-590.28 release):
- Changed check_cur_obj() in pass1.c so that it byteswaps the LC_UUID load
  command.  Radar bug #4401375.
- Added a check to the relocation routines to cause an error if there is a
  relocation entry for a coalesced symbol plus a non-zero offset.  Changes were
  in ppc_reloc.c, generic_reloc.c, i860_reloc.c, hppa_reloc.c, m88k_reloc.c and
  sparc_reloc.c .  Radar bug #4213478.

Changes for the 5.21 release (the cctools-590.27 release):
- Fixed a warning about unused variable `stat_buf' in 
  get_stroff_and_mtime_for_N_OSO() in symbols.c for the static KLD case.

Changes for the 5.21 release (the cctools-590.26 release):
- Added the missing case for the LC_UUID load command to be ignored in
  check_cur_obj() in pass1.c . Radar bug #

Changes for the 5.21 release (the cctools-590.25 release):
- Added support for DWARF.  Radar bug #3415593.
  - Added the enum bool field debug_only to the merged_segment struct in
    sections.h to indicate that the sections in the segment contain the
    S_ATTR_DEBUG attribute .
  - Changed create_merged_section() in sections.c to set the new debug_only
    field when creating a new segment based on the S_ATTR_DEBUG attribute for
    the first section placed in the segment.  And added a check when the
    section is found to make sure the debug_only field in the segment matches
    the S_ATTR_DEBUG attribute for the section.
  - Changed merge_sections() in sections.c to always set the S_ATTR_DEBUG on
    the merged section if the section in the object has it set.  And then
    simply continue and not account for the section's size, relocs, etc.
  - In pass2() in pass2.c in the loop for each non-literal content section
    a test for the debug attribute, S_ATTR_DEBUG, was added.  And if set then
    a continue is done to not cause output_section() to be called on it.
  - In relayout_relocs() in sections.c in the first loop for regular sections
    a test for the debug attribute, S_ATTR_DEBUG, was added.  And if set then
    a continue is done to not cause count_relocs() to be called on it.
  - Added a new routine, remove_debug_segments() to sections.[ch] to remove
    the debug segments from the list of merged_segments.
  - Added a call to the new routine, remove_debug_segments(), in layout() in
    layout.c to just before layout_order_sections() is called and before the
    dead code stripping routines are called.
  - Changed layout_segments() in layout.c to move up the saving of
    merged_segments into original_merged_segments to the start of the routine.
  - Changed RLD routine reset_merged_sections() in sections.c to first add the
    debug segments back on the list of merged_segments.
  - Added a check to check_cur_obj() in pass1.c to make sure all debug sections
    are of type S_REGULAR.
  - Added a check at the end of check_symbol() in symbols.c to make sure the
    symbol is not in a debug section.
  - Added two checks in the *_reloc() routines to test to illegal references to
    debug sections from local relocation enties (one for the reloc entry and one
    for its pair if it exists). The changes are in:
      ppc_reloc() in ppc_reloc.c
      generic_reloc() in generic_reloc.c
      hppa_reloc() in hppa_reloc.c
      i860_reloc() in i860_reloc.c
      m88k_reloc() in m88k_reloc.c
      sparc_reloc() in sparc_reloc.c
  - Added a check to process_section_specs() in specs.c to check for debug
    sections that have an order file specified and issue a warning that they
    are ignored.
  - Added a check in merge_symbols() when -sectobjectsymbols is set to see
    the the section is not a debug section and if so issue a warning.
  - Changed the way N_OSO stabs were previously handled so now the linker never
    adds them but only changes the name in some cases.  This requires a matching
    compiler change (Radar bug #4386531) even for stabs to always produce the
    N_OSO stab in the object file. This is how things are to work:
    * The compiler when producing dwarf debug info will produce a N_OSO stab
      with:
	.debug_note "", 0x66, 0, 1, 0
      That is the the name of "" (that is a one byte string with single '\0'
      character) and an n_desc field value of 1.
    * The compiler when producing stabs debug info will produce a N_OSO stab
      with:
	.stabs "", 0x66, 0, 0, 0
      Again with a name of "" but with an n_desc field value of 0.
    * When the linker encounters a N_OSO stab with a name of "" and an n_desc
      field of 1 it will change the name to the full path of the object and set
      the n_value field to the mod time of the object (or archive mod time).
    * When the linker encounters an N_OSO stab with a name of "" and an n_desc
      field of 0 its behavior depends if -Sp is specified or not.  If -Sp is
      specified it will change the name to the full path of the object and set
      the n_value field to the mod time of the object (or archive mod time).
      If -Sp is not specified it will change the N_OSO stabs names to "".
    The above is implemented with the following changes:
    - Added the new routine set_obj_resolved_path() to objects.[ch] to set the
      resolved_path field of an object_file struct for use by N_OSO stabs.
    - Changed is_output_local_symbol() in in symbols.[ch] to now be passed the
      n_desc field and all changed all the callers to now pass n_desc.  Then
      code was added for N_OSO stabs to return the size of their names as
      outlined above based on the n_name field, n_desc field and if -Sp is
      specified.
    - Removed the old code in merge_symbols() in symbols.c that tracked where
      to add the N_OSO stab and its name.
    - In merge_symbols() in symbols.c at the end of the routine that handles
      STRIP_DUP_INCLS, the three places that called strlen() on the symbol's
      string were replace with calls to is_output_local_symbol() and the use
      of output_strlen becase the symbol maybe a N_OSO that we are changing the
      name of.
    - Added the new routine get_stroff_and_mtime_for_N_OSO() in symbols.c to
      be used by output_local_symbols() to help put out N_OSO stabs.
    - Removed the old code in output_local_symbols() in symbols.c to put out
      an N_OSO stabs in the correct place.  And added code in there to set the
      name of the N_OSO stabs as outlined above.
  - For the strip_level of STRIP_NONE the optimization of just using the
    entrire string table to avoid doing a strlen() on all the local strings
    had to be removed since we now may have to add strings for N_OSO stabs.
    So now this is just delt with by letting is_output_local_symbol() get
    called and accounting string sizes normally.
    - Removed code in merge_symbols() in symbols.c for strip_level ==
      STRIP_NONE to increment local_string_size by cur_obj->symtab->strsize.
      And the code to always increment cur_obj->nlocalsym and nlocal_symbols.
    - Removed a test in discard_local_symbols_for_section() in symbols.c
      of strip_level==STRIP_NONE before the call to is_output_local_symbol().
      And removed two later tests before decrementing local_string_size .
    - Removed a test in remove_dead_N_GSYM_stabs_for_cur_obj() in symbols.c
      of strip_level==STRIP_NONE before the call to is_output_local_symbol().
      And removed a later test before decrementing local_string_size .
    - Removed a test in output_local_symbols() in symbols.c of
      strip_level == STRIP_NONE || strip_level == STRIP_DUP_INCLS
      of strip_level==STRIP_NONE and STRIP_DUP_INCLS before the call to
      is_output_local_symbol(). And removed later the code that tests
      strip_level == STRIP_NONE and does a memcpy() to copy out the object's
      whole symbol table.
    - Removed a test in local_symbol_output_index() in symbols.c of
      strip_level==STRIP_NONE before the call to is_output_local_symbol().
  - Added support for the uuid load command.
    - Added the output_uuid_info variable to layout.[ch] .
    - In layout() in layout.c added a call to memset() to zero out
      output_uuid_info.
    - Added the new routine uuid() in the new files uuid.[ch] used to set the
      uuid[] bytes of the uuid_load command.
    - In layout_segments() in layout.c added the code to set the values into
      uuid load command and call the new uuid() routine.
    - In output_headers() in pass2.c added the code to copy out the uuid load
      command into the output file.

Changes for the 5.20 release (the cctools-590.23.2 release):
- Changed the Makefile back so the OFLAG was not commented out. Radar bug
  #4371058.

Changes for the 5.20 release (the cctools-590.23.1 release):
- Fixed a bug that caused a crash in remove_merged_symbols() in symbols.c when
  looping through the merged_symbol_list.  The fix was really likely with the
  missing memset() needed in lookup_symbol() in symbols.c after the allocate()
  of the merged_symbol_list struct.  The loop in remove_merged_symbols() that
  caused the crash was also changed to be more robust by looping backwards over
  only the used elements in the array and adding additional checks to avoid
  indirection through possible bad pointers.  Radar bug #4371058.

Changes for the 5.20 release (the cctools-590.22 release):
- Fixed a bug in literal_pointer_output() in literal_pointers.c where it was
  creating local relocation entries in the output file's memory buffer when it
  shouldn't.  In doing so it can run off the end of the memory buffer and cause
  a crash.  If it doesn't crash we get lucky as this just happens to be done
  early and later the correct stuff gets placed over this area in the memory
  buffer.  Radar bug #4348548.

Changes for the 5.20 release (the cctools-590.21 release):
- Fixed a bug in remove_merged_symbols() in symbols.c that was using
  merged_symbol_root->list where merged_symbol_root could be NULL.  Radar bug
  #4346485.

Changes for the 5.20 release (the cctools-590.20 release):
- Removed the warnings when building. Radar bug #4340147.
  - Added -fno-builtin-round and -fno-builtin-trunc to the Makefile.
  - Changed the cast of argument 3 of the call to bootstrap_look_up() to
    (unsigned int *) in check_for_ProjectBuilder() in ld.c .
  - Set the fields of the local struct r to NULL in setup_reference() in
    sections.c .
  - Added a cast of (unsigned long *) to argument 5 of is_output_local_symbol()
    in remove_dead_N_GSYM_stabs_for_cur_obj() and output_local_symbols() in
    symbols.c . 
  - Added two #undef's, one for THREAD_STATE_NONE and one for
    VALID_THREAD_STATE_FLAVOR in layout.c .
- Changed the definition of kld_basefile_name in internal_kld_load() in kld.c
  to include const so it matches the header file:
  /System/Library/Frameworks/Kernel.framework/PrivateHeaders/libsa/stdlib.h
  if it exists on the system.  Radar bug #4342523.
- Fixed a bug when both -s and -dead_strip were used and there were dead private
  extern symbols.  This caused an internal error in
  assign_output_symbol_indexes() in symbols.c with inconsistent local symbol
  counts.  The first problem was that nstripped_merged_private_symbols was being
  reset to zero causing the problem with local symbol counts.  The second
  problem was the count of merged symbols was wrong because
  nstripped_merged_symbols was reset to zero not to
  nstripped_merged_private_symbols before adding in the live symbols to be
  stripped.  Radar bug #4286691.
- Fixed a bug where the -w flag to suppress warnings was not suppressing the
  list of multiply defined symbols.  The fix was in merge_dylib_module_symbols()
  in symbols.c where after it calls warning() to print the header a test of
  nowarnings == TRUE was added and if so a continue is done to skip tracing of
  symbols.  Radar bug #4334705.

Changes for the 5.20 release (the cctools-590.17 release):
- Changed symbol lookup to make it faster.  Radar bug #4299546.
  - The structures and global variable for storing the merged symbol hash table
    and list of merged symbols in symbols.[ch] were changed.  The pointer to get
    to the merged symbol table is a new global variable merged_symbol_root
    replacing the old merged_symbol_lists pointer.
    - The contents of merged_symbol_list struct was completely changed and is
      now only a list of merged symbols implemented as array of pointers, a
      count of the used pointers and a next pointer in a linked list of
      merged_symbol_list structs.  There is no global variable to get to the
      start of the list and instead it is hung off the new merged_symbol_root
      struct. As such all code that has loops that to loop over the list of
      merged symbols are changed and then after the loop a change is made to
      indirect through the pointer in the symbols[] array.
      These changes were made in:
	in pass1.c
	  search_dynamic_libs()
	  prebinding_check_for_dylib_override_symbols()
	  twolevel_namespace_check_for_unused_dylib_symbols()
	in symbols.c
	  define_common_symbols() (2 loops)
	  define_undefined_symbols_a_way()
	  mark_globals_live()
	  set_fine_relocs_for_merged_symbols()
	  count_live_symbols()
	  define_link_editor_dylib_symbols()
	  reduce_indr_symbols()
	  layout_merged_symbols()
	  output_merged_symbols() (2 loops)
	  output_rld_symfile_merged_symbols()
	  process_undefineds() (4 loops)
	  reset_prebound_undefines()
	  assign_output_symbol_indexes() (3 loops)
	  output_dylib_tables() (2 loops)
	  clear_read_only_reloc_flags()
	  flag_read_only_reloc()
    - A new merged_symbol_root struct now stores the hash table and has a
      pointer to the merged_symbol_list struct.  There is a new global variable
      merged_symbol_root which is a pointer to this struct.  This is made up of
      an array of new merged_symbol_chunk structs.
    - The new merged_symbol_chunk structs has an array of merged_symbol structs
      of SYMBOL_CHUNK_SIZE and a pointer to the next merged_symbol_chunk struct.
  - The routine lookup_symbol() was changed to return a pointer to a
    merged_symbol struct instead of a pointer to a pointer.  So to see if the
    symbol is defined the callers now need to look to see if the name_len field
    of the merged_symbol pointer returned is != 0.
    These changes were made in:
	coalesced_section_merge() in coalesced_sections.c
	generic_reloc() in generic_reloc.c
	hppa_reloc() in hppa_reloc.c
	i860_reloc() in i860_reloc.c
	indirect_section_merge() in indirect_sections.c
	layout_segments() in layout.c
	literal_pointer_merge() in literal_pointers.c
	m88k_reloc() in m88k_reloc.c
	pass1_archive() in pass1.c
	ppc_reloc() in ppc_reloc.c
	sparc_reloc() in sparc_reloc.c
	in rld.c
	  kld_lookup()/rld_lookup()
	  kld_forget_symbol()/rld_forget_symbol()
	in sections.c
	  layout_ordered_section()
	  count_relocs()
	  scatter_copy() (2 places)
	  live_marking() (2 places)
	in symbols.c
	  merge_symbols()
	  command_line_symbol()
	  command_line_indr_symbol()
	  merge_dylib_module_symbols()
	  merge_bundle_loader_symbols()
	  enter_indr_symbol()
	  define_link_editor_execute_symbols()
	  setup_link_editor_symbols()
	  define_link_editor_dylib_symbols()
	  define_link_editor_preload_symbols() (2 places)
	  define_link_editor_symbol()
	  remove_dead_N_GSYM_stabs_for_cur_obj()
    Since lookup_symbol() now returns a pointer to a merged_symbol struct
    to be used by enter_symbol().  So the static variable
    merged_symbol_list_for_enter_symbol pointing to the merged_symbol_list has
    been removed.
  - The new static routine add_to_symbol_list() in symbols.c was added which is
    passed merged_symbol and adds it to the merged_symbol_list linked list.
  - The routine enter_symbol() was changed so the hash_pointer parameter is now
    just a pointer to a merged_symbol struct not a pointer to a pointer.  The
    code that used the removed merged_symbol_list_for_enter_symbol was removed.
    And a call to the new add_to_symbol_list() routine was added.
  - The routine enter_indr_symbol() was changed so the hash_pointer variable
    is now a pointer to a merged_symbol struct returned from lookup_symbol().
    The code that used the removed merged_symbol_list_for_enter_symbol was
    removed.  And a call to the the new add_to_symbol_list() routine was added.
  - Changed free_pass1_symbol_data() in symbols.c and just removed the code that
    has been #ifdef notdef'ed out instead of updating the loop that deallocated
    the hash table.
  - The routines remove_merged_symbols() and print_symbol_list() in symbols.c
    were updated to deal with the new merged symbol table data structures.
  - Added the routine hash_instrument() in symbols.[ch] to print out info about
    the contents of the hash table.  The new flag -hash_instrument in main() in
    ld.c causes this to be called.

Changes for the 5.18 release (the cctools-590.16 release):
- Changed is_output_local_symbol() in symbols.c for the STRIP_MIN_DEBUG (-Sp)
  case so we never keep types.  Radar bug #4312007.

Changes for the 5.18 release (the cctools-590.13 release):
- Fixed a bug when -dead_strip was used that caused it to remove local symbols
  for coalesced sections.  The fix was at the end of coalesced_section_merge()
  in coalesced_sections.c to only call discard_local_symbols_for_section()
  when dead_strip is FALSE.  As this will be called when dead_strip is TRUE as
  part of count_live_symbols() calling removed_dead_local_symbols_in_section().
  Radar bug #4293942.

Changes for the 5.18 release (the cctools-590.12 release):
- Made the changes control stack execution.  Radar bug #4281171.
  - Added the boolean allow_stack_execute to ld.[ch] which defaults to FALSE and
    gets set to TRUE when the new flag -allow_stack_execute is seen in main().
  - Added a check in main() in ld.c to cause an error if -allow_stack_execute is
    used and the filetype is not MH_EXECUTE.
  - Changed layout_segments() in layout.c :
    - To use the new routine get_segprot_from_flag() when setting the default
      segment protections of segments (3 places).
    - Since the default protection may not include VM_PROT_EXECUTE, if this is
      added because there is a section with the S_ATTR_SOME_INSTRUCTIONS
      attribute, a test of the initprot of VM_PROT_EXECUTE is done and if set
      it is added to maxprot.
    - If the protections of the stack are specified to include VM_PROT_EXECUTE
      then allow_stack_execute is set to TRUE.
    - If allow_stack_execute is set to TRUE then MH_ALLOW_STACK_EXECUTION is set
      in the mach_header flags in the output.

Changes for the 5.18 release (the cctools-590.10 release):
- Added support for new i386 self (dyld) modifiying code stubs.  Radar bug
  #4202415.
  - In scatter_copy() in sections.c the section is checked for and if found and
    we are prebinding the entries are turned into JMP instruction.
  - In layout() in layout.c if the SEG_IMPORT is present to set it's initial
    protection to rwx.
- Changed find_stab_name_end() in symbols.c correctly step over C++ scoped type
  stab strings with blah::blah in them.  Radar bug #4233860.
- Fixed a problem with ld -r and S_ATTR_STRIP_STATIC_SYMS in
  is_output_local_symbol() in symbols.c so it now does not strip these when
  save_reloc is TRUE.  The problem is that the first symbol in a coalesced
  section could get stripped leaving it "malformed".

Changes for the 5.18 release (the cctools-590.9 release):
- Changed is_output_local_symbol() in symbols.c to not always call strlen() at
  the top of the routine.  But to call it just before we return TRUE and the
  whole string is to be in the output.  This speeds things up a bit.  Radar bug
  #4157062.
- Changed merged_symbols() in symbols.c so that when merging a weak symbol
  it will discard a weak symbol in the merged symbol if it comes from a
  dylib for a weak symbol in a .o file. Radar bug #4231836.

Changes for the 5.18 release (the cctools-590.7 release):
- Worked around a problem not having groups for exception frame information and
  dead code stripping.  The compiler generates a first block for the exception
  frame info that is referenced by all other exception blocks.  So if this block
  becomes live it will cause all the other exception frame blocks to become
  live when the dead code stripping phase of seaching live support blocks
  touching something that is live.  The work around that was added was to not
  cause a live support block to become live if it references another live
  support that is live.  This change is in ref_operation() in sections.c to test
  (ref->map->s->flags & S_ATTR_LIVE_SUPPORT) .  Radar bug #4213358.
- Changed dead code stripping to make it faster.  Radar bug #4228195.
  - Added a new routine build_references() in section.c called first in
    live_marking() to set up the linked list of refs off the fine_relocs struct
    and cause new fine_reloc pointer off the merged_symbol struct to be set.
  - Added the new field fine_reloc to the merged_symbol struct in symbols.h to
    be a pointer to the fine_reloc for the symbol if any.
  - Added a the new struct ref to objects.h which contains two groups of fields.
    For external references it has:
	a pointer to a merged_symbol
    For local refereces it has:
	a pointer to a fine_reloc
	a pointer to the section map
	a pointer to the object
    and a next pointer for the linked list.
  - Added the new field refs to the fine_reloc struct in objects.h for dead code
    stripping for the new ref structures for each fine_reloc block.
  - The new routine build_references() in sections.c calls down through the
    following new routines to get the references for each section from the
    relocation entires for the fine_relocs:
	setup_references_in_section() in sections.c
	setup_references() in sections.c
	setup_reference() in sections.c
    To make things faster for ld -r object that have many relocation entries the
    code was changed to walk the relocation entries and putting them into the
    fine_reloc blocks as a linked list.
  - Added an assignment to the new pointer to a fine_reloc struct off of the
    merged symbol in layout_ordered_section() in sections.c .
  - Added the new routine, set_fine_relocs_for_merged_symbols() in symbols.[ch]
    called from build_references() to set the new pointer to a fine_reloc for
    merged symbols.
  - Changed:
      live_marking() in sections.c
      mark_globals_live() in symbols.c
      count_live_symbols() in symbols.c
    in places where it used to call get_fine_reloc_for_merged_symbol() to now
    use the fine_reloc pointer off the merged_symbol.
  - Removed the checks of errors != 0 in code in sections.c after calls to:
	walk_references_in_section()
	walk_references()
    in the routines:
	live_marking()
	walk_references_in_section()
    since the build_references() code is now the one calling the *_reloc()
    routines where errors can occur.
  - Changed walk_references() in sections.c to now use the new refs field of the
    fine_reloc to walk the references and removed all the code to deal with
    relocation entries.
  - Changed indirect_live_ref() in indirect_sections.c so it now takes and sets
    then new ref struct.  It now returns a boolean to indicate if there is a
    reference.
  - Changed ref_operation() so the second argument is now a pointer to the new
    refs structure.  Which now has all the info needed for ref_operation() to
    process the reference without having to calculate the map or the file_reloc
    the live_ref struct was refering to.  The routine was change to use the
    refs struct and the fields with the values to process the reference.
  - Added a new static boolean variable local_NO_DEAD_STRIP_symbols to symbols.c
    which starts out as FALSE and set to TRUE in merged_symbols if any local
    local section symbol is seen with the N_NO_DEAD_STRIP bit set.  Then the
    code in mark_N_NO_DEAD_STRIP_local_symbols_live() first checks this to see
    if FALSE and then just returns.  It saves time as it is expensive to look
    through all the local symbols and generally this bit never set on a local
    symbol.
  - Added a new extern boolean variable dead_strip_times to ld.[ch]
    which is set with the flag -dead_strip_times in main() in ld.c.  Changed
    live_marking() in sections.c to check this flag and to record the start and
    end times of the various phases of dead code stripping and print them out.
    Also added the new static routine calculate_time_used() in sections.c which
    is used to print out the times.
- Added the -macosx_version_min flag.  Radar bug #4195253.

Changes for the 5.18 release (the cctools-590.6 release):
- Changed which local symbols get deleted for a block that is coalesced out or
  dead code stripped.  Previouly all local symbols in the group of local
  symbols in a N_BNSYM/N_ENSYM pair were deleted when the block is removed.
  Now any type stabs in that block must not be deleted.  Radar bug #4205997.
  - Added the new static function is_type_stab() to symbols.c to return TRUE if
    the symbol passed to it is a type stab.
  - Changed discard_local_symbols_for_section() in symbols.c when it was going
    to remove a block of N_BNSYM/N_ENSYM symbols to add a new loop and check
    to see if the symbol is a type stab.  If it is the current localsym_block
    is closed and the stab is stepped over.  If not it is added to the the
    localsym_block creating a new local symbol block if the current block is
    closed.
- Fixed problems with the change below with the -Sp option where the code was
  not correctly #ifdef'ed out from the RLD version.  The added code in symbols.c
  for STRIP_MIN_DEBUG was #ifndef RLD.  Radar bug #4220100.

Changes for the 5.18 release (the cctools-590.5 release):
- Added the -Sp striping option to strip some stabs and modify other stab
  strings and add N_OSO stabs to allow the debugger to use debug info from .o
  files.  Radar bug 4202462.
  - Added STRIP_MIN_DEBUG to the strip_levels enum in ld.h .
  - Added code to main() in ld.c to parse -Sp and check to see it is not used
    with -r.
  - Changed is_output_local_symbol() in symbols.[ch] to return indirectly the
    size of the output string through an new parameter output_strlen.  And added
    code for the STRIP_MIN_DEBUG case to see if the stab is to be output and its
    string size.
  - Changed all callers of is_output_local_symbol() to pass the extra parameter
    and use the returned string size in their code(). 
  - Added the new static routines find_stab_name_end() and find_stab_type_end()
    to symbols.c to parse out stab strings.
  - Added the new fields resolved_path and resolved_path_len to the struct
    object_file in objects.h.
  - Added code to merge_symbols() in symbols.c where it deals local symbols to
    account for the N_OSO stabs and the string that are added with -Sp.
  - Added code to output_local_symbols() in symbols.c to deal with putting out
    the new N_OSO stabs in the correct places in the output.

- Fixed a bug when an archive containing only the magic string was used which
  incorrectly generated an error that the archive was malformed.  The fix was in
  check_archive_arch() in pass1.c to see of the filesize was the offset after
  the magic string then issue a warning and return.  Radar bug #4201492.

Changes for the 5.18 release (the cctools-590.4 release):
- Fixed a bug when -weak_framework was used that caused an incorrect error
  message about mismatching weak references. The fix was in process_undefineds()
  in symbols.c to add an extra condtional to the check for merged_symbols that
  had the weak_reference_mismatch field TRUE.  The extra check was to see if the
  where defined in a dylib and that dylib was being forced weak.  Radar bug
  #4180599.
- Changed the warning message about NEXT_ROOT being ignored if -syslibroot is
  specified to only be printed if the two are set to different strings.  This
  is in main() in ld.c.  Radar bug #3593340.
- Changed a warning message that printed out a dynamic library that could not be
  found to include the dynamic library that made a reference to it.  This was in
  in open_dylib() in pass1.c .  Radar bug #4106804.

Changes for the 5.19 release (the cctools-590.2 release):
- Changed ld(1) so every EXCL uses a string allocated for a BINCL. This reduces
  the size of final linked images built with -gfull. Modified
  output_local_symbols() in symbols.c to call a new static functions
  record_bincl() when processing a BINCL and find_bincl() when processing a
  EXCL. Radar bug #4151821.

Changes for the 5.18 release (the cctools-590 release):
- Changed ld(1) to prepend the value of -syslibroot to all absolute paths of the
  they exist in main.c in ld.c.  Radar bug #4127020.

Changes for the 5.18 release (the cctools-585 release):
- Added ifdef's around the call to get_macosx_deployment_target() in
  check_cur_obj() in pass1.c so it is not compiled in for libkld.a.
  Radar bug #4100992.

Changes for the 5.18 release (the cctools-583 release):
- Changed the Makefile so that when RC_XBS is set to YES then the compiler
  options -MD and -dependency-file as well as the md(1) program are not used.
  Radar bug #4029936.

Changes for the 5.18 release (the cctools-581 release):
- Fixed a problem introduced with the changes so the handling of the default
  MACOSX_DEPLOYMENT_TARGET.  The code for setting this was moved up in main()
  in ld.c so it is set in time to be used in checking other command line values.
  Also code was added so it is set even if -arch is not specified.  Radar bug
  #4092246.
 
Changes for the 5.18 release (the cctools-580 release):
- Fixed a bug where if a symbol defined in a dylib is first linked in followed
  by an undefined weak reference from a .o file it will generate a weak mismatch
  error.  The fix was to add a new boolean field to the merged symbol,
  seen_undef (in symbols.h). Then in merge_symbols() in symbols.c where it
  detects weak mismatches, if seen_undef is not set then just set the N_WEAK_REF
  bit from the .o file.  Else when seen_undef is set then do the checking and
  handling of weak mismatches.  Then after either are done set seen_undef to
  TRUE.  Radar bug #4016228.
- Changed it so that the default for MACOSX_DEPLOYMENT_TARGET is 10.4 for i386.
  Radar bug #4081062.
  - Moved the call to get_macosx_deployment_target() in main() in ld.c to inside
    the if() where the -arch flag is known to be specified.  Then the cputype is
    passed as an additional parameter.
  - Added a call to get_macosx_deployment_target() in check_cur_obj() in pass1.c
    when the cputype is set from the .o files being linkd.

Changes for the 5.18 release (the cctools-578 release):
- Changed check_cur_obj() in pass1.c to also ignore SWAP_LONG(MH_MAGIC_64) with
  -no_arch_warnings.  Radar bug #4014404.

Changes for the 5.17 release (the cctools-575 release):
- Made a additional change for the original change to "Don't search indirect
  libraries when linking two-level" that was made for Radar bug #3737622.
  The problem was when building a two-level namespace image that was linking
  against flat-namespace images the link could fail with undefined symbol
  references.  This happened because the undefined references from a
  flat-namespace dylib were being looked up but the indirect dylibs that
  defined those symbols were removed from the list of libraries to be searched.
  The "Architect" of the original change intended that "when linking two-level
  only undefines from dylibs should be ignored".  So to match that intent
  another change is needed when linking in a module from a flat namespace dylib.
  - In merge_dylib_module_symbols() in symbols.c, in the second loop where
    the symbols referenced by a dylib module are merged as undefined references,
    a test was added when resolving with flat namespace semantics.  So that if
    the output file was being built as a two-level namespace image then
    the reference from the dylib is skipped.  And that undefined symbol will
    not be searched for.
  This of course leaves the architectural flaw that error checking is lost and
  will allow broken binaries to be built.  Radar bug #4022543.

Changes for the 5.17 release (the cctools-573 release):
- Changed main() in ld.c and check_cur_obj() in pass1.c to call the new function
  force_cpusubtype_ALL_for_cputype() with the cputype being linked.  And if it
  returns TRUE sets force_cpusubtype_ALL.  Radar bug #4002756.

Changes for the 5.17 release (the cctools-572 release):
- Fixed a problem when MallocScribble was on that caused a crash.  The problem
  was enter_symbol() in symbols.c was assumed to return pointers to
  merged_symbol structs that were zero'ed out.  A call to memset() was added to
  make sure this is done.  Radar bug #3980535.

Changes for the 5.17 release (the cctools-569 release):
- Fixed a problem when determinging the type of relocation entries in a 
  coalesced section to a symbol that was a weak coalesced symbol in the .o file
  but ends up as a non-coalesced symbol in the output.  The problem was in
  coalesced_section_merge() when it was trying to figure out if it was to force
  an external relocation entry because the symbol was a coalesed symbol.  It
  needed an extra test to look at the merged symbol and not the symbol in the .o
  ofile.  Radar bug #3934341.

Changes for the 5.17 release (the cctools-568 release):
- Fixed problems with changes for supporting the new XXX_RELOC_LOCAL_SECTDIFF
  relocs from Radar bug #3744821.  The problem was the logic around calling
  legal_reference() in the cases with sections and fine relocs and sectdiff
  relocation entries.  The code was changed back to the original code with the
  sectdiff parameter to legal_reference() changed from TRUE to 
  r_type != XXX_RELOC_LOCAL_SECTDIFF.  This change was made in ppc_reloc() in
  ppc_reloc.c and generic_reloc() in generic_reloc.c .  Radar bug #3961903
- Fixed problems with kld and outputing coalesced sections.  The code in
  output_section() in sections.c to call scatter_copy() was #ifndef RLD so it
  was not there.  If'def this back in and the neede parts of scatter_copy()
  for RLD.  Radar bug #3959886.
- Changed layout.c to remove multiply defined warnings by adding #undef's for
  MACHINE_THREAD_STATE and MACHINE_THREAD_STATE_COUNT after including
  <mach/m68k/thread_status.h> .

Changes for the 5.17 release (the cctools-563 release):
- Fixed some problems with regard to relocation entries refering to private
  extern common symbols.  Radar bug #3928792.
  - Changed the test for external relocation entries to being for undefined
    symbols from checking n_type equal to (N_EXT | N_UNDF) to testing for
    N_EXT and the N_TYPE bits equal to N_UNDF in the *_reloc() routines.
    Changes made in:
      ppc_reloc() in ppc_reloc.c
      generic_reloc() in generic_reloc.c
      hppa_reloc() in hppa_reloc.c
      i860_reloc() in i860_reloc.c
      m88k_reloc() in m88k_reloc.c
      sparc_reloc() in sparc_reloc.c
  - Changed creating and setting the undefined map for symbols from the n_type
    equal to (N_EXT | N_UNDF) to testing for N_EXT and the N_TYPE bits equal to
    N_UNDF in merge_symbols() in symbols.c (3 places). The first place is the
    test before incrementing the object_undefineds variable.  The place is the
    test before incrementing cur_obj->nprivatesym and nmerged_private_symbols.
    The third place is the test before setting the undefined map's,
    cur_obj->undefined_maps[], values.
  - Changed the test for a merged undefined symbol in merge_symbols() in
    symbols.c when checking for an undefined or common from n_type equal to
    (N_EXT | N_UNDF) to testing the N_TYPE bits equal to N_UNDF.
  - Changed the test for a merged undefined symbol in command_line_indr_symbol()
    in symbols.c from the n_type equal to (N_EXT | N_UNDF) to testing the
    N_TYPE bits equal to N_UNDF.
  - Changed the test for common symbols when merging them in merge_symbols() in
    symbols.c from testing n_type equal to (N_EXT | N_UNDF) to testing for
    N_EXT and the N_TYPE bits equal to N_UNDF (2 places).  The first place is
    the test to see if the object's symbol is a common.  The second place is
    the test of the merged symbol being a common or undefined.
  - Changed in merge_symbols() in symbols.c where the larger of the commons are
    used, to also "use" the N_PEXT bit from the larger symbol.  Also if the same
    common from different object has different N_PEXT bits a warning is issued
    and the symbols are traced.
  - Changed checking for common symbols in define_common_symbols() in symbols.c
    from the n_type equal to (N_EXT | N_UNDF) to testing for N_EXT and the
    N_TYPE bits equal to N_UNDF (2 places).  The first place is in the loop that
    is checking if any commons exist.  The second place in the in the loop that
    defines the commons.
  - Also in define_common_symbols() in symbols.c, in the loop that defined the
    commons and sets the new n_type, changed that to save the N_PEXT bit of
    the merged symbol.
  - Changed the check for a defined private extern symbol in
    output_merged_symbols() in symbols.c from just checking the N_PEXT bit to
    also checking that the N_TYPE != N_UNDF so that symbols that are still
    common symbols and private extern are not treated as defined symbols.
    So to not clear the N_EXT bit of private extern symbols that are still
    common symbols.
  - Changed the check for undefined symbols in assign_output_symbol_indexes()
    in symbols.c from tesing if the n_type is (N_EXT | N_UNDF) or
    (N_EXT | N_PBUD) to testing for N_EXT and the N_TYPE equal to N_UNDF or
    N_PBUD so that private extern commons will be treated and undefined symbols
    (in two places).  The first place, in the loop where the undefined symbols
    are counted.  And the second place in the loop where the arrays of symbols
    are filled in.
- Changed output_merged_symbols() in symbols.c to set the new MH_WEAK_DEFINES
  bit in the mach_header if there are any defined external symbol that are
  weak defintions.  Also now set the new N_REF_TO_WEAK bit is the symbol table
  entry if the symbol is a referencing an undefined symbol that is a weak symbol
  and set the the new MH_BINDS_TO_WEAK bit in the mach_header.  Radar bug
  #3799069.
- Changed layout.c to remove multiply defined warnings by adding #undef's for
  MACHINE_THREAD_STATE and MACHINE_THREAD_STATE_COUNT after including
  <mach/ppc/thread_status.h> .

Changes for the 5.17 release (the cctools-561 release):
- Changed main() in ld.c to use MACOSX_DEPLOYMENT_VERSION >= 10.4 instead of
  the environment variable LD_PREBIND_SPLITSEGS_ONLY to turn off prebinding for 
  non-split libraries.  This is the second phase of the change to Radar bug
  #3855581.  That bug is cloned as Radar bug #3924730 for this change.

Changes for the 5.17 release (the cctools-559 release):
- Changed libkld.a to link with the new libstuff_kld.a and libmacho_kld.a built
  for the kernel's kld use.  Radar bug #3906133.

Changes for the 5.17 release (the cctools-557 release):
- Removed support for the INTERIM_PPC64.  The changes were to remove the
  #ifdef INTERIM_PPC64 source changes in sections.c, ppc_reloc.c, layout.c and
  indirect_sections.c as well as removing the -DINTERIM_PPC64 in the
  Makefile.  Radar bug #3600419.

Changes for the 5.17 release (the cctools-556 release):
- Changed the way an MH_DYLINKER output file is laid out so that the headers
  are on their own page or pages.  This allows the first address of the first
  section to remain semi-constant.  The change was in layout_segments() in
  layout.c to treat MH_DYLINKER outputs much like MH_FVMLIB. Radar bug #3893651.
- Added the -syslibroot <argument> option as another way to specifiy NEXT_ROOT.
  The change was in ld.c .  Radar bug #3886145.

Changes for the 5.17 release (the cctools-555 release):
- Fixed a problem with the fix below in that the new routine
  pass2_nsect_merged_symbol_section_type() in sections.c is needed to not be
  ifdef'ed out for RLD.  Radar bug #3894721.

Changes for the 5.17 release (the cctools-554 release):
- Fixed a bug in legal_reference() in indirect_sections.c that cause it to not
  correctly catch an illegal reference to a weak coalesced symbol that was
  used directly.  The problem was when the reference was made from a .o file
  to a weak coalesced symbol in that .o file, but the weak coalesced symbol
  in that .o file was discarded and the symbol was being used from a different
  .o file.  The code was trying to figure out what type of section was being
  referenced for a merged symbol from the merged symbol's n_sect value.  This
  routine is used in both the first and second passes.  In the second pass the
  merged symbol's n_sect was incorrectly being use as an index into the input
  .o file's section map.  But that was wrong as the merged symbol's n_sect is
  the section number in the output file in the second pass.  To fix this a new
  routine pass2_nsect_merged_symbol_section_type() was added to sections.c to
  correctly get the section type of the N_SECT merged symbol in the output.
  And to know when the merged symbols have been relocated to second pass values,
  the new boolean variable merged_symbols_relocated was added to symbols.[ch]
  and set to TRUE in layout_merged_symbols() in symbols.c .  Radar bug #3884596.

Changes for the 5.17 release (the cctools-553 release):
- Added a bunch of logic and features when LD_PREBIND_SPLITSEGS_ONLY is set.
  This is in main() in ld.c .  Radar bug #3875865.
  - Added logic for LD_UNPREBOUND_LIBRARIES file with a list of files not to
    be prebound when LD_PREBIND_SPLITSEGS_ONLY is set.
  - Added logic for LD_SPLITSEGS_NEW_LIBRARIES to force libraries not listed
    in the seg addr table and not in the LD_UNPREBOUND_LIBRARIES file to be
    built split.

Changes for the 5.17 release (the cctools-552 release):
- Changed ld(1) to write its messages to stderr when in UNIX standard
  conformance mode (the default) and stdout otherwise.  The change was in the
  vprint() routine in ld.c . Radar bug #3762151.
- Changed ld(1) to not write over a non-writeable file when in UNIX standard
  conformance mode (the default) and produce an error instead.  The change was
  in pass2() in pass2.c call the new libstuff routine get_unix_standard_mode()
  and if TRUE call access(2) to see if the file exists and if not writeable
  generate an error. Radar bug #3762029.
- Changed pass2() in pass2.c to not turn on only execute bits allowed by the
  umask(2) call.  Radar bug #3761943.

Changes for the 5.17 release (the cctools-551 release):
- Changed lookup_symbol() in symbols.c to reduce the number of failed strcmp()'s
  by comparing the name size first.  Radar bug #3836837.
  - Added the name_len field to the merged_symbol struct in symbols.h .
  - Changed hash_string() in hash_string.h to take an extra pointer to return
    the size of the string being hashed if not passed as NULL.  Then changed
    the callers of hash_string() in symbols.c, sections.c and
    cstring_literals.c .
  - Changed enter_string() in symbols.c to also take an extra pointer to return
    the size of the string being entered if not passed as NULL.  Then changed
    the callers of enter_string() in symbols.c .
  - Changed lookup_symbol() in symbols.c to first test the size of the name_len
    before doing the strcmp().
  - Changed enter_symbol()'s call to enter_string() to pass the address of the
    new name_len field to the merged_symbol struct so it is set.
- Changed indirect_section_merge() in indirect_sections.c to always set the
  indirect_defined field of a fine_reloc for a symbol in a coalesced sections
  to TRUE if the output filetype is MH_DYLINKER.  Radar bug #3863439.

Changes for the 5.17 release (the cctools-549 release):
- Changed main() in ld.c to turn off prebinding for non-split libraries if
  the environment variable LD_PREBIND_SPLITSEGS_ONLY is set. Radar bug #3855581.
- Changed discard_local_symbols_for_section() in symbols.c to change N_SO stabs
  that are kept but in a block that is not in the output to have an n_value of
  zero and an n_sect of NO_SECT.  This is needed to make the debugger work with
  files linked with -dead_strip.  Radar bug #3854890.

Changes for the 5.17 release (the cctools-538 release):
- When -arch ppc64 is seen on the command line, invoke /usr/bin/ld64
  instead and pass all the arguments to it verbatim. Radar bug #3823359.

Changes for the 5.17 release (the cctools-537 release):
- Changed check_cur_obj() in pass1.c to ignore MH_MAGIC_64 with
  -no_arch_warnings.  Radar bug #3815344.

Changes for the 5.17 release (the cctools-533 release):
- When indirect libraries are removed from dynamic_libs list, a count is kept of
  how many were removed.  This is later used when computing the header padding
  to use.  Radar bug #3784597.

Changes for the 5.16 release (the cctools-528.5 release):
- Fixed a crash in process_undefineds() in symbols.c when the -Y flag is used
  that is caused by the change to 3737622 to not search indirect dylibs.  This
  change causes the cur_obj->undefined_maps[] not to be set up up in for
  indirect dylibs.  The patch is to test to make sure the merged_symbol in the
  map is not NULL before using it.  Radar bug #3797052.
- Changed discard_local_symbols_for_section() in symbols.c to always keep N_SO
  stabs if they are in a block that is not in the output.  This is needed to
  make the debugger work with file linked with -dead_strip.  Radar bug #3739451.

Changes for the 5.16 release (the cctools-528.4 release):
- Added -I flags for building the static libkld to include PrivateHeaders
  because of the changes made in the Tiger kernel header file layout.  Radar bug
  #3782212.

Changes for the 5.16 release (the cctools-528.3 release):
- Don't search indirect libraries when linking two-level.  Radar bug #3737622.
  - In search_dynamic_libs() in pass1.c after the library ordinals for libraries
    are set up, a loop was added to remove some dynamic libraries from the
    dynamic_libs list.  The logic that triggers this seems flawed in cases
    involving linking against flat-namespace libraries or the use of
    -force_flat_namespace.  The loop removes indirectly referenced dylibs.
  - Also in search_dynamic_libs() in pass1.c in the case of searching an
    MH_DYLIB on the dynamic_libs list, when looping through the dylib's
    sub_images a test is made to see of the sub_image dylib does not have
    a library_ordinal assigned to it, and if not it is not searched.
  - In merge_dylib_module_symbols() in symbols.c, in the second loop where
    the symbols referenced by a dylib module are merged as undefined references,
    code was added when resolving a two-level reference from a dylib such that
    if the dependent_image does not have an library ordinal it is skipped.  And
    that undefined symbol will not be searched for.

Changes for the 5.16 release (the cctools-528.2 release):
- Let kld accept duplicate symbols silently if they are absolute and
  have the same value.  Radar bug #3633627.

Changes for the 5.16 release (the cctools-528 release):
- Support the new GENERIC_RELOC_LOCAL_SECTDIFF reloc.  Radar bug #3744821.

Changes for the 5.16 release (the cctools-527 release):
- Support the new PPC_RELOC_LOCAL_SECTDIFF reloc.  Radar bug #3744821.

Changes for the 5.16 release (the cctools-526 release):
- Fixed two error messages in ld.c where it used "-flatname_space" not
  "-flat_namespace".  Radar bug #3743186.
- Fixed warnings for the changes in mach-o headers for types changing from
  unsigned long to uint32_t and from long to int32_t.  Radar bug #3744082.
  - Changed a number of uses of "%lu" to "%u" and "%ld to "%d" in pass1.c,
    sections.c, cstring_literals.c, symbols.c, fvmlibs.c, layout.c,
    4byte_literals.c, 8byte_literals.c and literal_pointers.c .

Changes for the 5.16 release (the cctools-525 release):
- Sped up clear_read_only_reloc_flags() in symbols.c in the normal case. Radar
  bug #3728427.
  - Added static enum bool some_read_only_reloc_flags_set to symbols.c .
  - In flag_read_only_reloc() in symbols.c some_read_only_reloc_flags_set is
    set to TRUE if any merged_symbol's field flagged_read_only_reloc is set
    to TRUE.
  - In clear_read_only_reloc_flags() in symbols.c added code to test
    some_read_only_reloc_flags_set.  If not set then it returns.  If set it
    does its normal work then clears some_read_only_reloc_flags_set.

Changes for the 5.16 release (the cctools-524 release):
- Made work around fixes to the problem with the 24-bit r_address field of a
  scattered relocation entry overflowing when used in a binary for dyld.  Radar
  bug #3451378.
  - Changed the relocation routines:
	ppc_reloc() in ppc_reloc.c
	generic_reloc() in generic_reloc.c
	hppa_reloc() in hppa_reloc.c
	m88k_reloc() in m88k_reloc.c
	sparc_reloc() in sparc_reloc.c
    when output_for_dyld is TRUE to not create a scattered relocation entry for
    external relocation entries with a non-zero offset and to change scattered
    relocation entries into local relocation entries.
  - Changed layout() in layout.c to call the new static routine
    check_for_lazy_pointer_relocs_too_far() which checks to see that the lazy
    pointer's will not be too far away to overflow the the 24-bit r_address
    field of a scattered relocation entry.  If so then prebinding is disabled.

Changes for the 5.16 release (the cctools-520 release):
- Fixed a bug in the handling of PPC_RELOC_JBSR's when the output is a
  multi-module MH_DYLIB.  The code in ppc_reloc() was avoiding relocating the
  branch to the true target in this case when it should have.  Radar bug
  #3545578.
- Added the -v flag to print the version like as(1) does.  The Makefile
  changed how it creates ld_vers.c and ld.c had code added to it to handle the
  -v flag with and without other flags.  Radar bug #3557760.
- Changed the reference to kmodload(8) in rld.c to kextload(8). Radar bug
  #3633604.
- Fixed a bug when -dead_strip was used and there were static symbols in
  indirect sections that was causing all of these symbols to be stripped.
  The fix was in indirect_section_merge() at the end of the routine to add
  a conditional around the call to discard_local_symbols_for_section() so that
  it is called when -dead_strip is specified on the second pass when redo_live
  is true.  Radar bug #3669400.
- Changed it so that lines in an order file starting with '#' are ignored.
  The change was in layout_ordered_section() in sections.c to add check for
  the line starting with '#' and to skip that line.  Radar bug #3360823.
- Changed it so that when an order file is used the unordered symbols are placed
  in what would have been the natural link order.  The change was in 
  layout_ordered_section() in sections.c to move the sort of the load_order
  structure based on the input_offset up from where it was done only
  when -dead_strip.  Radar bug #3382272.
- Fixed a bug when -x was used on a bundle that had a symbol stub for a private
  coalesced symbol.  The symbol stub should have been removed but was not, but
  the symbol was removed resulting in the indirect table entry for the stub
  being for symbol index zero which was wrong.  The fix was in
  indirect_section_merge() in indirect_sections.c to add a test for
  filetype == MH_BUNDLE so fine_relocs[i].indirect_defined will get set to TRUE
  and cause the stub to be correctly removed.  Radar bug #3464004.
- Removed the warning when -dead_strip is used about objects not being compiled
  with -gfull.  As the assumption that the only way this could happen was if it
  was compiled with -gused was incorrect.  The change was in
  remove_dead_N_GSYM_stabs_for_cur_obj() in symbols.c . Radar bug #3663248.
- Fixed a bug when the -s flag was used and a symbol is stripped that is also
  used in an indirect entry.  In this case the indirect entry was not being
  set to INDIRECT_SYMBOL_LOCAL as it should be.  The fix is in
  assign_output_symbol_indexes() in symbols.c to assign the
  merged_symbol->output_index to INDIRECT_SYMBOL_LOCAL for stripped symbols.
  So later when output_indirect_symbols() in indirect_sections.c calls
  merged_symbol_output_index() it will get INDIRECT_SYMBOL_LOCAL.  Radar bug
  #3534709.
- Removed the following warning message:
	    warning("table of contents of library: %s not sorted slower link "
		    "editing will result (use the ranlib(1) -s option)",
		    file_name);
  from pass1_archive() in pass1.c to allow multiple archive members with the
  same coalesced symbol to be placed in the table of contents without getting
  a warning.  Radar bug #3653845.

Changes for the 5.16 release (the cctools-513 release):
- Changed layout_segments() in layout.c and moved the declarations of some local
  variables with #ifdef's for SA_RLD and RLD to the top of the routine so that
  it will compile with older compilers.

Changes for the 5.16 release (the cctools-512 release):
- Fixed a bug when -dead_strip was used when the output was specified as
  -preload and referenced a link editor defined symbol.  The code in 
  mark_globals_live() in symbols.c was crashing as the section_maps were not yet
  set up for the link editor defined preload symbols when it was called.  The
  fix was in define_link_editor_preload_symbols() in symbols.c to change two
  tests of the boolean parameter setup from testing for FALSE to TRUE to cause
  the section_maps and sections to be allocated when the symbols are set up
  rather than waiting for them to be defined.  Radar bug #3649317.
- Fixed a bug that was causing the internal error:
    output_section() count of external relocation entries does not match
  when a undefined reference from a coalesced section turned out to be a global
  coalesced symbol defined in another .o file.  The code in
  coalesced_section_merge() in coalesced_sections.c that was counting the 
  relocation entries needed to have code to set force_extern_reloc when it found
  an external relocation entry that was defined as a global coalesced symbol
  in another .o file.  Radar bug #3644011.
- Removed this debugging code that was left in output_dylib_tables() in
  symbols.c:
	if(mod->iinit_iterm != 0)
	printf("got it\n");
  Radar bug #3643349.
- Fixed a bug when -dead_strip or -sectorder is used on an object file that has
  more than one section with the same name.  This resulted in an internal error
  when fine_reloc_for_input_offset() was called with a section_map where the
  nfine_relocs was zero when counting relocation entries. This can't be handled
  in the code in layout_ordered_section() in sections.c so a test to check for
  an object that has more than one section with the same name was added to cause
  an error.  Also a check for errors != 0 was added to layout_ordered_sections()
  in sections.c and it returns in that case.  Radar bug #3643111.
- Fixed a bug when -dead_strip and -s was used that did not correctly count
  number of undefined symbols and cause the internal error: more than one block
  in final list.  The fix was in assign_output_symbol_indexes() in symbols.c
  that needed for undefined symbol to check to see if -dead_strip was specified
  and the symbol was not live, and if so increment nstripped_merged_symbols.
  Radar bug #3639490.

Changes for the 5.16 release (the cctools-511 release):
- Fixed a bug that did not get the internal alignment correct for fine reloc
  blocks.  This showed up with compiler generated altivec constants who bytes
  get associated with the previous symbol since they have an assembler temporary
  label.  The fix is to align fine reloc blocks on the modulus of the alignment
  of the input offset.  To do this the new static routine align_to_input_mod()
  was added to sections.c .  And it is used instead of just rounding the
  next output offset the section alignment.  It is now called in two places in
  layout_ordered_section() in sections.c and one place in resize_live_section()
  in sections.c.  Radar bug #3625632.

Changes for the 5.16 release (the cctools-509 release):
- Added #ifdef INTERIM_PPC64 to the source changes to support the interim ppc64
  file format.  And added -DINTERIM_PPC64 to the Makefile.
- Changed layout_segments() in layout.c where it created a PPC_THREAD when the
  arch_flag.cputype == CPU_TYPE_POWERPC64 to simply add a conditional when
  creating a ppc thread for CPU_TYPE_POWERPC and CPU_TYPE_VEO instead of
  copying the code.

Changes for the 5.16 release (the cctools-507 release):
- Fixed a bug in qsort_load_order_input_offset() in sections.c that caused
  -dead_strip when used on objects that have more than one symbol at the same
  address to not copy out the sections contents to the correct offsets in the
  output file.  Radar bug #3625582.

Changes for the 5.16 release (the cctools-506 release):
- Fixed a bug in get_fine_reloc_for_merged_symbol() in sections.c if their are
  more than one merged_symbol at the same address it could return the wrong
  fine_reloc.  The fix was to check the merge_symbol field of the fine_reloc
  that the binary search in fine_reloc_for_input_offset() found.  And if it is
  not the same then do a linear search for the fine_reloc looking for the
  merge_symbol. Radar bug #3625582.

Changes for the 5.16 release (the cctools-505 release):
- Fixed a bug in ref_operation() in sections.c when the operation was 
  SEARCH_FOR_LIVE and the ref_type was LIVE_REF_SYMBOL and the merged symbol
  was not live.  In this case the call to walk_references() was passed the
  wrong object_file struct pointer.  It was being passed obj not
  ref->merged_symbol->definition_object.  Radar bug #3625527.
- Fixed a bug in walk_references() in sections.c when it tried to mark the
  indirect symbol live.  The crash was caused for fine_relocs for
  INDIRECT_SYMBOL_LOCAL and INDIRECT_SYMBOL_ABS indirect symbols.  This code was
  not correctly tracking references through indirect sections.  Radar bug
  #3625527. This was fixed by the following:
  - Added the field indirect_symbol_local to the fine_reloc struct in objects.h.
  - In indirect_section_merge() in indirect_sections.c when creating a
    fine_reloc for INDIRECT_SYMBOL_LOCAL and INDIRECT_SYMBOL_ABS if it is
    INDIRECT_SYMBOL_LOCAL then indirect_symbol_local is set to TRUE.
  - Added the new routine indirect_live_ref() to indirect_sections.[ch] to
    return a live_ref for a fine_reloc, section map, and object file.  This is
    used by walk_references() in sections.c to track a reference through an
    indirect section.
  - Changed the code in walk_references() in sections.c to now use the new
    routine indirect_live_ref() in indirect_sections.c to track a reference
    through an indirect section.

Changes for the 5.16 release (the cctools-504 release):
- Added code in main() in ld.c to set -dead_strip when -dylib is used when the
  environment variable LD_DEAD_STRIP_DYLIB is set to aid in testing.

Changes for the 5.16 release (the cctools-503 release):
- Fixed problems with the kld code not having the dead code stripping code
  ifdef'ed out and causing undefined symbol errors.  The function
  is_literal_output_offset_live() was being called from the *_reset_live()
  routines.  Also the variables ninit and nterm were being used in
  mod_section_reset_live() in mod_sections.c. The bodies of the *_reset_live()
  routines and the *_order() routines were ifndef'ed RLD.  These changes were
  made in 4byte_literals.c, 8byte_literals.c, cstring_literals.c,
  literal_pointers.c and mod_sections.c . Radar bug #3625471.

Changes for the 5.16 release (the cctools-502 release):
- Fixed a bug in mod_section_reset_live() in mod_sections.c where it was not
  setting the counts inits and terms back to zero.
- Fixed a problem where output_dylib_tables() in symbols.c was setting the
  module table fields which are indexes into the symbol table to values larger
  then the number of symbols when -dead_strip was specified for fields that
  an zero counts.  Tools like strip(1) detected this as an error.  The fix is
  to set the indexes to zero when the count is zero.
- Fixed a bug where a -sectorder file for a section with the
  S_ATTR_NO_DEAD_STRIP attribute when -dead_strip is specified was ignored.
  The fix was in layout_ordered_section() in section.c when it goes to create
  the fine relocation entries it need a test for ms->order_filename == NULL
  if it was going to create just one fine reloc for the section.
- Fixed a bug where the load map for zerofill symbols was not printing which
  symbols were dead stripped.  The fix was in print_load_map() in layout.c
  where the loop for zerofill sections needed the same code for content
  sections with reguard to testing dead_strip and the live field of the
  fine_reloc and print "(dead stripped)" as needed.
- Fixed a bug where common symbols would not be stripped when no -sectorder
  file was used and when the flag MH_SUBSECTIONS_VIA_SYMBOLS was introduced
  in cctools-501.  The fixes are in define_common_symbols() in symbols.c .
  - In the first loop to determine if commons exist where the number of symbols
    the size of the strings are when there is a sectorder file this is also
    now done when dead_strip == TRUE.
  - Where a symbol table and string table are created when there is a sectorder
    file, it is also created when dead_strip == TRUE.
    - When creating the link_edit_common_object file it is now created with
      a mach_header and the flags have the MH_SUBSECTIONS_VIA_SYMBOLS bit set.
  - Where the entries in the symbol table and string table are set when
    there is a sectorder file, they are also set when dead_strip == TRUE.
- Fixed the error handling when the *_reloc() routines produce an error when
  called via the live marking pass.
  - Added a check of error != 0 in walk_references() in sections.c after it
    calls a *_reloc() routine and returns if error is non-zero.
  - Added a check of error != 0 in walk_references_in_section() in sections.c
    after it calls walk_references() and returns if error is non-zero.
  - Added checks of error != 0 in live_marking() in sections.c after each call
    to walk_references_in_section() and return if error is non-zero.
  - Added a check of error != 0 in layout() in layout.c after live_marking()
    is called and returns if error is non-zero.
- Added support -dead_strip with i386 and m68k architecures.
  - In walk_references() in sections.c the code to test for arch_flag.cputype
    was changed to call generic_reloc() for CPU_TYPE_I386 and CPU_TYPE_MC680x0
    and not print a fatal error that -dead_strip is not supported for that
    architecure.
    - Because walk_references() in sections.c needs to directly use the
      relocation entries when calling the *_reloc() routines and they need to
      be swapped if needed. So to only swap them once in the places they are
      needed a new boolean field, input_relocs_already_swapped, was added to the
      section_map struct in objects.h.  Then code was added to test this field
      and swap the relocs if not already swapped in: 
	walk_references(), count_relocs() and output_section() in sections.c,
	coalesced_section_merge() in coalesced_section.c,
	indirect_section_merge() in indirect_sections.c,
	literal_pointer_merge() in literal_pointers.c and
	mod_section_merge() in mod_sections.c .
  - Changed generic_reloc() in generic_reloc.[ch] to take the additional
    parameters refs and reloc_index.  And added code to set the refs when not
    NULL.
  - Changed the other callers of generic_reloc() to pass NULL and 0 for the
    the two new parameters in count_relocs() and output_section() in sections.c.
- Fixed problems with -dead_strip and -prebind where it was failing to get
  the relocation entries correct for prebound lazy pointers.
  - In reloc_output_for_dyld() in sections.c the code that was calling
    fine_reloc_offset_in_output() when dead_strip was TRUE was removed.
    The setting of the boolean partial_section was changed so it is now set when
    dead_strip == TRUE so the later call to
    fine_reloc_offset_in_output_for_output_offset() will occur and
    correctly ignored relocation entries that are not in the output.
  - The code in fine_reloc_offset_in_output_for_output_offset() in objects.c was
    changed to not check the section type since it is now called from
    from reloc_output_for_dyld() in sections.c when dead_strip == TRUE for
    all section types.
  - The code in fine_reloc_output_offset() in objects.c was changed so that
    when dead_strip == TRUE and fine_reloc->live == FALSE it returns an address
    that is past the end of the section.  This is so
    fine_reloc_offset_in_output_for_output_offset() can be called from
    reloc_output_for_dyld() when dead_strip == TRUE and figure out this reloc
    is not in the output.
  - In fine_reloc_offset_in_output() in objects.c added a needed check for
    fine_reloc->use_contents == FALSE after in the case of dead_strip == TRUE.
    Since it is possible for an indirect entry to be marked live via the
    live code marking pass and use_contents == FALSE.
  - Added the debugging routine print_fine_relocs() to objects.[ch] .
- Fixed it so that the warning message in
  create_load_symbol_hash_table_for_object() about "symbol appears more than
  once in the same file" is not generated when -dead_strip is specified without
  the -sectorder option.  The change was to pass a pointer to the merged_section
  struct through from layout_ordered_section() to
  create_load_symbol_hash_table() and then to
  create_load_symbol_hash_table_for_object() in sections.c so that the warning
  message is only created if ms->order_filename is not NULL.

Changes for the 5.16 release (the cctools-501 release):
- Fixed it so that if a .section_all is specified in an order file and
  -dead_strip is specified, only one fine_reloc is created for that object and
  if anything in that fine_reloc is live it makes all the symbols in that
  fine reloc live.  This is also done if the object is not marked with the new
  MH_SUBSECTIONS_VIA_SYMBOLS bit in the mach_header. Radar bug #2284500.
  - Added the order field to the section_map stucture in objects.h to hold
    the order of sections in objects with no_load_order == TRUE, .section_all
    orders in the order file.
  - Added code in layout_ordered_section() in sections.c when it parse out an
    order line that contains a .section_all it sets the new order field in the
    section_map stucture to the current order and then increments the current
    order being assigned.
  - Changed the conditonal in the code in the middle of layout_ordered_section()
    when it forces no_load_order to TRUE.  So now it does that if a .section_all
    for the object was specified or the no dead strip attribute is on the
    section and -dead_strip was specified.  It also now does this when the new
    MH_SUBSECTIONS_VIA_SYMBOLS bit in the mach_header is not set.
    - Then in this conditonal if the new order field in the section_map stucture
      is not set, it sets it and increments the current order being assigned.
    - The code to create the single load_order was moved to the end of the loop.
  - At the end of this loop if the no_load_order field in the section map is
    TRUE and we are creating a load map or dead stripping then it creates a
    single load_order. And sets the values in the single load_order, it now
    sets the order field of the load_order struct from the new order field of
    the section_map struct.
  - In count_live_symbols() in symbols.c added code to check symbols that are
    not live to see if they are in a fine_reloc that is live.  And if so force
    them to be live.
  - Added the variable some_non_subsection_via_symbols_objects to sections.[ch]
    as a boolean to indicate if any linked in object does not have the
    new MH_SUBSECTIONS_VIA_SYMBOLS bit in the mach_header.
  - In layout_segments() in layout.c added code to test the variable
    some_non_subsection_via_symbols_objects and if FALSE to or in the
    new MH_SUBSECTIONS_VIA_SYMBOLS bit in the output mach_header.
- Fixed a bug in live_marking() in sections.c that did not mark the
  merged_symbol for the entry point live when no -e was specified.
- Added code in main() in ld.c to set the dead_strip if the environment variable
  LD_DEAD_STRIP is set and no_dead_strip_inits_and_terms if
  LD_NO_DEAD_STRIP_INITS_AND_TERMS is set to aid testing.

Changes for the 5.16 release (the cctools-500 release):
- Added the -dead_strip option.  Radar bug #2284500.
  - Added the boolean private_extern variable dead_strip to ld.[ch] and code to
    main() to parse out -dead_strip and set dead_strip to TRUE. 
  - Added a check to make sure -r was not being used with -dead_strip and
    generate an error message.
  - Added a warning to suggest the use of -dead_strip instead of 
    "-undefined define_a_way".
  - Added the live field to the fine_reloc struct in objects.h and 
    changed input_offset to an unsigned long and not part of the bit fields.
  - Added the live field to the merged_symbol struct in symbols.h and 
    changed output_index to an unsigned long and not part of the bit fields.
  - Changed layout_ordered_sections() in sections.c to always call
    layout_ordered_section() if -dead_strip is specified so that fine_relocs
    are created.  Also changed it so that the summary warnings for
    specifications are only printed if there was an order file since this can
    now be called without one.
  - Changed layout_ordered_section() in sections.c when -dead_strip is specified
    to not treat any object that had no orders as if it had a .section_all so
    that fine_relocs for all blocks get created.  Two tests of dead_strip were
    added to handle this.  In the first case the load_orders are re-sorted by
    input_offset so it is less likely to break assembly code by reording the
    blocks by symbol name.
  - Added the index field to the struct load_order in objects.h to record the
    symbol index of the symbol in layout_ordered_section().  So later if it is
    external the merged symbol can be looked up and the merged_symbol field of
    the file_reloc can be set.  This is needed so later ref_operation() can mark
    the merged symbol live if referenced via a local relocation entry.  Which
    is needed to know to keep the symbol.
    - As part of the setting of the merged_symbol field of the file_reloc above
      a test for the start_section symbol is needed.  So the new field
      start_section was added to the section_map in objects.h and is set in
      layout_ordered_section() so it can be used later.
  - Changed flush_scatter_copied_sections() to also check dead_strip == TRUE
    as well as if the section has an order file so that output_flush() gets
    called.
  - Changed all places that a pointer to a merged_symbol was stored in the
    output_offset field of a fine_reloc struct and now store it in the
    merged_symbol field.  In cctools-312 for Radar bug #2417690 the
    merged_symbol field was added to the fine_reloc struct so that for non-lazy
    symbol pointers both the output_offset and merged_symbol can be stored (see 
    notes for cctools-312 and Radar bug #2417690 for details).
    - Changed 2 places in coalesced_section_merge() in coalesced_sections.c .
    - In one place in indirect_section_merge() in indirect_sections.c removed 
      the store of merged_symbol into output_offset.
    - Changed 1 place in legal_reference() in indirect_sections.c .
    - Changed 3 places in fine_reloc_output_address() in objects.c .
    - Changed 1 place in fine_reloc_output_sectnum() in objects.c .
  - Changed mod_sections.[ch] and added a struct mod_term_data to be used to
    set the output_offsets in the fine relocs that are now created in 
    mod_section_merge() when -dead_strip is specified.
    - This is now allocated in create_merged_section() in sections.c .
    - The new routine mod_section_free() was added to reset the output_offset
      in this data. And a pointer to this functions is set in
      create_merged_section() in sections.c .
    - Changed flush_scatter_copied_sections() to allow call output_flush()
      when dead_strip == TRUE and it is a mod init or term section.
   - Added a call to the new routine, live_marking(), in layout() in layout.c
     if dead_strip == TRUE just after the call to layout_ordered_sections().
   - Added the new routine, live_marking(), to sections.[ch] .
     - it marks the initial live symbols:
       - it marks the entry point and fine_reloc or the first non-zero sized
	 fine_reloc in the first content section.  To do this the load_map
	 structures are needed.
	 - in layout_ordered_section() in sections.c the load maps are not
	   free()'ed and create_order_load_maps() is called when dead_strip
	   is TRUE.
	 - The new static routine get_fine_reloc_for_merged_symbol() was added
	   and is used here for getting the fine_reloc if the entry point was
	   specified by symbol name and for the -init symbol (see next item)
	   as well as ref_operation() (see below).
       - it marks the -init symbol for MH_DYLIB outputs.
       - it calls the new routine mark_globals_live() added to symbols.[ch]
	 to mark the exported and no_dead_strip symbols live.
       - it calls the new routine mark_N_NO_DEAD_STRIP_local_symbols_live()
	 added to symbols.[ch] to mark the fine_relocs for no_dead_strip local
	 symbols live.
	 - mark_N_NO_DEAD_STRIP_local_symbols_live() loops over the merged
	   sections and calls
	   mark_N_NO_DEAD_STRIP_local_symbols_in_section_live() for each merged
	   section.
	   - mark_N_NO_DEAD_STRIP_local_symbols_in_section_live() loops over
	     the objects and if it contains the merged section loops over the
	     local symbols looking for symbols defined in the section with the
	     N_NO_DEAD_STRIP bit set.  And if set, gets the fine_reloc for it
	     and marked it live.
     - it then loops over the merged sections and calls the new static
       routine walk_references_in_section() with the operation MARK_LIVE to
       cause the live fine relocs to get marked live.
	- walk_references_in_section() with the operation MARK_LIVE looks for
	  live fine_relocs in the specified section and causes their references
	  to be marked live by calling the new static routine walk_references()
	  with the operation MARK_LIVE.
	  - walk_references() with the operation MARK_LIVE walks the relocation
	    enties of the passed fine_reloc marking its references live.  It
	    calls the relocation routines passing it two new parameters, a
	    pointer to the new live_refs struct and the index of the relocation
	    entry.  Then calls new static routine ref_operation() with the
	    operation MARK_LIVE to mark the reference live and cause its
	    reference's to be marked live.
	    - The new header file live_refs.h was added with the declaration
	      of the struct live_refs, live_ref, and the live_ref_type enum.
	    - Two new parameters to ppc_reloc() were added, refs and
	      reloc_index.  If refs is not NULL then ppc_reloc() just fills
	      in the live_refs struct for the reloc_index.
	      - A test for refs == NULL was added in the if statement that was
		checking if the merged_symbol was a coalesced symbol that is
		using get_output_section() on the merged_symbol n_sect.  This
		is needed as the output_sectnum field is not set when this is
		called to just get the references.
	      - The new routine fine_reloc_output_ref() was added to objects.c
		to take an offset into a section and a section map and determine
		what it will reference in the output and fill in a live_ref
		struct.  It handles symbols stubs and is like
		fine_reloc_output_address() but get references.
	    - The new static routine ref_operation() with the operation
	      MARK_LIVE takes a live_ref struct and determines the fine_reloc
	      if any for it and marks it live.  Then causes its reference's to
	      be marked live by recursively calling walk_references() with the
	      operation MARK_LIVE if needed.
	      - The new boolean field refs_marked_live was added to the
		fine_reloc structure to indicate if the reference's have been
		walked and marked live and is tested and set by ref_operation() 
		with the operation MARK_LIVE.
	      - The new static routine r_symbolnum_from_r_value() was added to
		sections.c which is used by ref_operation() to help get the
		fine_reloc from a live_ref which is a LIVE_REF_VALUE.
     - Added the -no_dead_strip_inits_and_terms option.
	- Added the boolean private_extern variable
	  no_dead_strip_inits_and_terms to ld.[ch] and code to
	  main() to parse it out and set the variable to TRUE.
     - live_marking() then causes the needed mod init and term routines to be
       marked live.  When -no_dead_strip_inits_and_terms is set is marks all
       of them live, if not this is done by looping over the merged sections and
       calling the new static routine walk_references_in_section() for mod
       init and term sections with the operation SEARCH_FOR_LIVE.
	- walk_references_in_section() with the operation SEARCH_FOR_LIVE for
	  each fine_reloc calls the new routine walk_references() with the
	  operation SEARCH_FOR_LIVE to see it it touches something live. 
	  If so marks it live and calls walk_references() with the MARK_LIVE
	  operation to get what it refererences marked live.
	  - The new boolean field searched_for_live_refs was added to the
	    fine_reloc structure to indicate if the reference's have been
	    walked and searched for live references it is tested and set by
	    the new routine walk_references() when the operation is
	    SEARCH_FOR_LIVE.
	  - walk_references() with the operation SEARCH_FOR_LIVE is passed a
	    fine_reloc searches for any referenced fine_reloc that is marked
	    live.  If it finds one it returns TRUE else FALSE.
     - live_marking() then causes the needed fine_reloc's in sections with the
       live_support attribute to be marked live.  This gets done my looping
       over the merged sections for sections marked with the S_ATTR_LIVE_SUPPORT
       section attribute and calling the new static routine
       walk_references_in_section() with the operation CHECK_FOR_LIVE_TOUCH.
	- This follows a similar path as above for SEARCH_FOR_LIVE through
	  walk_references_in_section(), walk_references() and ref_operation()
	  but only looks at the direct references for the fine_reloc.  And if
	  a direct reference is live then it causes all references to be marked
	  live.
     - the new routine, live_marking(), then does the bookkeeping to reset
       the symbol counts, section sizes, relocation counts:
       - The existing global varable, nstripped_merged_symbols, in symbols.c
	 is used to hold the count of dead symbols to be stripped.  Then later
	 if assign_output_symbol_indexes() sets STRIP_DYNAMIC_EXECUTABLE it is
	 reset to zero and the counts of stripped symbol are again added up.
	 This works as any symbol that would be saved when both -dead_strip
	 and -s are used on a dynamic executable would be live since they
	 are REFERENCED_DYNAMICALLY.
       - the new routine count_live_symbols() was added to symbols.[ch] and
	 called from layout().  When creating a  multi-module dylib it
	 updates the number of reference and reference map counts and reassigns
	 the indexes in to the reference table.  It also increments the new file
	 level static variable nstripped_merged_private_symbols for merged
	 private symbols that get stripped to be used later by
	 assign_output_symbol_indexes() to do its consistency check.
	 - The new static routine removed_dead_local_symbols_in_section() was
	   added to symbols.c and is called from count_live_symbols() to
	   call discard_local_symbols_for_section() for each object that
	   contains the merged section it is passed.
	   - Updated fine_reloc_offset_in_output() in objects.c to return at
	     fine_reloc->live when dead_strip == TRUE.
	   - Updated discard_local_symbols_for_section() in symbols.c to now
	     also scan forward when it sees a N_BNSYM that well be kept to the
	     next N_ENSYM so the stabs between them are kept.
	 - The new static routine remove_dead_N_GSYM_stabs() was added to
	   symbols.c and is called from count_live_symbols() to call another
	   new static routine remove_dead_N_GSYM_stabs_for_cur_obj() to get rid
	   of dead N_GSYM stabs.  For common symbols this has to be done as they
	   are not defined or in a section and so they can't be bracked by
	   N_BNSYM/N_ENSYM stabs.
      - The new routine resize_live_sections() was added to sections.[ch]
	and called from layout() to do the bookkeeping to reset the section
	sizes and relocation entry counts.
	- The new field fine_reloc was added to the load_order struct in
	  objects.h to point to the fine_reloc that was created for it.  This is
	  then set to the fine_reloc in layout_ordered_section() when
	  -dead_strip is specified.
	- The new field load_order was added to the struct order_load_map in
	  sections.h to point to the fine_reloc that corresponds to it.  This is
	  then set in create_order_load_maps() in sections.c which is always
	  called when -dead_strip is specified.
	- The new static routine resize_live_section() was added to sections.c
	  to walk the load order map and resize each regular section and called
	  by resize_live_sections() for regular sections.
	  - The new field line_number was added to the load_order structure
	    defined in objects.h.  And set to the line number the symbol was
	    specified on in the order file in layout_ordered_section() or left
	    as zero.  Then in resize_live_sections() if the section had an order
	    file and the flag -sectorder_detail was specified and the symbol was
	    dead stripped a warning is issued if order_specified is non-zero.
	- Changed the name of layout_relocs_for_dyld() to relayout_relocs() in
	  sections.[ch] .  Changed the call to it in layout() so it is called
	  if output_for_dyld is TRUE or dead_strip is TRUE.
	  - After layout_relocs_for_dyld() has broken everything out a test of
	    the dead_strip flag for TRUE is made and if so a call
	    fine_reloc_offset_in_output() with the broken out r_address is done
	    to see if it will be in the output.  If
	    fine_reloc_offset_in_output() returns FALSE the reloc is skiped.
	- Changed count_relocs() in sections.c now that is also called when
	  dead_strip is specified:
	  - After it has broken everything out a test of the dead_strip flag for
	    TRUE is made and if so a call fine_reloc_offset_in_output() with
	    the broken out r_address is done to see if it will be in the output.
	    If fine_reloc_offset_in_output() returns FALSE the reloc is skiped.
	  - Right after the above a test for output_for_dyld == FALSE is done
	    and if so the reloc is counted based only on if the reloc is extern
	    and the symbol is defined.
      - The routine merge_literal_sections() in sections.c was changed to take
	a new parameter redo_live parameter.  Then in the exisiting call from
	layout() in layout.c it is pass as FALSE.  Then it is called again after
	resize_live_sections() in layout.c passed as TRUE to drive the
	re-merging only live literals.  When merge_literal_sections() is passed
	redo_live as TRUE it calls the new (*literal_reset_live)() routines
	instead of the (*ms->literal_order)() routines.  It was also changed to
	pass the redo_live parameter to the (*ms->literal_merge)() routines.
	- Changes to the existing (*ms->literal_order)() routines were made to
	  support ordering when -dead_strip is specified.  The routines were
	  changed as follows:
	  - cstring_order() in cstring_literals.c and
	  - literal4_order() in 4byte_literals.c and
	  - literal8_order() in 8byte_literals.c and
	  - In literal_pointer_order() in literal_pointers.c
	    These now allocates a new *_load_order_data struct when -dead_strip
	    is specified and the needed new struct *_order_line's.  For
	    cstring_order() and literal_pointer_order() they do not free the
	    line buffer or the order file memory.  These new structs are used in
	    *_reset_live() routines and the needed memory is cleaned up in
	    there.
	  - In literal_pointer_order() in literal_pointers.c the body of code
	    that parses out a literal pointer order line was broken out into a
	    static function literal_pointer_order_line() so it can be used both
	    by literal_pointer_order() and literal_pointer_reset_live().
	- The new routine is_literal_output_offset_live() in sections.[ch] was
	  added and used in the (*ms->literal_reset_live)() functions to
	  determine if a literal from an order file with a given output_offset
	  is live.
	- The new field literal_reset_live as added to the merged_section
	  struct in sections.c as a pointer to the routine that resets the
	  literal section before only the live literals are re-merged.
	  - A new routine for the (*ms->literal_reset_live)() field was added
	    to the files that handle each type of literal and they do the
	    following:
	    - cstring_reset_live() added to cstring_literals.[ch] and
	    - literal4_reset_live() added to 4byte_literals.[ch] and
	    - literal8_reset_live() added to 8byte_literals.[ch]
	      They reset the section size back to zero and clear out the
	      previously merged data. Then if there is an order file it
	      re-merges the live literals and frees up the order data
	      structures.
	    - literal_pointer_reset_live() added to literal_pointers.[ch] and
	    - mod_section_reset_live() added to mod_sections.[ch]
	      Same as the new routines above but also resets the relocation
	      counts.
	    - indirect_section_reset_live() added to indirect_sections.[ch]
	      Same as the new routines above but also in additiona to reseting
	      the relocation counts it resets nindirectsyms.
	  - In create_merged_section() in sections.c the literal_reset_live
	    field is set to the above new routines.
	- The new redo_live parameter was added to the (*ms->literal_merge)()
	  call in merge_literal_sections().
	  - A new redo_live parameter was then added the existing literal merge
	    routines and updated to use it as follows:
	    - cstring_merge() in cstring_literals.[ch] and 
	    - literal4_merge() in 4byte_literals.[ch] and
	    - literal8_merge() in 8byte_literals.[ch] and
	    - literal_pointer_merge() in literal_pointers.[ch] and
	    - mod_section_merge() in mod_sections.[ch] and
	    - indirect_section_merge() in indirect_sections.[ch]
	    - coalesced_section_merge() in coalesced_sections.[ch]
	      When redo_live == FALSE these merges items as it did before.
	      When redo_live == TRUE it uses the previouly allocated fine_relocs
	      and re-merges the items for fine_relocs that are live.
	      - The new boolean field global_coalesced_symbol was added to the
		load_order struct in object.c.
		- It is set and examined in coalesced_section_merge() now
		  instead of using the hack to store this information in the
		  order field.
  - Changed scatter_copy() in sections.c to look at the "live" field if
    -dead_strip specified.
  - Removed the unused local variable prev_output_offset from
    layout_ordered_section() in sections.c .
  - Changed print_load_map() in layout.c to print "(dead stripped)" for symbols
    that are not live when -dead_strip is specified.
  - Changed print_load_map_for_objects() in layout.c to print "(dead stripped)"
    for the output address of a fine_reloc block that is not live when
    -dead_strip is specified.  Also fixed it for indirect and coalesced sections
    to print "(eliminated)" if the fine_reloc block is not used from that object
    file.
  - Changed layout() in layout.c after the call to process_undefineds() to add
    a check of errors for non-zero and return.
  - Changed process_undefineds() in symbols.c to ignore undefined symbols if
    -dead_strip is specified and the undefined symbol is not live.
  - Changed assign_output_symbol_indexes() to used the new file level static
    variable nstripped_merged_private_symbols set by count_live_symbols() for
    its consistency check of the number of local symbols it assigns indexes to.
    Also changed the loop that counts the number of undefined symbols and
    defined external symbols to skip symbols that are not live when -dead_strip
    is specified.  As well as the loop that fills the arrays in.  And the loop
    that assigns the symbol indexes to the private extern symbols if they are
    turned into local symbols.
  - Changed output_merged_symbols() in symbols.c so that the second loop to put
    out private extern symbols that are turned into local symbols test that the
    symbol is live when -dead_strip is specified.
  - Changed output_merged_symbols() in symbols.c so that the three loops to put
    symbols clear the N_NO_DEAD_STRIP bit if the output file is not a
    relocatable object.
  - Changed output_local_symbols() in symbols.c so that it clears the
    N_NO_DEAD_STRIP bit if the output file is not a relocatable object and the
    symbol is a non-stab N_SECT symbol.
  - Changed output_dylib_tables() in symbols.c in putting out the reference
    table in the single-module dylib case.  In the loop over the merged symbols
    to a test was added to check the symbol is live when -dead_strip is
    specified.
- Fixed a bug in check_symbol() in symbols.c that was incorrectly causing an
  error when a common symbol was also a private extern symbol as it was not
  checking that the n_value field was also zero before causing the error for
  undefined symbols.  Radar bug #3518234.
- Fixed a bug in print_load_map() in layout.c that did not correctly limit the
  segment name and section names to 16 characters when printed.
- Fixed a bug in layout_segments() in layout.c where it was causing a thread to
  be created in bundle.
- Fixed a bug printing the load maps when some objects have no symbols in the 
  order file. In this case the code in layout_ordered_section() in section.c
  creates just one fine_reloc for the whole section in the object.  This is not
  accounted for in the creation of the order_load_maps by
  create_order_load_maps() in sections.c.  To fix this layout_ordered_section()
  when load_map == TRUE now free()'s the load_orders for these and allocates
  just one load_order with a NULL symbol_name to represent this.  The code in
  create_order_load_maps() and print_load_map() in layout.c was changed to
  handle the NULL symbol_name;
- Fixed a bug in merge_sections() in sections.c that was not correctly or'ing in
  the SECTION_ATTRIBUTES from object's section into the merged section.  Two
  places were changed when dynamic == TRUE.

Changes for the 5.16 release (the cctools-499.3 release):
- Make symbol reference checking in legal_reference() of indirect_symbols.c
  understand that ppc64 indirect symbol table entries are 8 bytes. Radar bug
  #3594978.

Changes for the 5.16 release (the cctools-499.1 release):
- Added support for the ppc64 architecture, using the interim file format
  for -static compiled objects only.  Radar bug #3562133.
  - Changed indirect_section_merge() in ld/indirect_sections.c so the stride
    for symbol pointers is set 8 when arch_flag.cputype ==  CPU_TYPE_POWERPC64
    and 4 otherwise.  Also changed the test of r_length in the  relocation
    entries to be 3 for CPU_TYPE_POWERPC64 and 2 otherwise.
  - Changed layout_segments() in layout.c to create a PPC_THREAD when the
    arch_flag.cputype == CPU_TYPE_POWERPC64 .
  - Changed ppc_reloc() in ppc_reloc.c to include cases for r_length being 3
    and relocating the second long and setting the first long to zero.
  - In output_section() in sections.c the conditional to call ppc_reloc() was
    changed to include arch_flag.cputype == CPU_TYPE_POWERPC64.

Changes for the 5.15 release (the cctools-499 release):
- Fixed a bug with linking .o files containing PPC_RELOC_JBSR relocation entries
  in a coalesced section into a dynamic library. The code in
  coalesced_section_merge() in coalesed_sections.c did not exclude these in the 
  output.  Which resulted in a internal error in output_section() where the 
  count of local relocation did not match.  Radar bug #3518096.

Changes for the 5.14 release (the cctools-497 release):
- Fixed a bug with linking .o files containing PPC_RELOC_JBSR relocation entries
  into a dynamic library. The code in count_relocs() and reloc_output_for_dyld()
  in sections.c did not exclude these in the output.  Which resulted in a read
  only reloc error.  Radar bug #3452964.

Changes for the 5.14 release (the cctools-496 release):
- Change in a number of places in pass1.c that printed "Logging for Build &
  Integration] Used static library" to print the realpath() name of the file
  name.  Radar bug #3443289.

Changes for the 5.13 release (the cctools-495 release):
- Changed the header pad for prebound executables to be 3 times instead of 6
  times the size of the initial LC_PREBOUND_DYLIB commands.  This change is in
  layout_segments() in layout.c .  Radar bug #3410151.

Changes for the 5.13 release (the cctools-494 release):
- Changed the header pad for prebound executables to include 6 times the size
  of the initial LC_PREBOUND_DYLIB commands.  This change is in
  layout_segments() in layout.c .  Radar bug #3410151.

Changes for the 5.13 release (the cctools-490 release):
- Fixed a bug in check_cur_obj() in pass1.c that was incorrectly causing the
  output cpusubtype to be set when linking against a dylib or a bundle_loader
  with a specific cpusubtype.  Radar bug #3387962.

Changes for the 5.13 release (the cctools-485 release):
- Fixed some bugs in the use of flags that force the weak linking of dynamic
  libraries when an umbrella is force weak linked and their are only references
  to symbols in its sub-frameworks.  Two fixes were in setup_sub_images() in
  pass1.c to check the force_weak_dylib of the umbrella library being set up and
  if TRUE set force_weak_dylib in the sub-frameworks and sub-umbrellas.
  The other fix was in output_headers() in pass2.c to test for the library
  having force_weak_dylib set and then using LC_LOAD_WEAK_DYLIB even it no
  symbols are referenced. Radar bug #3337262.

Changes for the 5.13 release (the cctools-484 release):
- Fixed a bug in that was causing an error message when a -bundle_loader 
  executable had a __UNIXSTACK segment.  The fix was in check_cur_obj() in
  pass1.c where it needed to check for a segment name of SEG_UNIXSTACK and not
  issue an error about the segment having no sections.  Radar bug #3329902.

Changes for the 5.13 release (the cctools-483 release):
- Fixed a bug in the handling of -lx when the string x contained a dot character
  like -ltcl8.4 .  In pass1() in pass1.c the code to parse out things like
  -lcrt0.o used the same char * variable p as the code that follows it to then
  parse out and search for the library.  Because the string ended in a ".4" this
  caused the broken logic to free the variable p when it was not malloc'ed
  leading to a warning message printed by malloc().  Radar bug #3285575.

Changes for the 5.13 release (the cctools-480 release):
- Changed zero_merged_sections_sizes() in sections.c (which is used only for
  kld_load()) to also zero out the section alignment of existing sections.
  Radar bug #3261751.

Changes for the 5.13 release (the cctools-479 release):
- Added the -executable_path <path_name> option where <path_name> is is used to
  replace @executable_path for dependent libraries.  The change was in
  open_dylib() in pass1.c as well in ld.[ch] .  Radar bug #3278995.

Changes for the 5.12 release (the cctools-477 release):
- Picked up changes to kld interfaces.  Changes in rld.c and layout.c .
  Radar bug #3270588.

Changes for the 5.12 release (the cctools-473 release):
- Fixed a bug with the use of a modulus operator on a signed value which caused
  a crash.  The fix was to cast to unsigned long not long.  The problem was in
  lookup_indirect_item() in indirect_sections.c when it used the modulus
  operator to come up with a hash value.  Radar bug #3255992.

Changes for the 5.12 release (the cctools-472 release):
- Moved the #ifndef RLD in output_local_symbols() in symbols.c down so that
  the call to swap_nlist() is not ifdef'ed out.  This allows cross building of
  a kernel's symbol file with kld.  Radar bug #3251273.

Changes for the 5.12 release (the cctools-471 release):
- Backed out the change to call to _exit() in ld_exit() in ld.c in Radar bug
  #3237013 as it does not flush the stdio buffers.  Then changed the handler()
  routine in ld.c used for signals to not call ld_exit() and instead unlink(2)
  the output file if one was created and call _exit(1).  Radar bug #3245341.
- Fixed a problem in the kld libraries where the code that was not ignoring the
  alignment of non-regular non-zerofill sections from the base file.  A missing
  #ifdef KLD and test of the base file was needed on one more place in
  merge_sections() in sections.c .  Radar bug #3245534.

Changes for the 5.12 release (the cctools-470 release):
- Changed the call to exit() in ld_exit() in ld.c to _exit as it was causing a
  hang in dyld when used with signal handlers.  Radar bug #3237013.
- Added the flag -search_paths_first to cause -lx flags to search each path
  for .dylib then .a before searching next path.  Radar bug #3176974.
  - Added the enum bool variable search_paths_first to pass1.c and pass1.h and
    code to parse out the option and set variable in main() in ld.c .
  - The new static routines search_paths_for_lname() and search_path_for_lname()
    were added to pass1.c .
  - In pass1() in pass1.c a test of the new search_paths_first variable is done
    and if TRUE then search_paths_for_lname() is called.

Changes for the 5.12 release (the cctools-468 release):
- Added support to force a dynamic library to be marked weak in the output.
  This can be done using these three flags:
    -weak_framework Foo
    -weak-lx
    -weak_library library_filename
  Radar bug #3069758.
  - Added parsing out "-weak_framework", "-weak-lx"and "-weak_library" to
    ld.c and calling pass1() with the force_weak parameter as TRUE.
  - Added the new boolean parameter force_weak to pass1() in pass1.c and
    pass1.h . Changed the existing calls to pass1() in ld.c to pass the new
    boolean parameter force_weak as FALSE.
  - Added the new boolean parameter force_weak to pass1_fat(), pass1_archive()
    and pass1_object() in pass1.c .  Propagated the passing of this new
    parameter down through the calls.  And passed it as FALSE in call to
    pass1_fat() and pass1_object() from open_dylib().
  - Added the new boolean parameter force_weak to merge() in pass1.c .  And
    passed this as the parameter force_weak parameter or FALSE in the existing
    calls.
  - Added the new boolean parameter force_weak to merge_dylibs() in dylibs.c and
    dylibs.h .  After the call to add_dynamic_lib() the parameter force_weak is
    set into the field force_weak_dylib in the dynamic_library struct.
  - Added the boolean field force_weak_dylib to the dynamic_library structure
    in pass1.h .
  - Changed merge_dylib_module_symbols() in symbols.c to test the
    force_weak_dylib field of the dynamic_library structure and if TRUE set the
    N_WEAK_REF bit on the merged symbol to mark the symbol as a weak reference.

Changes for the 5.12 release (the cctools-468 release):
- Added support for the new use of the previously unused value 3 for r_length
  to mean that the conditional branch was predicted using the Y-bit and the
  sign of the displacement and opcode.  Radar bug #3223045.
  - Changed ppc_reloc() in ppc_reloc.c to correctly flip the Y-bit for
    PPC_RELOC_BR14 r_types with an r_length value of 3 for branch conditions
    that are not branch always and the sign of the displacement is different
    after relocation.
- Fixed a problem when linking against stub libraries that the dependencies of
  the stub libraries were getting recored in the output file.  This caused them
  to have LC_LOAD_DYLIB load commands which inturn messed up the recorded
  library ordinals.  The fix is in merge_dylibs() in dylibs.c to add a check
  that the object's file type was not MH_DYLIB_STUB.  Radar bug #3220772.

Changes for the 5.12 release (the cctools-467 release):
- Added support for the PPC_RELOC_LO14_SECTDIFF relocation type used with
  double word load/store instructions. Radar bug #3218027.
  - Changed ppc_reloc() in ppc_reloc.c treat a PPC_RELOC_LO14_SECTDIFF as it
    other PowerPC section difference relocation entries and expect it to have
    a pair.   And added cases for PPC_RELOC_LO14_SECTDIFF to relocate it as it
    would for PPC_RELOC_LO14.

Changes for the 5.12 release (the cctools-466 release):
- Added the new treatment of "-undefined define_a_way" to define all undefined
  symbols as private extern symbols.  This is a temporary work around to not
  having dead-code stripping that also strips the undefined references from
  dead code.  Radar bug 3216770.
  - Added the undefined_check_level enum UNDEFINED_DEFINE_A_WAY to ld.h .
  - Added parsing out "-undefined define_a_way" in main() in ld.c and modified
    checks to allow its use with -twolevel_namespace.
  - Added the define_a_way bit field in the merged_symbol struct in symbols.h .
  - Added the define_undefined_symbols_a_way() routine to symbols.c and
    symbols.h .  This routines sets up the undefined symbols to be defined and
    sets the define_a_way bit field in the merged_symbol.
  - Added code at the end of define_link_editor_dylib_symbols() in symbols.c to
    loop through the symbol table and set the address of the symbols with the
    define_a_way bit field set.
  - In layout() in layout.c after it sets up the link editor defined symbols
    a check of the undefined_flag for UNDEFINED_DEFINE_A_WAY is made and if so
    a call to define_undefined_symbols_a_way() is made.
- Fixed the incorrect casts on the comparison of the nlist struct's n_strx field
  where the value being compared to was casted to a long.  The correct fix was
  to cast n_strx to an unsigned long.
- Added the "-undefined dynamic_lookup" option for use in two-level namespace
  images to all undefined symbols to be looked up dynamically with flat
  namespace semantics.  Radar bug #3210803.
  - Added the undefined_check_level enum UNDEFINED_DYNAMIC_LOOKUP to ld.h .
  - Added parsing out "-undefined dynamic_lookup" in main() in ld.c and modified
    checks to allow its use with -twolevel_namespace.  Also added checks when
    "-undefined dynamic_lookup" is not allowed for -static and when
    MACOSX_DEPLOYMENT_TARGET is less than 10.3 .
  - Changed process_undefineds() in symbols.c to changed its check of 
	undefined_flag != UNDEFINED_SUPPRESS
    to  
	(undefined_flag == UNDEFINED_ERROR ||
	 undefined_flag == UNDEFINED_WARNING)
    and added an else cause to that if to check if undefined_flag is
    UNDEFINED_DYNAMIC_LOOKUP and then set the library ordinal to
    DYNAMIC_LOOKUP_ORDINAL if -r is not used and two-level namespace is in
    effect.
  - Changed check_symbol() in symbols.c to not treat a symbol with the library
    ordinal DYNAMIC_LOOKUP_ORDINAL as an error.
  - Changed merge_dylib_module_symbols() in symbols.c in the second loop that
    loops through the symbols referenced by the dylib module when it is doing
    symbol tracing to check the library_ordinal for DYNAMIC_LOOKUP_ORDINAL.
    And if it is DYNAMIC_LOOKUP_ORDINAL not use it as a library ordinal and
    let it just get printed as an unbounded reference.
  - Changed merge_dylib_module_symbols() in symbols.c in the second loop where
    it resolves the undefined references and changed the logic where it selects
    how to resolve the symbol.  It now sets a new boolean, resolve_flat, based
    on the old logic plus looking at library_ordinal for DYNAMIC_LOOKUP_ORDINAL.
  - Changed search_dynamic_libs() in pass1.c when it is has an undefined symbol
    from a two-level namespace image to check the library ordinal for
    DYNAMIC_LOOKUP_ORDINAL and if so treat it an internal error.  Since the
    above change to merge_dylib_module_symbols() should never let this happen.
  - Also added this same check as above and internal error message to
    process_undefineds() in symbols.c in two places.  Also added a missing
    check in the loop looking for previous undefined two-level namespace symbols
    that did not check the twolevel_reference field before using the
    library_ordinal.  And added a check for DYNAMIC_LOOKUP_ORDINAL in the
    loop the prints the references in the -Y loop.

Changes for the 5.12 release (the cctools-464 release):
- Changed the they way N_BINCL stabs with non-zero n_value fields are handled so
  the n_value is not changed.  Radar bug #3201935.
  - Added field input_N_BINCL_n_value to the struct localsym_block in symbols.h
  - In merged_symbols() in symbols.c when a new N_BINCL is found the n_value
    of the N_BINCL nlist is saved in the input_N_BINCL_n_value field.  And if
    not zero the variable sum is set to that value.  Later when a new symbol in
    the group in encountered if input_N_BINCL_n_value is not zero then the
    string for that symbol is not sum'ed.

Changes for the 5.12 release (the cctools-464 release):
- Made changes to build cleanly with gcc3.3
  - Removed -Wno-precomp from the Makefile
  - Fixed warnings for "comparison between signed and unsigned" in ld.c,
    layout.c, pass2.c, literal_pointers.c, pass1.c, rld.c and  sets.c .

Changes for the 5.12 release (the cctools-463 release):
- Added support for linking against MH_DYLIB_STUB libraries. Radar bug #3193744.
  - Added a check for the MH_DYLIB_STUB filetype along with MH_DYLIB in
    merge_symbols() in symbols.c .
  - Added the testing of the filetype not being MH_DYLIB_STUB along with
    testing of the section type not being S_ZEROFILL before checking the size
    and offset of the section contents in check_cur_obj() in pass1.c .
  - Added the testing for MH_DYLIB_STUB along with MH_DYLIB in a few places
    in check_cur_obj() in pass1.c for various error checks.
  - Changed the setting of cur_obj->dylib in check_cur_obj() in pass1.c to
    include the MH_DYLIB_STUB filetype.

Changes for the 5.12 release (the cctools-462 release):
- Fixed a bug in the displacement overflow checking of a PPC_RELOC_BR14
  relocation entry.  The mask that was used was 0xfffe0000 which should
  have been 0xffff8000 in the PPC_RELOC_BR14 cases in ppc_reloc.c .
  Radar bug #3190434.

Changes for the 5.12 release (the cctools-457 release):
- For the -single_module dylib case the symbol stubs for coalesced private
  extern symbols were not being removed when they could be.  The change is in
  indirect_section_merge() in indirect_sections.c after the test if the
  merged symbol is a coalesced symbol the if statement on line 373.  An
  additional case was added to the if expression such that if the output file
  is a dylib and not multi-module and the symbol is private extern then the
  expression is TRUE and indirect_defined is set to TRUE.  Radar bug #3163714.

Changes for the 5.12 release (the cctools-456 release):
- Changed XBS_TRACE_BUNDLE_LOADER to LD_TRACE_BUNDLE_LOADER in ld.c. Radar bug
  #3152604.

Changes for the 5.12 release (the cctools-454 release):
- Fixed a bug when using the -m flag and having a multiple definition of a
  private extern symbol.  The problem was in merge_symbols the counts of
  private exterals are first incremented.  Then after multiply_defined() is
  called a check was needed to see if allow_multiply_defined_symbols is TRUE
  (the -m flag specified) and the counts for private exterals needed to be
  decremented.  Radar bug #3143764.
- Fixed a bug when creating an indirect symbol when the referenced symbol is
  a private extern symbol that causes an internal overlap error.  Radar bug
  #3134759.
  - Added code in reduce_indr_symbols() in symbols.c so the N_PEXT bit is
    checked and then the counts of private exterals (nmerged_private_symbols)
    and the object's count (nprivatesym) are incremented.
  - Changed assign_output_symbol_indexes() in symbols.c to check the N_PEXT
    bit of the indirect symbol if the symbol is N_INDR to correctly determine
    if the symbol is a private extern symbol in the two places it checks this
    bit.

Changes for the 5.12 release (the cctools-450 release):
- Added some double quotes in the Makefile around uses of `pwd` to be "`pwd`" so
  if this were in a directory with a space it would work.  Radar bug #3114622.
- Changed is_output_local_symbol() in symbols.c to strip symbols in sections
  with the S_ATTR_STRIP_STATIC_SYMS attribute.  To do this n_ssect and the
  object struct that the symbol came from is passed to is_output_local_symbol().
  Radar bug #3114458.
- Changed the -x flag to strip private externs that will be local symbols in the
  output file.  Radar bug #3114182.
  - Changed is_output_local_symbol() in symbols.c for the STRIP_NONGLOBALS case
    (the -x flag) to return FALSE causing all local symbols to be stripped.
    This strips private externs that were local symbols in the input object
    files.
  - Changed assign_output_symbol_indexes() in symbols.c to rebuild the merged
    string table if we are stripping non-globals and we are not keeping private
    externs and we have some private externs in the merged symbol table, and the
    output is not a multi-module dylib.  Then if this is the case the number of
    private externs in each object is added to nstripped_merged_symbols so those
    symbols are not counted.
  - Changed output_merged_symbols() in symbols.c to check the strip_level for
    STRIP_NONGLOBALS, and the output is not a multi-module dylib and not put ou
    private externs in this case.

Changes for the 5.12 release (the cctools-447 release):
- Fixed a problem with -x not stripping STABS with the P_EXT bit on them.  The
  odd stab:
	00000000 - 00 0000    3c gcc2_compiled.
  was not stripped because of a bug in is_output_local_symbol() in symbols.c in
  the STRIP_NONGLOBALS because it did not first check for N_STAB bits in n_type.
  Radar bug #3104019.
- Added the -noprebind_all_twolevel_modules flag that overrides the setting
  of the environment variable LD_PREBIND_ALL_TWOLEVEL_MODULES.  The changes are
  in ld.c . Radar bug #3055372.
- Fixed a bug that was causing dynamic libraries that had nothing referenced in
  them that also were used indirectly that did have symbols indirectly
  referenced in them to be LC_LOAD_WEAK_DYLIB.   The problem was that references
  from dylibs that were were causing the some_symbols_referenced field to be
  set for the dylib.  The fix was to merge_dylib_module_symbols() symbols.c
  where it sets some_symbols_referenced. Radar bug #3094497.
- Removed the const off of link_edit_common_object in symbols.[ch] to get rid
  of warnings and since it is now written on.

Changes for the 5.11 release (the cctools-446 release):
- Changed it so that when -s is used on a dynamic dynamic executable it rebuilds
  the string table in assign_output_symbol_indexes() in symbols.c so that the
  symbol names for the discarded symbols don't end up in the string table.
  Radar bug #3089997.
- Fixed a bug when using an export list and not listing a common symbol would
  cause an internal overlap error.  Radar bug #3088916.
  - Changed define_common_symbols() in symbols.c right after 
    exports_list_processing() is called to check the N_PEXT bit and increment
    the counts of private exterals.  Both the object's count (nprivatesym) and 
    the global count (nmerged_private_symbols).
  - Changed assign_output_symbol_indexes() in symbols.c to add the 
    link_edit_common_object object to the list of objects before counting
    and assigning indexes to private extern symbols.  Then at the end of the
    loop copying back the updated object and taking it back off the list.

Changes for the 5.11 release (the cctools-445 release):
- Changed the semantics of -s on dynamic executables to do the same stripping
  as strip(1) with no arguments.  That is only save undefined symbols and
  global symbols marked referenced dynamically.  Radar bug #2545288.
  - Added the STRIP_DYNAMIC_EXECUTABLE enum value to strip_levels in ld.h .
  - Added the variable nstripped_merged_symbols to symbols.c and symbols.h to
    set to the number of merged symbol being stripped out.  This is non-zero
    when the strip_level is STRIP_DYNAMIC_EXECUTABLE.
  - Changed assign_output_symbol_indexes() in symbols.c so that if strip_level
    is STRIP_ALL and has_dynamic_linker_command is set to change strip_level
    to STRIP_DYNAMIC_EXECUTABLE;
  - Changed assign_output_symbol_indexes() to assign indexes to only undefined
    symbols and global symbols marked referenced dynamically and add up the
    number of merged symbol being stripped out into nstripped_merged_symbols.
  - Added the case label for STRIP_DYNAMIC_EXECUTABLE in
    is_output_local_symbol() in symbols.c to also return FALSE.
  - Changed output_merged_symbols() in symbols.c to check the strip_level for
    STRIP_DYNAMIC_EXECUTABLE and the REFERENCED_DYNAMICALLY of the symbol
    and not put out those symbols in that case.
  - Changed layout_segments() in layout.c when setting the 
    linkedit_segment.sg.filesize and output_symtab_info.symtab_command.nsyms
    to subtract nstripped_merged_symbols.
  - Fixed a typo in an error message in output_indirect_symbols() in
    indirect_sections.c (changed "containg" to "containing").

Changes for the 5.11 release (the cctools-444 release):
- Added the -exported_symbols_list and -unexported_symbols_list flags.  Radar
  bug #3083844.
  - Changes in ld.c and ld.h for adding the save_symbols and remove_symbols
    variables and parsing and checking the flags.  As well as checking to see
    that the symbols were seen after pass1.
  - Changed merge_symbol() in symbols.c to check if the symbol is on the
    save_symbols or remove_symbols list and set the N_PEXT bit as needed.
- Fixed a problem with ppc JSR's and doing an ld -r where the JBSR has an
  external relocation entry and the symbol is not defined in the output.
  The code in ppc_reloc.c was:
                   if(r_extern){
                       value += offset;
                       other_half = value;
                   }
                   else{
                       value += other_half;
                       other_half = value;
                   }
  And in the case of an external relocation entry where the symbol was 
  undefined 'offset' was not set.  For JBSR external relocation entries the
  offset part of "symbol+offset" is stored in the PAIR relocation entry in
  'other_half'.  This is because the displacement of the bl instruction is for
  the branch island.  So the correct code works out to be the same as the 
  non-extern case and was changed to just this:
                   value += other_half;
                   other_half = value;
  Radar bug #3054747.

Changes for the 5.11 release (the cctools-443 release):
- Added the -single_module and -multi_module flags.  Radar bug #3080780.
  - Changes in ld.c and ld.h for adding the boolean multi_module_dylib and
    parsing and checking the flags.
  - Changed one place in coalesced_sections.c in coalesced_section_merge()
    where the number of relocation is determined.  The MH_DYLIB case was changed
    to include multi_module_dylib == TRUE.
  - Changed two places in the relocation routines in generic_reloc.c,
    i860_reloc.c, m88k_reloc.c, sparc_reloc.c, hppa_reloc.c and ppc_reloc.c.
    For external relocation entries where the symbol is defined, if the output
    file is a multi_module dylib no relocation is done unless the symbol is a
    private extern or we are prebinding.  In this case the relocation entry is
    left as extern.  For single_module dylibs the relocation is done and the
    relocation entry turned into a local relocation entry.
  - Changed two places in the relocation routines in hppa_reloc.c and
    ppc_reloc.c for JBSR relocations.  The JBSR relocation code does not do
    relocation if multi_module dylib. but will do it for a single_module dylib.
  - Changed indirect_sections.c in indirect_section_merge() in three places:
    - The fine relocation entry for defined external symbols are kept in dylibs
      if it is a multi_module dylib (not kept for single_module dylibs).
    - The check external relocation entries resolving to private extern being is
      flagged as an error is only done for multi_module dylibs.
    - The code that counts up the relocation entries, was changed in the dylib
      case to include multi_module_dylib == TRUE.
  - Changed literal_pointers.c in two places:
    - In literal_pointer_merge() the check external relocation entries resolving
      to private extern being is flagged as an error is only done for
      multi_module dylibs.
    - In the static count_reloc() routine where the number of relocation is
      determined, the MH_DYLIB case was changed to include
      multi_module_dylib == TRUE.
  - Changed objects.c in three places:
    - In object_index() zero is returned when multi_module_dylib == FALSE.
    - In fine_reloc_output_address() if the reloc is in a symbol stub section
      and the symbol is defined and it is not in a multi_module dylib then
      the merge symbol value from the fine_reloc is used.
    - In fine_reloc_output_sectnum() if the reloc is in a symbol stub section
      and the symbol is defined and it is not in a multi_module dylib then
      the merge symbol section number from the fine_reloc is used.
   - Changed sections.c in three places:
    - In layout_relocs_for_dyld() the check that merged sections don't have
      any external relocation entries in dylibs had multi_module_dylib == TRUE
      added to it.
    - In count_relocs() the dylib case for the code counting the number of
      relocation entries had multi_module_dylib == TRUE added to it.
    - In reloc_output_for_dyld() a matching change for the above change to
      count_relocs() was made for the dylib case addin multi_module_dylib ==TRUE
      to it.
  - Changed many places in symbols.c:
    - In the routine merge_symbols()
  	- The number of defined externals is now only counted in the multi
	  module dylib case (need to be able allocate the reference maps).
  	- For a merged symbol that is a weak definition that is discarded, the
	  symbol counts for the reference map are adjusted and the reference
	  flags are updated only in the multi_module dylib case.
  	- The reference map flags are only set in the multi_module dylib case.
    - In the routine command_line_symbol() and command_line_indr_symbol() the
      reference map flags are set only in the multi_module dylib case.
    - In the routine merge_dylib_module_symbols() and
      merge_bundle_loader_symbols() for a merged symbol that is a weak
      definition that is discarded, the symbol counts for the reference map are
      adjusted and the reference flags are updated only in the multi_module
      dylib case.
    - In define_common_symbols() a check for multi_module dylib is made and
      it is an error if there is a common symbol to define.  Also the traceing
      of commons is not done in dylib if multi_module_dylib == TRUE.
    - In setup_link_editor_symbols() the code is not changed for the one place
      that MH_DYLIB is used.  As the reference table will be ignored and
      output_dysymtab_info.dysymtab_command.nextrefsyms will be reset 
      layout_dylib_tables() for single module dylibs.
    - In output_merged_symbols() the N_INDR symbols are set to the defining
      symbol if it is a multi_module dylib and defined in the same object or
      in a single module dylib.
    - In layout_dylib_tables() the existing code for the reference table and
      module table where placed in if statements with multi_module_dylib == TRUE
      and new code was added for the single module case.  For the reference
      table its size is reset based on the defined and undefined merged symbols.
      The module table size is one and a variable, dylib_single_module_name, was
      added to save the pointer to the module name in the merged symbol table.
    - In output_dylib_tables() the existing code for the reference table and
      module table where placed in if statements with multi_module_dylib == TRUE
      and new code was added for the single module case.  For the reference
      table its is built from the merged symbol table's defined and undefined
      symbols.  The one module table entry is built from the a variable,
      dylib_single_module_name, which is a pointer to the module name in the
      merged symbol table and the values in output_dysymtab_info.
   -Changed mod_sections.c and mod_sections.h so that ninit and nterm were
    extern so that output_dylib_tables() in symbols.c could use
    them for the single module dylib module table entry.

Changes for the 5.11 release (the cctools-440 release):
- Fixed the warnings about extra tokens at end of #endif directive in
  4byte_literals.c, 8byte_literals.c, coalesced_sections.c, cstring_literals.c,
  fvmlibs.c, generic_reloc.c, hppa_reloc.c, i860_reloc.c, indirect_sections.c,
  layout.c, ld.c, literal_pointers.c, m88k_reloc.c, mod_sections.c, objects.c,
  pass1.c, pass2.c, ppc_reloc.c, rld.c, sections.c, sets.c, sparc_reloc.c,
  specs.c, symbols.c, 4byte_literals.h, cstring_literals.h, fvmlibs.h,
  indirect_sections.h, layout.h, literal_pointers.h, make_defs.h, objects.h,
  pass1.h, sections.h, sets.h, specs.h, symbols.h, ld.h and 8byte_literals.h
  (Radar bug #3072042).

Changes for the 5.11 release (the cctools-439 release):
- Made the needed changes to sections.c and layout.c for VEO support.  Radar
  bug #3068161.
- Added setting up a signal handler for SIGBUG and SIGSEGV.  Radar bug #3062745.
- Changed the fix for Radar bug #3037279 for the bug in indirect_section_merge()
  in indirect_section.c when the symbol was a weak coalesced symbol.  A check
  was added to make sure the symbol was not also a private extern that would
  become a static symbol.  Radar bug #3054990.
- Fixed a bug that was not allowing dynamic libraries to be set to 
  LC_LOAD_WEAK_DYLIB.   The problem was that references from dylibs that were
  non-weak were causing the some_non_weak_refs to be set for the dylib.  The
  fix was to merge_dylib_module_symbols() symbols.c where it sets
  some_non_weak_refs. Radar bug #3051119.

Changes for the 5.11 release (the cctools-437 release):
- Fixed many bugs in the handling of PPC_RELOC_JBSR in ppc_reloc() in
  ppc_reloc.c .  Radar bug #3046962.
- Fixed a bug in check_archive_arch() in pass1.c if the -no_arch_warnings flag
  is used.  The code should have returned FALSE without printing the error
  message not TRUE.  Radar bug #2986587.
- Fixes a bug in open_dylib() in pass1.c where if an error occured in
  pass1_object() it did not check the error count and could return TRUE.
  Radar bug #2999466.

Changes for the 5.11 release (the cctools-436 release):
- Fixed a bug in indirect_section_merge() in indirect_section.c where
  fine_relocs[i].indirect_defined was being set to TRUE when the symbol was
  a weak coalesced symbol when it shouldn't have been.  This caused the stub
  in an executable to be removed for a weak coalesced symbol and thus call the
  wrong symbol.  A global weak coalesced symbol is used by the C++ compiler
  when the -fexport-coalesced option is used.  The problem resulted in an
  uncaught exception.  This is because the exception info correctly used a
  non-lazy symbol pointer which was pointing to a different weak coalesced
  symbol for the one that was actually being used by the program.
  Radar bug #3037279.

Changes for the 5.10 release (the cctools-432 release):
- Fixed a bug in merge_dylib_module_symbols() and merge_bundle_loader_symbols()
  in symbols.c in the change introduced in the change to cctools-425.  The loop
  variable j was used in this code but should not have been as j was still live
  from the outer loop.  Radar bug #2969353.
- Fixed a bug where an undefined symbol was being put out with the "weak
  definition bit set".  This is an error if seen again by ld(1) as an undefined
  symbol is not a definition and can't have the "weak definition bit set".
  This can happen when a weak definition is first seen then a non-weak
  definition is seen from a dynamic library.  The fix was in
  output_merged_symbols() in symbols.c to clear this bit for all undefined
  symbols.  Radar bug #2969501.
- Fixed a bug where the error message about "illegal reference to indirectly 
  referenced symbol defined in a dynamic library" should not have been printed
  in the case -r was used.  The fix was in both merge_dylib_module_symbols()
  and process_undefineds() in symbols.c to add "save_reloc == FALSE" to the
  if expression for this error message.  Radar bug #2969437.

Changes for the 5.10 release (the cctools-431 release):
- Fixed a bug in the reloc routines that resulted in the error:

    ld:internal error: output_section() count of external relocation entries
    does not match

  This happened when the object had an undefined reference to a symbol defined
  in another object file as a coalesed symbol (and -bundle was used and so
  -prebind was not used).  The logic to forced to be an external relocation
  entry needed to be moved down in the routine outside of the undefined
  map lookup.  This change was made in all the *_reloc.c files.
  Radar bug #2963045.

Changes for the 5.10 release (the cctools-427 release):
- Fixed a bug where a bad two-level namespace linked image was produced when
  a symbol from an object was discared and became an illegal reference to an
  indirectly referenced dylib.  Changes were in both symbols.h and symbols.c .
  The new fields definition_library and non_dylib_referenced_obj were added to
  the merged_symbol struct.  Then code to set these was added in merge_symbol*()
  routines.  The code to produce the error message was added in
  process_undefineds().  Radar bug #2956332.

Changes for the 5.10 release (the cctools-426 release):
- The fix below was still incomplete.  A final pass over the reference table
  was needed in layout_dylib_tables() in symbols.c to set the reference type
  correctly.  This was needed when multiple weak private externs were seen
  then a non-weak global symbol was seen.  In this case the "private" reference
  needs to be changed when the final merged symbol is not a private extern.

Changes for the 5.10 release (the cctools-425 release):
- The fix below was only done in merge_symbols() but it also needed to be done
  in merge_dylib_module_symbols() and merge_bundle_loader_symbols().
  Radar bug #2952209.

Changes for the 5.10 release (the cctools-424 release):
- Fixed a bug when creating a dynamic library where a merged symbol that was a
  weak private extern that was later discarded for a non-weak symbol had the
  wrong reference type.  The reference type was incorrectly based on the merged
  symbol that was being discared not the object symbol that was to be used.
  Radar bug #2952209.

Changes for the 5.10 release (the cctools-421 release):
- Ifdef'ed out reset_prebound_undefines() in symbols.c and the call to it in
  layout.c with #ifndef RLD in hope to fix Radar bug #2931331.
- Added the -nofixprebinding flag to mark the binary with MH_NOFIXPREBINDING
  in the mach header flags.  Changes in ld.c, ld.h and layout.c.  Radar bug
  #2941669.

Changes for the 5.10 release (the cctools-420 release):
- Changed the #ifdef's around get_output_section in symbols.c for the fix below
  in cctools-419.  The libkld libraries were missing this symbol.  Radar bug
  #2936244.

Changes for the 5.10 release (the cctools-419 release):
- Fixed a bug in the reloc routines when the object that contains a coalesed
  that is a weak definition that was discared for a non-coalesed symbol.  In
  this case relocation entry on output should not be forced to be an external
  relocation entry.  The logic that sets force_extern_reloc had one more
  expression added to it to check if the merged symbol to see if it was N_SECT
  and if the output section was a coalesced section.  This change was made in
  all the *_reloc.c files.  Radar bug #2931708.

Changes for the 5.10 release (the cctools-417 release):
- Fixed a bug legal_reference() in indirect_sections.c that did not correctly
  allow references to coalesced symbols that were local.  Radar bug #2925564.

Changes for the 5.10 release (the cctools-416 release):
- Changed merge_dylib_module_symbols() in symbols.c to not generate any multiply
  defined errors or warning about symbols coming from indirectly referenced
  dynamic libraries.  Radar bug #2921080.
- Changed one of the checks in legal_reference() in indirect_sections.c to not
  use the S_ATTR_WEAK_DEFS attribute and assume any coalesced section could
  contain blocks which are not used because they were for weak_definition
  symbols. Radar bug #2919646.
- Changed the checking for a weak definition in merge_symbols() in symbols.c 
  (three places) to now test the N_WEAK_DEF bit rather than N_SECT type and
  S_ATTR_WEAK_DEFS section attribute.  Made this same change in 
  merge_dylib_module_symbols() in symbols.c in (4 places).  Made this same
  change in merge_bundle_loader_symbols() in symbols.c (4 places).  And also
  made this same change in trace_symbol() in symbols.c (1 place). Radar bug
  #2919646.
- Added checks in check_symbol() in symbols.c to check that weak definitions,
  the N_WEAK_DEF bit, are only in global symbols in a coalesced sections.
  Radar bug #2919646.
- Removed the internal N_WEAK_DEF constant from symbols.c since this in now
  part of <mach-o/nlist.h>.  Radar bug #2919646.
- Removed the check in check_cur_obj() in pass1.c for the S_ATTR_WEAK_DEFS
  attribute.  Radar bug #2919646.
- Changed the last warnings in check_archive_arch() in pass1.c for archive's
  cputype not matching should not be printed if -no_arch_warnings is specified.
  Radar bug #2918296.

Changes for the 5.10 release (the cctools-415 release):
- Changed legal_reference() in indirect_sections.c to deal correctly with
  coalesced sections with the S_ATTR_WEAK_DEFS attribute.  Radar bug #2911339.

Changes for the 5.10 release (the cctools-414 release):
- Changed trace_symbol() and process_undefineds() to print "weak reference" for
  symbols with the N_WEAK_REF bit set.  And changed trace_symbol() to print
  "weak definition" for symbols in a section with the S_ATTR_WEAK_DEFS
  attribute.  Also added a internal N_WEAK_DEF constant used in the n_desc field
  that trace_symbol() uses to print "weak definition".  This is used with the
  new pbud_weak_def_symbol struct.  And the pbud_weak_def_symbol is used in
  merge_dylib_module_symbols() for symbols in sections with the S_ATTR_WEAK_DEFS
  attribute for tracing. Radar bug #2898558.
- Added code in merge_symbol(), merge_dylib_module_symbols() and
  merge_bundle_loader_symbols() to handle global weak coalesced symbols defined
  in objects or dylibs. Radar bug #2898558.
- Added code in merge_symbol() to keep the N_WEAK_REF bit of merged symbols for
  undefined symbols that are getting resolved to S_ATTR_WEAK_DEFS symbols, so
  that later if a non-weak definition from a dylib is used the weak reference is
  retained.  Changes were also needed in two places in output_merged_symbols()
  to make sure the N_WEAK_REF bit is cleared on symbol definitions. Radar bug
  #2898558
- Added weak_def_in_dylib bit in a merged_symbol struct in symbols.h .  Radar
  bug #2898558
- Added support for private_extern weak_definitions in coalesced sections.  The
  only really supported form is private extern symbols from a coalesced section
  with the weak_definitions attribute in the .o files being linked.  And
  optionally one true definition (also a private extern) from any section also
  from the .o files being linked.  The changes were a couple of added if cases
  in merge_symbols.c in symbols.c just before it handles two coalesced symbols.
  Radar bug #2898558.
- Added a check in check_cur_obj() in pass1.c to make sure the weak_definitions
  attribute, S_ATTR_WEAK_DEFS, is only used with a coalesced section type.
  Radar bug #2898558.
- Added a check in merge_dylibs() in merge_dylibs.c to make sure the libraries
  being linked against don't have the same install_name as the output.  Radar
  bug #2890446.

Changes for the 5.10 release (the cctools-412 release):
- Added a check in layout_segments() in layout.c that checks to make sure the
  total number of sections in the output is less than MAX_SECT so to not produce
  bad object files.  Radar bug #2882553.
- Added the -sect_diff_relocs flag which takes the arguments suppress, warning,
  and error.  As well as the LD_SECT_DIFF_RELOCS environment variable which can
  be set to the same suppress, warning, and error values.  Note these are only
  used when both -dynamic and -execute are in effect.  This causes the code in
  reloc_output_for_dyld() in sections.c to flag objects being linked that have
  section difference relocation entries in them.  The default is suppress.
  Radar bug #2870529.

Changes for the 5.10 release (the cctools-411 release):
- Moved some of the macosx_deployment_target code into libstuff and changed
  the code in here to use the libstuff code.  Radar bug #2848945.

Changes for the 5.10 release (the cctools-407 release):
- Made -run_init_lazily obsolete and removed all support execpt printing a
  warning when the flag is used.  Changes in ld.c and layout.c .

Changes for the 5.10 release (the cctools-403 release):
- Changed the all target in the makefile to not depend on $(RC_OS)_lib_ofiles
  but rather lib_ofiles and added the kld_build to the all target so that the
  default make all builds everything.
- Changed the macos_lib_ofiles_install target in the Makefile to work when
  $SYMROOT is not set.  So the top level Makefile can do a make install and
  work by default.

Changes for the 5.10 release (the cctools-402 release):
- Removed the hack in the Makefile to use cc when $(CC) is gcc3 when linking
  prehack_libkld.a to work around Radar bug #2814731.

Changes for the 5.10 release (the cctools-400 release):
- Changed the Makefile back to again use the -dependency-file with gcc.
- Changed the hack in the Makefile to use cc when $(CC) is gcc3 when linking
  prehack_libkld.a to work around Radar bug #2814731.

Changes for the 5.10 release (the cctools-397 release):
- Added the -multiply_defined_unused flag with the default being suppress.
  Changes in ld.c, ld.h, layout.c where
  twolevel_namespace_check_for_unused_dylib_symbols() is called and in
  pass1.c in twolevel_namespace_check_for_unused_dylib_symbols().  Radar bug
  #2835152.
- Changed ppc_reloc() in ppc_reloc.c to not change the Y-bit of PPC_RELOC_BR14
  relocation types.
- Added the support for the MACOSX_DEPLOYMENT_TARGET environment variable.
  Changed the code to switch LC_PREBIND and weak references off this value and
  removed the POST_MACOSX_10_1 macro from the Makefile.  Changes in symbols.c
  layout.c and pass2.c.  Radar bug #2830042.
- One more change in search_dynamic_libs() in pass1.c the "Logging for Build &
  Integration] Used dynamic library" to print the realpath() name of the file
  open(2)'ed and not the install name.  Radar bug #2826775.

Changes for the 5.10 release (the cctools-396 release):
- Change in search_dynamic_libs() in pass1.c the "Logging for Build &
  Integration] Used dynamic library" to print the name of the file open(2)'ed
  and not the install name.  Radar bug #2826775.
- Added support for the -weak_reference_mismatches flag in ld.c and ld.h.
- Added the bit field
    weak_reference_mismatch:1, /* seen both a weak and non-weak reference */
  to the merged_symbol struct in symbols.h
- Added code to merge_symbols() in symbols.c to set the weak_reference_mismatch
  field in the merged_symbol struct based on the symbols being merged and the
  setting of the -weak_reference_mismatches flag.
- Added a loop in process_undefineds() in symbols.c to print the symbols that
  had weak reference mismatches.
- Changed the use of N_WEAK_SYM to N_WEAK_REF in symbols.c .
- Added a hack in the Makefile to use cc when $(CC) is gcc when linking
  prehack_libkld.a to work around Radar bug #2814731.
- Changed the Makefile to not use the -dependency-file with gcc as well as
  mwccppc.

Changes for the 5.10 release (the cctools-394 release):
- Added LD_FORCE_NO_PREBIND environment variable to override the command line
  and the LD_PREBIND environment variable.  Radar bug #2814402.
- Changed it so that the LC_PREBIND_CKSUM and the LC_LOAD_WEAK_DYLIB commands
  are not used unless RC_RELEASE is Proton or Jaguar.  Changes were in Makefile,
  layout.c and pass2.c using the POST_MACOSX_10_1 cpp macro.

- To avoid creating LC_LOAD_WEAK_DYLIB for umbrella libraries that generally
  have no symbols referenced from them, LC_LOAD_WEAK_DYLIB are only created
  if some symbols are referenced and all of them are referenced weak.

  Added the some_symbols_referenced field to the dynamic_library struct in
  pass1.h.

  Added setting the some_symbols_referenced field to TRUE in
  merge_dylib_module_symbols() in symbols.c when a symbol is used from a dylib.

  Changed the code output_headers() in pass2.c to check the both the
  some_symbols_referenced field and the some_non_weak_refs of the corresponding
  dynamic_library to if to put out a command for the dylib of either
  LC_LOAD_DYLIB or LC_LOAD_WEAK_DYLIB.

Changes for the 5.10 release (the cctools-393 release):
- Added code to support weak dynamic shared libraries.

  Changed the merged_dylib struct in dylibs.h to have a pointer to the
  corresponding dynamic_library library struct.  This is then filled in by
  merged_dylibs() in dylibs.c.

  Added the some_non_weak_refs field to the dynamic_library struct in pass1.h.

  Added a test of the N_WEAK_SYM bit in merge_dylib_module_symbols() in
  symbols.c and if not set then set the new some_non_weak_refs field in the
  dynamic_library struct to TRUE.

  Changed the code output_headers() in pass2.c to check the some_non_weak_refs
  of the corresponding dynamic_library to see it is TRUE to put out a load
  command for the dylib of either LC_LOAD_DYLIB or LC_LOAD_WEAK_DYLIB.

  Added the testing for LC_LOAD_WEAK_DYLIB where LC_LOAD_DYLIB in other places
  in dylibs.c and pass1.c .

- Fixed a bug in the code for the prebind_all_twolevel_modules option at the
  end of search_dynamic_libs() in pass1.c that was setting mh too earily that
  caused it to crash when p pointed to a dynamic_lib that was an archive.

Changes for the 5.10 release (the cctools-390 release):
- Fixed a bug in parsing the -headerpad_max_install_names in ld.c that caused
  it to eat the next parameter in the second parsing loop.

Changes for the 5.10 release (the cctools-389 release):
- Added the -headerpad_max_install_names option.  Changes in ld.c and layout.c. 
- Fixed a bug that occured when prebinding was disabled becaused of overlapps
  that produced the output with a bad load command (zero size).  This was the
  LC_PREBIND_CKSUM that the the code in layout.c accounted for but was not put
  out in pass2.c becuse prebinding was disabled.  The code in pass2.c was
  changed to put out the LC_PREBIND_CKSUM load command if it was set up in
  layout.c and not if prebinding was still enabled.
- Added the -prebind_all_twolevel_modules flag and the environment variable
  LD_PREBIND_ALL_TWOLEVEL_MODULES which causes all modules in a two-level name
  space prebound library to be marked as used in the linked_modules bit vector
  in the LC_PREBOUND_DYLIB load command.  The changes were in ld.c, ld.h and
  pass1.c at the end of search_dynamic_libs().  Radar bug #2784627.
- Changed layout_segments() in layout.c to not set the bits in the mach header
  for dyld outputs unless output_for_dyld is set.  Radar bug #2787764.

Changes for the 5.10 release (the cctools-387 release):
- Added the -seg_addr_table_filename option.
- Fixed a bug in ppc_reloc.c where it was not picking up the sign of the
  original displacement of a BR14 instruction and then incorrectly flipping the
  Y-bit.  Radar bug #2765281.

Changes for the 5.10 release (the cctools-386 release):
- Added the code to copy the checksum load command into the output buffer in
  output_headers() in pass2.c .
- Added creating the prebind checksum load command in layout_segments() in
  layout.c .
- Added the output_cksum_info struct for the prebind checksum load command to
  layout.h .
- In check_cur_obj() in pass1.c added code to check a LC_PREBIND_CKSUM command.

Changes for the 5.10 release (the cctools-385 release):
- Changed libkld.a and libkld.dylib from object files to archives.

Changes for the 5.9 release (the cctools-382 release):
- Fixed the change below for cctools-381.  The ifndef RLD should only have been
  around twolevel_namespace_hints_specified not twolevel_namespace_hints.
- Fixed the building of static_kld when $(SRCROOT) = . which needed otmp_obj
  after libmacho/otmp_obj in the Makefile.

Changes for the 5.9 release (the cctools-381 release):
- Added an ifndef RLD around the definition of twolevel_namespace_hints so that
  it would not get a warning when the ofiles_install target is built.

Changes for the 5.9 release (the cctools-380 release):
- Added the -twolevel_namespace_hints option which is off by default for bundles
  and on otherwise.  The changes are in ld.c, layout.c, symbols.c and pass2.c.
  Radar bug #2735266.

Changes for the 5.9 release (the cctools-377 release):
- Fixed a problem with the change below in cctools-376 to process_undefineds()
  in symbols.c that would not build when RLD was defined.

Changes for the 5.9 release (the cctools-376 release):
- Fixed a bug in search_dynamic_libs() in pass1.c that should not have free()'ed
  the "fake" merged_symbol when -Y was used.  This caused the code in
  process_undefineds() in symbols.c to crash.
- Fixed a bug in process_undefineds() in symbols.c that was not correctly
  reporting undefined symbols for the -Y flag correctly.  It should not have
  had the expression
      merged_symbol->twolevel_reference == TRUE
  when testing for undefined symbols.

Changes for the 5.9 release (the cctools-375 release):
- Fixed a bug in fine_reloc_output_sectnum() in objects.c where it should do
  the same thing for lazy pointer sections as well as non-lazy pointer
  sections.  This case showed up when a non-pic symbol stub was used for a local
  symbol.  In this case the relocation entry to the lazy pointer was not a
  scattered relocation entry so fine_reloc_output_sectnum() was being called
  by ppc_reloc.c.  In the case for a local symbol the lazy pointer will not be
  in the output so it does not even matter what the section number being
  returned is.
- Fixed ld(1) to correctly support the semantics of two-level namespace library
  references.  Radar bug #2716249.

  The basic approach is was to "fake" up a merged_symbol with the new
  twolevel_reference bit set and add it to the undefined list in
  merge_dylib_module_symbols() in symbols.c when it was merging a dylib module
  from a two-level namespace dylib.

  Then search_dynamic_libs() would look for these entries in the undefined list
  and search for the dylib module that defines them name call
  merge_dylib_module_symbols() to load the specified dynamic library.

  Changes to process_undefineds() in symbols.c were also needed to check for
  remaining two-level references and report them correctly.

  Changed search_dynamic_libs() in pass1.c to always set up the sub_images even
  if -twolevel_namespace is not in effect as it is needed when a two-level
  namespace library is used to resolve its references with the correct
  semantics.

  Added the twolevel_reference bit and the referencing_library field to the
  merged symbol struct in symbols.h.

- Removed a number of #ifndef RLD #endif pairs from symbols.c that were already
  inside an outer #ifndef RLD #endif pair.  These were inside the functions
  command_line_indr_symbol(), merge_dylib_module_symbols() and
  merge_bundle_loader_symbols() and all around the calls to
  tell_ProjectBuilder().

Changes for the 5.9 release (the cctools-373 release):
- Changed the default to -twolevel_namespace in ld.c.  Also adding setting
  twolevel_namespace to FALSE for -force_flat_namespace and -static.  Also
  removed some #ifdef notdef code after the testing of LD_TWOLEVEL_NAMESPACE.

Changes for the 5.9 release (the cctools-371 release):
- Added a log message ""[Logging for XBS] Referenced bundle loader: <path>" when
  the environment variable XBS_TRACE_BUNDLE_LOADER is set where <path> is the
  argument of -bundle_loader if set.  Radar bug #2710229.

Changes for the 5.9 release (the cctools-370 release):
- Added the -nomultidefs flag to ld(1) to set the MH_NOMULTIDEFS flag in the
  mach header.
- Added support in ld(1) for the two-level namespace hints optimization.  Radar
  bug #2558069.

  The following field was added to the struct merged_symbol in symbols.h:
    /*
     * For two-level namespace hints this is the index into the table of
     * contents for the definition symbol in the dylib it is defined in,
     */
    unsigned long itoc;

  In search_dynamic_libs() in pass1.c code was added to set the itoc field in
  the merged symbol after it was found in a DYLIB.
    if(twolevel_namespace == TRUE)
	undefined->merged_symbol->itoc = toc - q->tocs;

  Also in merge_dylib_module_symbols() in symbols.c the itoc of a merged
  symbol is set if not zero as the symbol in the merged symbol table could be
  a common or undefined.  This changed required the function dylib_bsearch() in
  pass1.c to now be extern rather than static.  Also with this the
  variable strings and symbols were changed to bsearch_strings and
  bsearch_symbols in pass1.c and made extern rather than static.

  The following new struct was added to layout.[ch] to hold info about the
  hints:
    /*
     * The output file's two level hints load command.
     */
    struct hints_info {
	struct twolevel_hints_command twolevel_hints_command;
    };
    extern struct hints_info output_hints_info;

  In assign_output_symbol_indexes() in symbols.c number of hints was set based
  on the value of nundefsym.

  In layout_segments() in layout.c accounting for the size of the hints in the
  linkedit segment was done.

  Also in layout_segments() in layout.c code was added to account for the hints
  command and its size.

  Also in layout_segments() in layout.c the offsets to the hints table are set
  as to be just after the symbol table.

  In output_headers() in pass2.c the hints command is placed in the output.

  In setup_output_flush() in pass2.c the space between the end of the symbol
  table and the start of the hints is flushed and the offset is moved to the
  end of the hints table.

  In output_merged_symbols() in symbols.c at the end of the routine it outputs
  the two-level namespace hints.

  In check_cur_obj() in pass1.c added code to check a LC_TWOLEVEL_HINTS
  command.

Changes for the 5.9 release (the cctools-369 release):
- Added kld_load_from_memory & kld_load_basefile_from_memory for the dynamic
  build variant of libkld.  These APIs will be used by the Kernel's dynamic
  OSObject patch code.  Changes in rld.c .

Changes for the 5.9 release (the cctools-368 release):
- Fixed a bug with -bundle_loader and cross bytesex links.  Code to swap the
  symbol table of a BUNDLE_LOADER was added to search_dynamic_libs() in pass1.c.
- Also needed a test in merge() in pass1.c before add_dynamic_lib() was called
  for a BUNDLE_LOADER to make sure it has symbols as it could be of the wrong
  architecture and will cause later code in search_dynamic_libs() to crash.

Changes for the 5.9 release (the cctools-367 release):
- Added support for the -sub_library option. Radar bug #2697458.

  The following field was added to the struct dynamic_library in pass1.h:
    char *library_name;

  Added code in check_cur_obj() in pass1.c to check LC_SUB_LIBRARY command.

  Changed search_dynamic_libs() in pass1.c in the third major block of code that
  sets the library_ordinals to set the library_name field like the umbrella_name
  field of the dynamic_library struct.

  Added code to setup_sub_images() in pass1.c to handle sub_librarys as it
  handles sub_umbrellas.

  Changed set_sub_umbrella_ordinal() to set_sub_umbrella_sub_library_ordinal()
  to do both sub_umbrellas and sub_libraries.  And factor out the code that
  sets the index into the sub_images into the routine set_isub_image().

- Added support in ld(1) to build the two-level namespace sub images arrays for
  each dynamic library when -twolevel_namespace is in effect.  This is for the
  two-level namespace hints optimization.  Radar bug #2558069.

  The following fields were added to the struct dynamic_library in pass1.h:
    /* following are used when -twolevel_namespace is in effect */
    unsigned long ndependent_images;
    struct dynamic_library **dependent_images;
    enum bool sub_images_setup;
    unsigned long nsub_images;
    struct dynamic_library **sub_images;
    enum bool twolevel_searched;

  The following fields were added to the struct object_file in objects.h:
    unsigned long isub_image;   /* when -twolevel_name space is in effect */
				/*  this the sub_image index for recording */
    unsigned long nload_dylibs; /* Number of LC_LOAD_DYLIB commands */

  TODO: need to add code in check_cur_obj() to check LC_TWOLEVEL_HINTS command
  then the hints.

  Changed check_cur_obj() in pass1.c to increment nload_dylibs in the cur_obj
  for each LC_LOAD_DYLIB commands.

  Changed search_dynamic_libs() in pass1.c in the first major loop in
  to allocate the dependent_images as well as the second major loop for 
  dependent libraries when -twolevel_namespace is in effect.

  Changed search_dynamic_libs() in pass1.c in the second major loop in
  to fill in the dependent_images from the return value of add_dynamic_lib()
  when -twolevel_namespace is in effect.

  Changed search_dynamic_libs() in pass1.c in the third major block of code that
  sets the library_ordinals added a loop that calls the new routine 
  setup_sub_images() that has the same logic as in dyld's images.c.

  Added code in both set_sub_frameworks_ordinals() and
  set_sub_umbrella_ordinal() to set the isub_image for the libraries.

  Added code in search_dynamic_libs() when the debug 22 bit is set and
  -twolevel_namespace is in effect to printout the dependent and sub images.

  After the sub_images arrays are set up the main loop to search for undefined
  symbol in search_dynamic_libs() was changed to search all the sub_images of
  each DYLIB as it is encountered.  The new twolevel_searched field is first
  set to FALSE in all the dynamic_libray structs in the list and if a symbol is
  not found in a DYLIB then all the sub_images are searched in turn.  This same
  bit of logic is also done in the last loop that checks merged symbols coming
  from dynamic libraries.

- Fixed a bug where if only the -stack_size was set then the default stack
  address value used was not put into the thread state.  This change was in
  layout_segments() in layout.c where it now simply sets stack_addr_specified
  to TRUE after calling get_stack_addr_from_flag().

Changes for the 5.9 release (the cctools-361 release):
- Added the -prebind_allow_overlap flag as well as the LD_PREBIND_ALLOW_OVERLAP
  environment variable which allow prebinding to still be done even if some of
  the libraries overlap.  Changes in ld.c, ld.h and layout.c in check_overlap().
- Added the case for LC_PREBOUND_DYLIB in check_cur_obj() in pass1.c as it was
  missing and -bundle_loader arguments can have these load commands.
- Fixed a bug add_dynamic_lib() in pass1.c that changed the definition_obj of a
  dynamic_library struct when it was a sub-umbrella.  This was old code from
  the first attempt (cctools-344) to get the primary library stuff for
  two-level namespace working.  This bug caused a cross bytesex link to fail
  because when the symbolic info for each dylib was set up in
  search_dynamic_libs() it swapped the nlist structs more than once because
  more than one dynamic_library struct pointed to the same info.

Changes for the 5.9 release (the cctools-360 release):
- Ifdef'ed out the code that turns off -twolevel_namespace when the environment
  variable LD_TWOLEVEL_NAMESPACE is set and -undefined is specified that is not
  "error" or any -U flags are specified to cause hard errors for now.  This may
  have to be put back in at some point. But we want things to fail at first to
  find projects that use these flags.
- Added savestr() to ld.c to avoid a multiply defineds for allocate() and
  reallocate().
- Changed the Makefile so that static_kld build will use libmacho from the
  the $(SYMROOT) not from /usr/local/lib/system.
- Added a definition of savestr() to rld.c to avoid pulling in allocate.o from
  libstuff.
- Changed the Makefile so that the rld stuff does not get built for RC_OS being
  macos and RC_RELEASE being after Cheetah.

Changes for the 5.9 release (the cctools-359 release):
- Added the -multiply_defined flag for the treatment of two-level namespace
  multiply defined symbols.  It takes error, warning and suppress as arguments
  with warning being the default.
- Added the LD_TWOLEVEL_NAMESPACE environment variable to turn on
  -twolevel_namespace when -flat_namespace and -static are not specified.  It
  is also not turned on when -undefined is specified that is not "error" or any
  -U flags are specified but prints a warning that LD_TWOLEVEL_NAMESPACE is
  ignored.
- Changed check_overlap() in layout.c for the check that does not disable
  prebinding when there is an overlap with a split library's __LINKEDIT segment
  such that an executable can be linked where some it the libraries it links
  with split libraries that are not stripped it does not disable prebinding.
- Added checking force_flat_namespace when checking for MH_TWOLEVEL so that if
  forcing a flat name space the checking for multiply defined symbol is treated
  as an error even if a two-level namespace library is used.
- Changed check_dylibs_for_reference() in pass1.c to only check for references
  in flat libraries so that two-level namespace libaries can be used with
  different references and the resulting item being linked can be prebound
  except when -force_flat_namespace is also being used.
- Added the check and printing a message about unused multiply defined symbols
  when -twolevel_namespace is in effect.  This is done with the new routine
  twolevel_namespace_check_for_unused_dylib_symbols() defined in pass1.c and
  called from layout() in layout.c .  To implement it the routine
  check_dylibs_for_definition() in pass1.c was change to take two flags so it
  can be used for prebinding and two-level name space checks.
- Added the -bundle_loader <executable> and -private_bundle flags.  Along with
  many other changes this allows -bundle outputs to have their undefined symbols
  to be checked against the executable.  This is required for -bundle outputs
  and -twolevel_namespace when the bundle references symbols from the executable
  and EXECUTABLE_ORDINAL gets recorded for the library ordinal.
- Added -Wno-long-double to shutup the compiler for
  <architecture/m88k/fp_regs.h>.
- Added a check to make sure -U flags are not used when twolevel_namespace is
  in effect.
- Fixed a bug with or'ing in of REFERENCED_DYNAMICALLY in
  merge_dylib_module_symbols() in symbols.c on line 1965 which should not
  be or'ed in when the dynamic library is a MH_TWOLEVEL.
- Fixed a bug in merge_dylib_module_symbols() that incorrectly flagged a
  multiply defined symbol as an error not a warning when one symbol came from
  a flat library and one came from a two-level library and we were building an
  executable.

Changes for the 5.8 release (the cctools-355 release):
- Changed the include file <mach/vm_task.h> to <mach/vm_map.h> in rld.c and
  sets.c .  Radar bug #2579488.
- Changed the way -twolevel_namespace sets the primary ordinal and reports
  errors for illegally referenced indirect libraries from the cctools-344
  original implementation:

    In search_dynamic_libs() in pass1.c after all the dependents are added a
    set of loops were added to propagrate the library ordinals to the
    sub-frameworks and sub-umbrellas.  The new routines
    set_sub_frameworks_ordinals() and set_sub_umbrella_ordinal() are called
    from these loops.  These new routines are also defined in pass1.c.
    The new field umbrella_name was added to the dynamic_library struct in
    pass1.h .

    Then in merge_dylib_module_symbols() before the merged_symbol
    is updated to the definition of the symbol in the dylib a check
    is made to see if the symbol is referenced from an object going 
    into the image and will need the library ordinal recorded. If so
    a check to see if the library ordinal was assigned is done and
    if not an error for an illegal reference to a symbol defined
    in a indirectly referenced dynamic library is issued.
    The new field indirect_twolevel_ref_flagged was added to the
    dynamic_library struct in pass1.h .

    All the code added to the open_dylib() in pass1.c in the cctools-344
    implementation for twolevel-namespace was removed.

Changes for the 5.8 release (the cctools-353 release):
- Change ld(1) to allow section difference references to coalesced symbols where
  the symbol being referenced is private extern or local.  This is needed so
  that the zero overhead exception tables can make pic references to the 
  private extern symbols that the compiler creates for template functions.
  To do this the fine relocs created for coalesced symbols that are private
  externs are marked with local_symbol == TRUE in coalesced_section_merge() in
  coalesced_sections.c.  Then in legal_reference() in indirect_sections.c the
  first test had the additional conditional check to allow the reference when
  the reference was to a block that local_symbol == TRUE.  Then a change to
  fine_reloc_output_address() in objects.c to deal with a coalesced section
  where local_symbol == TRUE and use_contents == FALSE was made to pick out the
  merged_symbol pointer from the output_offset field.  Radar bug #2573679.
- Changed prebinding_check_for_dylib_override_symbols() in pass1.c to not
  continue when
    merged_symbol->defined_in_dylib == TRUE
  and go head and call check_dylibs_for_definition().  Then a change was made
  to check_dylibs_for_definition() that skipped merged symbols defined in a
  dylib for the current dylib being checked.  This allow catching symbols being
  overridden in a dylib from a different dylib.  This happens when both System
  and System_profile are linked (and have different prebound addresses).
  Radar bug #2564555.

Changes for the 5.8 release (the cctools-350 release):
- Added a call to vm_msync() in pass1() in pass1.c and pass2() in pass2.c under
  the #ifdef VM_SYNC_DEACTIVATE conditional.  Radar bug #2567196.

Changes for the 5.8 release (the cctools-349 release):
- Added code in pass2() in pass2.c to use fcntl() with the F_NOCACHE option to
  not cache the blocks of the output file.
- Fixed a bug in compiling the without -DDEBUG in count_relocs() in sections.c
  where the setting of map->nextrel and map->nlocrel where in ifdef DEBUG code
  that should not have been.

Changes for the 5.8 release (the cctools-347 release):
- Changed merge_dylib_module_symbols() in symbols.c for handling multiply
  defined symbols to treat them as warnings when building images when
  -twolevel_namespace is in effect and the symbol does not come from a dylib
  or if the symbol is coming from a dylib with MH_TWOLEVEL.

Changes for the 5.8 release (the cctools-346 release):
- Added the printing of why prebinding was disabled when environment variable
  RC_TRACE_PREBINDIND_DISABLED is set.  This also uses the new -final_output
  flag which the driver can pass as the actual name of the output file being
  created which is used in the message:
  [Logging for Build & Integration] prebinding disabled for <<-final_output 
	argument>> because REASON
  Radar bug #2550094.
- Fixed a bug in coalesced_section_merge() in coalesced_sections.c where it
  did not take into account the private extern bit of a merged symbol of an
  external relocation entry when the output is MH_BUNDLE.  Radar bug #2548925.

Changes for the 5.8 release (the cctools-345 release):
- Changed the setting of -segs_read_write_addr if picking zeros up both the 
  -segs_read_only_addr and -segs_read_write_addr then the value 0x10000000 is
  used for the -segs_read_write_addr.  Radar bug #2544818.
- Changed the segment overlap checking to not disable prebinding when building
  a split library and a segment overlaps a linkedit segment of any split
  library.  Radar bug #2543932.
- Fixed a bug in main() in ld.c where this line:
	if(client_name != NULL != 0)
  should have been:
	if(client_name != NULL)

Changes for the 5.8 release (the cctools-344 release):
- Added code for tracking and setting the library ordinal when
  -twolevel_namespace is in effect.  Radar bug #2538835.

    The ordinal for the "primary" library is assigned in 
    search_dynamic_libs() in pass1.c for the libraries on the list
    before any dependents are added.  This is stored in the
    object_file struct in the library_ordinal field.

    The routine search_dynamic_libs() in in pass1.c calls
    open_dylib() in pass1.c for the dependent dylibs which returns
    TRUE or FALSE as whether to keep the dependent lib on the list
    of dylibs to be searched.  The routine open_dylib() does the
    work of determing if a dependent dylib is to be kept when
    -twolevel_namespace is in effect.  It has the code to deal
    with sub-frameworks of umbrella frameworks and sub-umbrellas.
    It is the one that sets the library_ordinal from the primary
    library into the dependent dylib.

    The setting of the library ordinal in the n_desc field of a
    symbol is done in the routine merge_dylib_module_symbols() in
    symbols.c which is passed the struct dynamic_library for the
    library that the module comes from.  And is done with this
    code:
	if(twolevel_namespace == TRUE){
	    SET_LIBRARY_ORDINAL(merged_symbol->nlist.n_desc
		dynamic_library->definition_obj->library_ordinal);
	}

- Added a check to make sure -undefined error is used when -twolevel_namespace
  is in effect.  Radar bug #2538835.
- Added building kld_build for cctoolslib when RC_OS is macos and RC_RELASE is
  not Bunsen, Beaker, Gonzo or Kodiak.  The kernel Radar that install the libsa
  headers is 2537868.  The Radar for this change is 2538829.
- Fixed a bug with -keep_private_extern logic and coalesced symbols that did not
  generate an external relocation entry when it should.  The change was this:
    if((merged_symbol->nlist.n_type & N_PEXT) == N_PEXT ||
       keep_private_externs == TRUE || ...
  to this:
    if(((merged_symbol->nlist.n_type & N_PEXT) == N_PEXT &&
        keep_private_externs == FALSE) || ...
  in ppc_reloc.c, coalesced_sections.c, generic_reloc.c, hppa_reloc.c,
  i860_reloc.c, indirect_sections.c, m88k_reloc.c, and sparc_reloc.c.  Radar
  bug #2536788.
- Fixed a bug with checking the LC_SUB_UMBRELLA that caused it to crash as it
  was using the 'sub' variable for LC_SUB_FRAMEWORK load commands not the 'usub'
  variable.  This is in check_cur_obj() in pass1.c.  Radar bug #2538825.

Changes for the 5.8 release (the cctools-342 release):
- Fixed a problem with the change for Radar bug #2503688 that was in cctools-341
  that was in merged_symbol() that should have not changed to using the
  merged_symbol instead of the object_symbols for the setting of the reference
  type in a dynamic library.
- Fixed a bug with -keep_private_externs that was setting of the indirect table
  to INDIRECT_SYMBOL_LOCAL (or INDIRECT_SYMBOL_ABS) when it should not.  This
  shows up as a problem when the indirect table entry is for a private_extern
  symbol.  The change is in output_indirect_symbols() in indirect_sections.c to
  add a check for keep_private_externs == FALSE.  Radar bug #2534011.
- Fixed the another bug with a coalesced symbol that is a private extern (when
  -keep_private_externs is NOT in effect) in that the value of the non-lazy
  symbol pointer is not set to the value of the symbol (though the index is set
  to INDIRECT_SYMBOL_LOCAL).  The setting of the non-lazy symbol pointer is
  done in scatter_copy() in sections.c based on the fine_relocs indirect_defined
  field that is always FALSE for coalesced symbols (to keep indirection).
  The function is_pass2_merged_symbol_coalesced() was added and logic was added
  to scatter_copy() to use it and set the non-lazy symbol pointer.  Radar bug
  #2534011.
- Added support for -allowable_client and -client_name flags.  Radar bug
  #2533649.
- Added first bit of support for the -flatname_space, -twolevel_namespace,
  and -force_flat_namespace options.  Parsing the options and setting
  MH_TWOLEVEL and MH_FORCE_FLAT in the header's flags. Radar bug #2534043.

Changes for the 5.8 release (the cctools-341 release):
- Added the -sub_umbrella option Radar bug #2530028.
- Changed the Makefile to build libkld.a and libkld.dylib for cctoolslib builds.
  Many ifdefs were added and changed in rld.c to implement the kld APIs and 
  many ifdefs were added all the other files to build with the Kernel framework.
  Radar bug #2523649.
- Changed ld.c to initalize the value of arch_flag when KLD and __STATIC__ are
  defined so that code in pass1.c can avoid using host_info via
  get_arch_from_host() which is also ifdef'ed out when KLD and __STATIC__ are
  defined (see pass1_fat() in pass1.c).
- Changed merge_sections() in sections.c to not merge the section alignment
  from the base file for KLD.
- Changed the ifdef's in rld.c to make only sa_rld() and sa_rld_with_symtab()
  are left as externals for libsarld.a.  Also changed sa_rld_output_addr and
  sa_rld_output_size to private_externs.
- Removed the test to make sure -init is also specified when -run_init_lazily
  is specified as now module initialization routines can also be run lazily.
  Radar bug #2502941.
- Changed the final loops in search_dynamic_libs() in pass1.c that checks "all
  merged symbols coming from dynamic libraries from the first one defining the
  symbol" to ignore symbols with coalesced_defined_in_dylib as TRUE.
  Radar bug #2503703.
- Fixed a bug in merge_symbols() where the first symbol merged was a coalesced
  global symbol from a dynamic library and the next was from an object
  (libcc_dynamic.a) which was causing it to be a multiply defined
  symbol.  The field coalesced_defined_in_dylib also needed to be checked if
  defined_in_dylib is TRUE.  Radar bug #2503694.
- Fixed a yet another bug in merge_symbols() in symbol.c when a private
  extern coalesced symbol gets discarded.  The counts for cur_obj->nextdefsym
  was decremented in all cases when it should have only been decremented in
  the case the symbol was not a private extern.  Radar bug #2503688.

Changes for the 5.7 release (the cctools-337 release):
- Fixed two bugs in the handling of lower level error later causing an internal
  error.  The fix was to test errors for non-zero and return from the routine.
  this was added to output_section() in sections.c after the relocs routines
  and pass2 in pass2.c after output_section() call.
- Fixed a bug in print_whatsloaded() in objects.c where it did not print the
  archive name for extended format #1.
- Fixed a bug in coalesced_section_merge() in coalesced_sections.c where it
  did not take into account the private extern bit of a merged symbol of an
  external relocation entry when the output is MH_DYLIB.  Radar bug #2497954.

Changes for the 5.7 release (the cctools-335 release):
- Fixed a bug in merge_symbols() in symbol.c when a private extern coalesced
  symbol gets discarded.  The counts for cur_obj->nprivatesym and 
  nmerged_private_symbols need to be decremented in the case the coalesced
  symbol gets discarded.  Radar bug #2493452.
- Fixed a bug in literal_pointer_output() in literal_pointers.c for split
  libraries that did not correctly set the r_address field for literal pointer
  relocation entries. Radar bug #2493445.

Changes for the 5.7 release (the cctools-334 release):
- Changed guess_short_name()'s has_suffix argument to return a pointer
  to the suffix so checksyms could check for "_debug".  This effected
  ld(1)'s guess_short_name() two calls.
- Added the -run_init_lazily flag and the variable lazy_init so to mark the
  dynamic library with MH_LAZY_INIT.  Changes in ld.c, ld.h and layout.c.
  Radar bug #2490396.

Changes for the 5.7 release (the cctools-330 release):
- Changed merge_dylib_module_symbols() in symbols.c to have a last pass that
  looks for private undefined references and links them in.  To do this the
  dynamic_library struct needed to be passed to it.  This causes pass1.h to
  be needed before including symbols.h so many other files also have this
  change.  The change to merge_dylib_module_symbols() is needed so that dynamic
  libraries that have had nmedit run on them will get the proper semantics and
  detect multiply defined symbols at link time.  This also gets the
  LC_PREBOUND_DYLIB commands do have the modules used via private externs
  symbols marked in the linked_modules bit vector.  This is part of Radar bug
  #2420307.

Changes for the 5.7 release (the cctools-330 release):
- Changed the ifdef's for the standard_framework_dirs in pass1.c s
  that moving forward /Library/Frameworks is part of the default and
  /Local/Library/Frameworks is only used instead if __GONZO_BUNSEN_BEAKER__
  is defined for older DP4, DP3 & PR2 builds. Radar bug #2477862.
- Changed the call to netname_look_up() in check_for_ProjectBuilder() to
  bootstrap_look_up() when __OPENSTEP__ and __GONZO_BUNSEN_BEAKER__ is not
  defined (Radar bug #2473864).
- Fixes the error message about only using -umbrella when -dylib is used to use
  "-umbrella" where it was using "-sub_framework".  Radar bug #2477866.

Changes for the 5.7 release (the cctools-329 release):
- Changed iinit and ninit fields of the struct dylib_module in
  mod_section_merge() in mod_sections.c to iinit_iterm and ninit_nterm and added
  checks for overflow in there.  Also added in the code to handle setting the
  module table entries in output_dylib_tables() in symbols.c and is nolonger
  #ifdef'ed DYLIB_TERM.  Radar bug #2469527.

Changes for the 5.7 release (the cctools-328 release):
- Changed where the libraries get installed by default.  So going forward things
  get install in /usr/local/lib/system and /Local/Developer/System
  is only used for RC_OS=macos when RC_RELEASE is Gonzo, Bunsen, or Beaker.

Changes for the 5.7 release (the cctools-327 release):
- Changed back where ld(1) picks up its the System Framework's private headers.
  It will continue to look in
  /System/Library/Frameworks/System.framework/PrivateHeaders and may someday
  will lookin in
  /MacOSX/System/Frameworks/System.framework/PrivateHeaders in some post-DP4
  release.
- Changed where the libraries get installed by default.  So going forward things
  get install in /AppleInternal/Developer/System and /Local/Developer/System
  is only used for RC_OS=macos when RC_RELEASE is Gonzo, Bunsen, or Beaker.
- Changed the ifdef's for the standard_framework_dirs in pass1.c s
  that moving forward /MacOSX/Library/Frameworks is part of the default and
  /Local/Library/Frameworks is only used instead if __GONZO_BUNSEN_BEAKER__
  is defined for older DP4, DP3 & PR2 builds.

Changes for the 5.6 release (the cctools-325 release):
- Fixes a bug in merge_dylib_module_symbols() in symbols.c where it was using
  [i] as an index into the symbol table where it should have been using [j] in
  two places.  This was causing Gonzo1I10 ld's to crash via libtool with the
  message "/usr/bin/libtool: fatal error in ld".

Changes for the 5.6 release (the cctools-324 release):
- Fixed a bug in merge_symbols() in symbols.c in the BINCL/EINCL logic.  In the
  case where the there is a missing EINCL the logic will run into the global
  symbols and mistakenly count them as local symbols.  Thus causing an internal
  error: "output_local_symbols() inconsistent local symbol count".
- Fixed a bug in merge_dylib_module_symbols() where if a coalesced symbol only
  appears in dylibs then a multiply defined error resulted.  To make this fix
  a new bit, coalesced_defined_in_dylib,  in the merged_symbol struct in
  symbols.h was also added.

Changes for the 5.6 release (the cctools-323 release):
- Changed where the libraries get installed for the Space release in preparation
  of this "Half Plan" becoming the default for DP4 (Gonzo).  This directory
  /Local/Developer/System is changing to /AppleInternal/Developer/System.
- Changed the ifdef __SPACE__ for the standard_framework_dirs in pass1.c as the
  directory changes have been scaled back and changed.  In preparation of this
  "Half Plan" /Local/Library/Frameworks was changed to
  /MacOSX/Library/Frameworks and ifdef'ed __SPACE__.  In the second half of the
  plan (post-DP4) /System/Library/Frameworks will change to
  /MacOSX/System/Frameworks and this is ifdef'ed __SPACE2__.
- Changed back where ld picks up its the System Framework's private 
  headers back to /System/Library/Frameworks/System.framework/PrivateHeaders
  from /MacOSX/System/Frameworks/System.framework/PrivateHeaders for the Space
  release.  This won't change till post-DP4.

Changes for the 5.6 release (the cctools-322 release):
- Added ifdef'ed for __SPACE__ to the standard_framework_dirs in pass1.c in
  preparation for the directory changes. /System/Library changing to
  /MacOSX/System.

Changes for the 5.6 release (the cctools-320 release):
- Fixed a bug in open_dylib() in pass1.c where if more than one -dylib_file
  arguments were used and more than one dylib was linked and a dylib was then
  found in the -dylib_file the next call to open_dylib() would crash because
  the ':' was not restored after the first one was found.
- Added the -umbrella framework_name option to guarding against direct linking
  of non-umbrella frameworks.  Radar bug 2443212.

Changes for the 5.6 release (the cctools-319 release):
- Added the -seg_addr_table option and the LD_SEG_ADDR_TABLE environment
  variables as alternate ways to set the addresses of dynamic shared libraries.
- For MH_SPLIT_SEGS format the r_address field of relocation entries is to be
  relitive to the first read-write segment.  This is to deal with the fact that
  the r_address field in scattered relocation entries is 24 bits and this format
  is used for prebound lazy pointers.  So the changed for this was changing
  what the addr_adjust gets set to in reloc_output_for_dyld() in sections.c .
  This is possible as it is not legal to have relocation entries in read-only
  segements in this format.  So to enforce this main() in ld.c checks to make
  sure -read_only_relocs is set to error when -segs_read_only_addr is used.
- Removed a few unneeded tests for r_scattered after tests for r_extern in 
  reloc_output_for_dyld() in sections.c as scattered relocation entries are
  alwasys local.

Changes for the 5.6 release (the cctools-318 release):
- Fixed a bug in the Makefile that installed the archive libraries without the
  -p option.  This caused their table of contents to be out of date.  And is
  needed as the kern loader is linking with librld.a  .  Also changed the
  Makefile to install librld's into /usr/local/lib .  (Radar bug #2436955).

Changes for the 5.6 release (the cctools-316 release):
- Changed a check in indirect_sections.c in indirect_section_merge() where it
  was checking the relocation entries of lazy symbol pointer sections to make
  sure r_symbolnum was not R_ABS.  The change was to first check that r_extern
  is 0 and it is a local relocation entry before checking r_symbolnum == R_ABS
  as external relocation entries are legal with PowerPC code.  Was a problem
  when the r_symbolnum was 0 as that is the save value as R_ABS for local
  relocation entries.  (Radar bug #2431435).
- Added the -segs_read_only_addr and -segs_read_write_addr options for
  MH_SPLIT_SEGS.  Radar bug #2415906.

Changes for the 5.5 release (the cctools-312 release):
- Changed fine_reloc_output_address() in object.c to return the address of the
  merged_symbol for a S_SYMBOL_STUBS section when the merged symbol is defined
  in the cur_obj making the reference.  To do this a merged_symbol field was
  added to the fine_reloc structure and filled in in indirect_section_merge()
  in indirect_sections.c.  This is all needed to clean up after the compiler
  that generates calls through lazy stubs for symbols forward defined in
  the compliation unit.  This is needed so that the dynamic linker can fully
  bind library init routines without such references being called back into
  dyld and then causing the init calls to be interleaved.  Radar bug #2417690.

Changes for the 5.5 release (the cctools-311 release):
- Fixed a bug in merge_symbols() dealing with N_EXCL's seen as created by a
  previous ld -r pass.  This caused gdb to print <incomplete type>.  Radar bug
  2415697.

Changes for the 5.5 release (the cctools-310 release):
- Fixed a bug in search_dynamic_libs() in pass1.c where it was generating the
  warning message for use of -bind_at_load incorrectly.  Radar bug 2378121.
- Changed the order of the undefined symbols to not be sorted if -bind_at_load
  is used to correct for a case when -bind_at_load was used and the dynamic
  linker resolved the undefined symbols in a different order as to cause
  multiply defined symbols.  Radar bug 2378121.
- Fixed a bug in ld.c where it had a missing else so the -Sn ended up getting
  an error as an unknown flag.  Radar bug #2415456.

Changes for the 5.5 release (the cctools-308 release):
- Fixed a bug in lookup_and_enter_include() in symbols.c at the end where it
  was not correctly inserting the new hash bucket in the chain.  Also made 
  -Si the default stripping.  Radar bug #2410704.
- Also fixed a warning in coalesced_symbols.c when compiling for sparc on 
  Openstep 4.2.

Changes for the 5.5 release (the cctools-307 release):
- Added the -Si option for stripping duplicate include stab groups (N_BINCL and
  N_EINCL pairs).   Also added the -Sn option to get the STRIP_NONE option when
  the -Si option becomes the default.  Added the code at the end of
  merge_symbols() in symbols.c to determine which groups get excluded.  Also
  code was added in output_local_symbols() in symbols.c after the loop for
  looping over the symbols to update N_BINCL's and create N_EXCL's.  Radar bug
  #2410704.
- Support for coalesced symbols has been added. Radar bug #2411273.
- Add a warning suggesting the use of -bind_at_load in search_dynamic_libs() in
  pass1.c when lazy binding might produce different results when a definition of
  a symbol is used from a dynamic library and there is an earilier dynamic
  library that defines the same symbol. Radar bug #2378121.
- Added printing a line like "[Logging for Build & Integration] Used dynamic "
  "library: dylib_name", where dylib_name is a dynamic library being used in
  the link.  This is done when the environment variable RC_TRACE_DYLIBS is set
  and done in search_dynamic_libs() in pass1.c.  Radar bug #2389955.

Changes for the 5.4 release (the cctools-305 release):
- Fixed a bug when -U flags were used and LD_PREBIND was set the code in
  process_undefineds() in symbols.c was setting errors and causing ld to exit
  non-zero.

Changes for the 5.4 release (the cctools-302 release):
- Fixed a bug in assign_output_symbol_indexes() in symbols.c for assigning the
  output indexes of private extern symbols.  This cause calls to private_extern
  symbols through stubs to reference the wrong stub and thus call the wrong
  routine.  This showed up for calls to routines in libcc_dynamic.a when the
  call was in a dynamic library (Radar bug #2374465).  This resulted in throw()
  and dynamic_cast() to crash when in a shared library.  The Finder was the one
  having these problems (Radar bugs 2369470 and 2364994).

Changes for the 5.4 release (the cctools-301 release):
- Changed sections.c so that qsort_load_order_values() is not #ifdef'ed RLD
  because it is used by coalesced_section_merge().

Changes for the 5.4 release (the cctools-300 release):
- Added the -init <symbol_name> option for a dynamic shared library
  initialization routine.  This creates a new LC_ROUTINES load command to store
  this information.
- The initial work for coalesced symbols has been added.  This reads, deals
  with duplicate coalesced symbols and writes out the sections.  It does not
  yet deal with relocation in a coalesced section or relocation to a coalesced
  section.

Changes for the 5.4 release (the cctools-296 release):
- For RC_OS=macos no longer build librld_static.a, the librld_pg.a version is
  now copied as librld_profile.a and a link to librld_debug.a is made from
  librld.a.

Changes for the 5.3 release (the cctools-294 release):
- Fixed two bugs in scatter_copy() in sections.c that was trying to update the
  values for INDIRECT_SYMBOL_LOCAL entries.  There was a missing SWAP_LONG after
  the value was read.  Also after the call to error_with_cur_obj() it did not
  return and the program then crashed.

Changes for the 5.3 release (the cctools-292 release):
- Changed setting the default segment alignment to call get_segalign_from_flag()
  in layout.c in layout() to allow setting the default segment alignment
  to 4K for PowerPC and 8K for everything else.  Radar bug #2277625.
- Added some braces to get rid of the warning message from the egcs compiler
  "warning: suggest explicit braces to avoid ambiguous `else'".  This was done
  to pass1.c, sections.c and 8byte_literals.c .
- Changed the return type of main() in ld.c from void to int to remove a
  warning from the egcs compiler.  Also added a dummy return(0) to make the
  compiler happy.
- Added -I$(NEXT_ROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
  to the Makefile as the egcs compiler's cpp no longer searches this by default.
  This is needed to pick up <streams/streams.h> for use with the rld interface.

Changes for the 5.3 release (the cctools-291 release):
- Made a fix to the ld -r change in cctools-288.  The indirect entries should
  have only been changed for non-lazy sections.  This change is in
  output_indirect_symbols() in indirect_sections.c .  This problem would show
  up when executing a binary with the error from dyld:
    dyld: /System/Applications/MailViewer.app/MailViewer Undefined symbols:
    dyld_lazy_symbol_binding_entry_point
  The problem in this case was the Message framework built with the ld(1) that
  had the bug.  This also has been seen in Carbon apps, with the problem the
  libbase.

Changes for the 5.3 release (the cctools-288 release):
- Changed ld(1) when doing an ld -r with an indirect entry for a private_extern
  to change the indirect symbol to INDIRECT_SYMBOL_LOCAL or INDIRECT_SYMBOL_ABS.
  This problem showed up when building the Message framework and would get the
  error from ld: "ld: indirect symbol:_y can not be a private extern".
  And also showed up in building Carbon when using strip which would produce the
  error message from ld: "ld: x.o indirect symbol table entry 0 past the end of
  the symbol table".
- Fixed ld(1) so it would handle INDIRECT_SYMBOL_ABS and relocate the values
  of symbol pointers with INDIRECT_SYMBOL_LOCAL indirect table entries.
  Changes to sections.c and indirect_sections.c .  This problem could be run
  into in one of three ways when a global symbol is changed to a non-global,
  via private_extern and ld -r, via nmedit and via strip.
- Changed the message printed when the environment variable RC_TRACE_ARCHIVES
  is set from: "RC_TRACE_ARCHIVES archive_name" to: "[Logging for Build &
  Integration] Used static archive: archive_name".  Radar bug #2310273.

Changes for the 5.3 release (the cctools-286 release):
- Change the use of the i386 cpp macro to __i386__ and ppc to __ppc__
- Added the support for the module termination section.  This effected the files
  sections.c, pass1.c, mod_sections.c (renamed from modinit_sections.c),
  mod_sections.h (renamed from modinit_sections.h), pass2.c, and objects.h.
  The code to handle setting the module table entries in output_dylib_tables()
  in symbols.c is #ifdef'ed DYLIB_TERM and not compiled in yet.

Changes for the 5.3 release (the cctools-285 release):
- Removed a warning in ld.c that stated -keep_private_externs must be used with
  -dynamic.
- Fixed a bug in check_cur_obj() in pass1.c that was printing an error:
	"indirect symbol table entry 353 past the end of the symbol table"
  if an indirect symbol table entry had the value INDIRECT_SYMBOL_LOCAL or
  INDIRECT_SYMBOL_ABS which can get created by strip(1).  Found when the
  CoreGraphics framework was stripped removing two globals and then the
  resulting framework was linked against.
- Added printing a line like "RC_TRACE_ARCHIVES archive_name", where
  archive_name is a archive being used in the output of the link.
  This is done when the environment variable RC_TRACE_ARCHIVES is set.
  Radar bug #2303376.
- Changed the Makefile to build librld.a, librld_pg.a and librld_static.a in
  $(DSTROOT)/Local/Developer/System for MacOS X, that is when $(RC_OS) is macos.
  This to allow System framework to be built without using SUBLIBROOTS.
  Radar bug #2268413.

Changes for the 5.3 release, MacOS X bring up (the cctools-282 release):
- Changed task_self() to mach_task_self() for MacOS X.  Also included
  "stuff/openstep_mach.h" for macros to allow it to still build on Openstep.
  Also changed ifdef's __SLICK__ to __OPENSTEP__.
- Ifdef'ed __MACH30__ make.defs for mach_port_t vs mach_port.  Also ifdef'ed out
  netname_look_up() call and #include <servers/netname.h> for __MACH30__ in
  ld.c (these are not yet in the SDK).
- Changed the Makefile to allow for RC_OS=macos for MacOS X builds.
- Changed ld.c to #ifndef'ed __MACH30__ out #include <servers/netname.h>
- Changed make.defs to use mach_port_t instead of port_t .
- Changed the Makefile to use MIG = $(NEXT_ROOT)/usr/bin/mig and $(MIG).
- Chanded the Makefile to have mwcc use the -dependency-file option now that
  it does not cause build problems. 
- Changed the line rld_unload_all(FALSE, 1); to rld_unload_all(NULL, 1); in 
  sa_rld_internal() so it would compile with the MetroWerks compiler.

Changes for the 5.2 release (the cctools-275 release):
- Fixed a bug in layout_dylib_tables() in symbols.c that was still using the
  ar_name from the archive header when creating a dylib module name.  Now it
  uses the ar_name and ar_name_size fields from cur_obj. Radar bug #2239283.
 
Changes for the 5.2 release (the cctools-274 release):
- Changed the way segment addresses for segments without specified addresses are
  set.  In layout_segments() in layout.c the first segment is set to zero.
  Except in the MH_EXECUTE case with a pagezero segment in which it follows the
  pagezero segment.  Then for all other unassigned segments the addresses of
  is set to the next available address after the first segment that the vmsize
  if the segment will fit.  This is done in the new routine next_vmaddr().
  Radar bug #2237029.
- Added a test in reloc_output_for_dyld() in sections.c to detect the case when
  the r_address of a prebound lazy pointer relocation entry overflows because
  the first segment is too far away from the item to be relocated.  Radar bug
  #2237029.

Changes for the 5.2 release (the cctools-272 release):
- Added sa_rld_with_symtab() like sa_rld() but also passes the symbol table and
  string table in.  Radar bug #2231758.

Changes for the 5.2 release (the cctools-267 release):
- Made the source code compile with MetroWerks compiler. Radar bug #2227678.
- Changed the default for -read_only_reloc to error from warning.  Radar bug
  #2227470.
- Fixed a bug in layout_ordered_section() in sections.c on line 1143 and removed
  the code that was dealing specially with zero sized blocks. Radar bug
  #2226458.
- Added all the suport needed for the 4.4BSD extended format #1.  Radar bug
  #1670513.

Changes for the 5.1 release (the cctools-265 release):
- Changed the headerpad to the sizeof two section headers so objcunique will
  work.  Radar bug #2224571.

Changes for the 5.1 release (the cctools-260 release):
- Added -c to all the install commands in the Makefile.

Changes for the 5.1 release (the cctools-254 release):
- Added the rld function rld_write_symfile() to be used by the kern loader.

Changes for the 5.1 release (the cctools-253 release):
- Changed the Makefile so /bin is not created for Rhapsody builds.
- Changed the default Framework search path to match the new directory
  layout for Preimer.

Changes for the 5.1 release (the cctools-251 release):
- Corrected the cctools-249 fix to add_dynamic_lib() in pass1.c . Both the
  fields dylib_file and file_name needed to be set and only dylib_file was
  being set.

Changes for the 5.1 release (the cctools-249 release):
- Fixed a bug in layout_segments() in layout.c where MH_PREBOUND was getting
  set into the output mach header before check_for_overlapping_segments() was
  called which could turn off prebinding.
- Fixed a bug in add_dynamic_lib() in pass1.c when $NEXT_ROOT was set and
  prebinding was enabled.  The bug caused the library name with $NEXT_ROOT
  appended to be recorded in the LC_PREBOUND_DYLIB commands.  The fix was not
  to change dylib_name in add_dynamic_lib() but to set dylib_file with the
  prepended $NEXT_ROOT if set.
- Fixed a bug in output_merged_symbols() in symbols.c when indirect symbols are
  readied for output when prebinding is enabled.  Indirect symbols were
  incorrectly being turned in to prebound undefined symbols.  This would cause
  redo_prebinding to later fail because of undefined symbols (provided strip
  was run on the output and regrouped the symbol with the undefined symbols).
  This was causing the WindowServer to fail redo_prebinding with undefined
  symbols.

Changes for the 5.1 release (the cctools-247 release):
- Added MKDIRS if code to the Makefile to build native on Rhapsody.
- Changed the Makefile to use gnutar instead of tar because it works on Rhapsody
  where tar does not.
- Changed the Makefile so profiled objects get built for RC_OS teflon.
- Changed the Makefile to install the ld only in /usr/bin for RC_OS teflon
  and in /bin for RC_OS nextstep. Removed the creation of symbolic links
  (Radar 1672088).
- Changed the code ifdef __TEFLON__ to ifndef __SLICK__ (where __TEFLON__ will
  nolonger be defined for Rhapsody builds) so the default builds will be native
  Rhapsody builds.  The changes were to ld.c, pass1.c, rld.c and ld.h .

Changes for the 5.0 release (the cctools-246 release):
- Changed in ppc_reloc.c other_half from unsigned short to unsigned long so
  PPC_RELOC_JBSR can store 32 bit values there and target address are no longer
  truncated to 16 bits.

Changes for the 5.0 release (the cctools-245 release):
- Fixed the symbolic link from /usr/bin/ld to ../../bin/ld (Radar 1672088).

Changes for the 5.0 release (the cctools-243 release):
- Added a symbolic link from /usr/bin/ld to $(DSTROOT)/bin/ld (Radar 1672088).

Changes for the 5.0 release (the cctools-240 release):
- Fixed a bug in indirect_section_merge() in indirect_sections.c when prebinding
  PowerPC -dynamic code gen.  PowerPC relocation entries for lazy symbol
  pointers have external relocation entries.  This was not taken into account
  when counting the relocation entries in the case of prebinding.

Changes for the 5.0 release (the cctools-236 release):
- Added the sarld_build target to the lib_ofiles target.

Changes for the 5.0 release (the cctools-235 release):
- Added handling of PPC_RELOC_JBSR to ppc_reloc.c .
- Fixed the PPC_RELOC_BR24 to correctly check for overflow.  It now checks
  the top 7 (not 6) bits are the same. 
- Removed two warnings in pass1.c checking ran_off for less than zero (it is
  unsigned).

Changes for the 5.0 release (the cctools-234 release):
- Removed the last check in legal_reference() in indirect_sections.c which made
  sure a lazy symbol pointer pointed into a stub.  This is because for ppc lazy
  symbol pointers point to dyld_stub_binding_helper directly and there is no
  second half of the stub used (Radar #1661985).

Changes for the 5.0 release (the cctools-233 release):
- Removed the hack in layout_segments to ignore -seg1addr's greater than
  0x4000000 for dynamic libraries for PowerPC.

Changes for the 5.0 release (the cctools-225 release):
- Fixes a bug left from the NRW linker where executables did not have a
  __PAGEZERO segment.
- Added a hack in layout_segments to ignore -seg1addr's greater than 0x4000000
  for dynamic libraries for PowerPC.

Changes for the 5.0 release (the cctools-224 release):
- Fixed a bug in define_common_symbols() in symbols.c which when defining common
  symbols when a common section exists in the input .o files which has an
  alignment less than the alignment needed for the common symbols being defined
  by the link editor.
- Changed including <ranlib.h> to <mach-o/ranlib.h> which uses unsigned long
  instead of off_t (64 bits on Teflon).
- Fixed a warning in pass1.c.

Changes for the 5.0 release (the cctools-223 release):
- Put back the changes to rld.c ifdef __TEFLON__.

Changes for the 5.0 release (the cctools-222 release):
- Fixed a bug in ppc_reloc where it was not correctly calculating the immediate
  of a HA16 reloc by checking the 0x8000 bit of the other half and and sign
  extending it and adding it to form the correct immediate.
- Added -stack_size option to set the stack size.  This creates a __UNIXSTACK
  section.  The bulk of the work in in layout_segments() in layout.c with new
  functions added to arch.c in libstuff to support stack direction, default
  size and address.
- Added -stack_addr option to set the stack pointer.  Added a second state to
  the struct thread_info because the hppa's stack pointer is in another flavor
  of thread state.
- Removed a check in indirect_section_merge() in indirect_sections.c which was
  checking to make sure a local relocation entry for a lazy symbol pointer was
  pointing into a symbol stub section.  With the change to allow lazy symbol
  pointers to have external relocations (for PowerPC pointers using
  dyld_stub_binding_helper) after an object has been "ld -r" (in this case
  crt1.o) the lazy symbol pointer is a local relocation entry.

Changes for the 5.0 release (the cctools-221.6 and cctools-222 releases):
- Picked up changes to rld.c for use of _NXArgv and __mh_execute_header to use
  _NSGetArgv() and _NSGetMachExecuteHeader().

Changes for the 5.0 release (the cctools-221.2 and cctools-222 releases):
- Picked up changed layout.c to which changed the variable ppc to powerpc
  because the PowerPC compiler defines the cpp macro ppc to 1.

Changes for the 5.0 release (the cctools-221.1 and cctools-222 releases):
- Picked up changed to the Makefile to not build profile objects for teflon.
  This is because the PowerPC compiler core dumps with -pg.

Changes for the 5.0 release (the cctools-221 release):
- Picked up the changes for the correct Rhapsody thread state changes into
  layout.c.

Changes for the 5.0 release (the cctools-220 release):
- Fixed a bug in add_dynamic_lib() in pass1.c that was not prepending $NEXT_ROOT
  to the paths of dependent dynamic libraries.

Changes for the 5.0 release (the cctools-218 release):
- Added hacks to pad pure instruction sections of i386 outputs with nop's
  (opcode 0x90) to clean up dissassembly.  This is done in output_section()
  secions.c and in the new function nop_pure_instruction_scattered_sections()
  (bug #77806).
- Added .section_align <align_value> to like .section_offset <offset_value>.
  This causes the next item to be placed on the power of 2 alignment of
  align_value (bug #77807).

Changes for the 5.0 release (the cctools-218 release):
- Fixed a warning with "static jmp_buf rld_env's initializer" in rld.c which 
  needed an ifdef for i386.

Changes for the 5.0 release (the cctools-216 release):
- Made changes to allow external relocation entries for lazy symbol pointer
  sections.  First had to remove a test in indirect_section_merge() in
  indirect_sections.c which checked that relocation entries in lazy pointers
  sections must not have external relocation entries.  Just below that I added
  the checks needed for external relocation entries.  Second in each of the
  relocation routines I added just after the update_reloc: label the changing
  of an extern relocation to a prebound lazy pointer if needed.
- Changed ld.c to just include libc.h for Teflon.

Changes for the 5.0 release (the cctools-215 release):
- Added the $(RC_OS) trick to the all target as well as the lib_ofiles target so
  this will build on the Teflon SDK.
- Added #include <sys/fcntl.h> in ld.c on the #ifdef __TEFLON__ side so O_RDONLY
  does not come up undefined with the Teflon SDK.
- Added support for the PowerPC section difference HI16, LO16 and HA16
  relocation types.

Changes for the 4.2 & 5.0 releases (the cctools-213 & cctools-209.3 releases):
- Fixed a bug in check_dylibs_for_definition() where it was printing the module
  name of the dynamic library wrong because it was using strings where it should
  have been using p->strings.
- Fixed a typo in an error message in open_dylib() in pass1.c where "effected"
  should have been "affected" (bug #77070).
- Fixed a bug where prebinding was not getting done when a private extern was
  overridding a symbol in a dependent library.  The fix was not to check
  private externs in prebinding_check_for_dylib_override_symbols() in pass1.c

Changes for the 5.0 release (the cctools-212 release):
- Fixed a bug where $NEXT_ROOT did not prefix standard framework paths.  Also
  fixed -Z to not use standard framework paths.

Changes for the 5.0 release (the cctools-211 release):
- Integrated changes to allow teflon builds (RC_OS=teflon or RC_OS=nextstep) to
  not build shlib_ofiles in the Makefile.  Also changes in the sources to not
  include <libc.h> for __TEFLON__ builds.

Changes for the 5.0 release (the cctools-210 release):
- Changed the default starting address for ppc to 0 (layout.c).
- Changed m98k to ppc.

Changes for the 4.2 release (the cctools-209.1 release):
- Added -image_base as the same as -seg1addr.

Changes for the 5.0 release (the cctools-208 release):
- Added code to prepend the value of the environment variable NEXT_ROOT to the
  standard paths if it is set.  This is to support the TEFLON cross build
  environment.  All changes are in ld.c

Changes for the 4.2 and 4.1 patch release (the cctools-207 release):
- Ifdef'ed out the warning about an archive library following a dynamic shared
  library.  This is so that libcc_dynamic.a will not produce this warning when
  it is linked into all images.

Changes for the 4.2 release (the cctools-205 release):
- Added telling PB "Architecture Mismatch" when a error for -arch_errors_fatal
  gets printed.  (bug #74032)

Changes for the 4.2 release (the cctools-204 release):
- Fixed a typo in an error message in pass1.c.  "prebinding disabled because of
  symbols overridded in dependent dynamic shared libraries" where "overridded"
  was changed to "overridden" (bug #71334).

Changes for the 4.0 release (the cctools-201 release):
- Changed internal_rld_load() to call the constructors (and profiling stuff)
  only if the base file is the executable.  This was causing the debugger to
  crash when debugging a bundle with C++ constructors (bug #66200).

Changes for the 4.0 release (the cctools-200 release):
- Changed fine_reloc_output_address() to not cause an internal error when you
  have a fine reloc for a non-lazy symbol pointer section.  This can result with
  private externs and doing an ld -r first and then doing an ld on the result
  (bug #65823).

Changes for the 4.0 release (the cctools-199 release):
- Fix to bug fix 65292 in cctools-197 which was still wrong and causing all
  programs with these warnings to be fatal because error() was called and not
  warning().  More logic was added to fix this (bug #65633).

Changes for the 4.0 release (the cctools-198 release):
- Fix to ld that bug fix 65292 introduced in cctools-197 which was causing
  -fvmlibs to fail to build because of prebinding warnings (bug #65451).

Changes for the 4.0 release (the cctools-197 release):
- Changed ld so that when prebinding is being done and -U's are used for allowed
  undefined symbols these symbols are printed if prebinding is being disabled
  because of undefined symbols (bug #65292).
- Changed ld so that the warning message "ld: warning using file: x for
  reference to dynamic shared library from: y because no -dylib_file specified"
  because it is felt to be distracting (bug #65276).

Changes for the 4.0 release (the cctools-195 release):
- Fixed a bug reset_prebound_undefines() when dealing with indirect symbols that
  are defined when prebinding.  The desc field should not have been changed as
  it changes the type of reference (lazy or non-lazy) as well as the
  REFERENCED_DYNAMICALLY bit (bug #64885).

Changes for the 4.0 release (the cctools-192 release):
- Changed the default header pad from 0 to the sizeof a section struct so that
  /bin/objcunique can always add a section header (bug #63516).

Changes for the 4.0 release (the cctools-176 release):
- Change the default protection to not include execute unless the segment
  contains sections with instructions.  Also don't set execute on the linkedit
  segment (bug #58445).

Changes for the 4.0 release (the cctools-175 release):
- Disabled prebinding if -dynamic not set.  Also don't use LD_PREBIND if -r
  is set to avoid warnings.

Changes for the 4.0 release (the cctools-174 release):
- Added building dynamic_ofiles for the lib_ofiles (RC bootstrap) target in
  the Makefile.

Changes for the 4.0 release (the cctools-173 release):
- Disallowed -prebind with -bundle.
- Added the setting of -prebind via the environment variable LD_PREBIND.
- Added the LC_PREBOUND_DYLIB load command to record which modules were linked
  from a dynamic library that was prebound.
- Fixed a bug when an N_INDR symbol chain had symbols from both dylibs and
  non-dylibs.  The specific problem was when -i_os_fcvt:_fcvt was on the
  command line and there was an object in the dynamic libsys that defined _fcvt
  as an indirect for __fcvt.  Then both the indirect symbol table entry for
  _os_fcvt and the symbol table entry for _os_fcvt were bad because the symbol
  _fcvt from the dylib does not appear in the output file.  To fix this a
  structure of pairs of merged_symbols and indr_symbols was created in
  reduce_indr_symbols() and used in output_merged_symbols() and
  merge_indirect_sections().

Changes for the 4.0 release (the cctools-172 release):
- Fixed a bug in count_relocs() where it should not have reduced the N_INDR
  symbol if it was defined in a dylib (line 2720 in sections.c).
- Changed it so that when prebinding an executable the local relocation entries
  for lazy symbol pointers are saved.  This must be done even if prebinding
  fails after indirect_section_merge() has been call so that the number of
  relocation entries does not change after layout.  This effected layout.c
  by setting the new boolean save_lazy_symbol_pointer_relocs to the value of
  prebinding just before merge_literal_sections() is called.  Then this boolean
  is used in indirect_section_merge() and reloc_output_for_dyld() to count and
  put out the relocation entries.
- Fixed a bug in all the *_reloc.c relocation routines when updating the
  relocation entry.  The problem was when the relocation entry was an external
  and the merged symbol was a prebound undefined (N_PBUD) the relocation entry
  should not have been turned into a local relocation entry.
- Changed the checking that prebinding_check_for_dylib_override_symbols() does
  to only fail if the symbol is overridden and the the symbols is referenced in
  a dylib.  To do this the routine check_dylibs_for_reference() was added and
  called from check_dylibs_for_definition() in pass1.c.

Changes for the 4.0 release (the cctools-171 release):
- Fixed a in indirect_section_merge() in indirect_sections.c at line 277 where
  if the symbol is an N_INDR and not defined in a dylib the indirection needed
  to be reduced so the setting of indirect_defined is done correctly
  (bug #57113).

Changes for the 4.0 release (the cctools-170 release):
- Picked up a bug fix to sparc_reloc.c for SPARC_RELOC_HI22_SECTDIFF where
  immediate did not have value added to it but rather an incorrect expression.
- Added prebinding_check_for_dylib_override_symbols() to check when prebinding
  that no symbols in dependendent dylibs are overridden and if so disable
  prebinding and print a warning.  The call in made in layout.c and the routine
  is in pass1.c (since the searching stuff for dylibs in in there).
- Overlap checking of dylibs and the program being linked was added by first
  changing check_overlap() to take the bool argument prebind_check and if it is
  FALSE to do as it did and if TRUE print the over lap as a warning why
  prebinding is being disabled.  Second check_for_overlapping_segments() adding
  the dylib segments to the list if prebinding and adding a loop to check the
  segments with check_overlap() and prebind_check == TRUE.
- To allow prepare for overlap checking of dylibs and the program being linked:
  add_dylib_segment() was added to dylibs.c.   Then search_dynamic_libs() a had
  loop added to it to collect dylib segments.
- To allow prepare for overlap checking of dylibs and the program being linked
  process_undefineds() was broken up so the the reseting of prebound undefineds
  is now done in reset_prebound_undefines().  So reset_prebound_undefines() is
  called after layout_segments() where overlap checking will be done and may
  disable prebinding if there is overlap.  This turned up three problems.
  The first in assign_output_symbol_indexes() which needed to treat N_INDR
  from a defined in a dylib as an undefined symbol (this same problem was in
  count_relocs() and in one missed place in indirect_section_merge().  The
  second in count_relocs() which needed to treat an N_PBUD as an undefined
  symbol.
- Fix the problem with "link order" object for dyld output file being "loaded"
  twice warning when scattered loading.  This was a result of the common object
  and the module for the dylibs having the same name.  The change was to add
  quotes around the name "\"link order\"" for the common object so they would
  have different names.
- Changed scatter_copy() in sections.c to do the same for lazy symbol pointer
  sections as for non-lazy symbol pointer section if prebinding.  That is use
  the value of the indirect symbol.  This also required an if prebinding ==
  TRUE to be or'ed with indirect_defined test.  This also gets the value's
  of non-lazy symbol pointer set when prebinding.
- Changed the *_reloc.c routines for external relocation entries to use the
  n_value of the symbol for MH_DYLIB's when prebinding.  When updating the
  non-scattered local relocation entries if prebinding and it is a lazy symbol
  pointer section the relocation entry is turned into a _PB_LA_PTR relocation
  type with the non-prebound value of the lazy symbol pointer saved in r_value.
- Turned off prebinding in process_undefineds() in symbols.c when there are
  undefined symbols and print a warning.  Then if prebinding is still in effect
  the undefined symbols are not turned back into undefined symbols but left
  as prebound undefined symbols.
- Turned off prebinding when in search_dynamic_libs() when open_dylib() fails
  to open a dependent dynamic library and print a warning.  Also turned off
  if a dependent dynamic library is not prebound and print a warning.
- Turned off prebinding when -undefined suppress is set in ld.c and print a
  warning.
- Added -prebind and -noprebind options to ld.c and the global prebinding.

Changes for the 4.0 release (the cctools-169.2 release):
- Fixed a bug in the hppa relocation for JBSR's with fine relocation.  The fine
  reloc case was missing the check for r_extern == 1 in the case of MH_DYLIB
  which the non fine reloc case had (line 735).

Changes for the 4.0 release (the cctools-168 release):
- Added creating a symbolic link to dynamic_profile_obj from profile_obj.
- Added an optional suffix to "-framework Foo,suffix" which first searches for
  the framework with the suffix and then without.
- Change the version numbers of dynamic library to the form X[.Y[.Z]] to match
  how next does versioning of it's projects.  This effected libtool(1), ld(1),
  otool(1), dyld, libstuff(version_number.c) and man pages for ld and libtool
  bug #55627).  In here the changes were in ld.c .

Changes for the 4.0 PR1 release (the cctools-166.3 and cctools-167 releases):
- Changed the merge_symbols() routine to propagate the REFERENCED_DYNAMICALLY
  bit from undefined symbols in to the merged symbol table.  This is used to
  solve the problem with the symbols in crt1.o (and __mh_execute_header) in
  a dynamicly linked program where they are used by libsys via _dyld_lookup_
  and_bind() but get stripped by strip(1) because they don't have the
  REFERENCED_DYNAMICALLY bit set.  This also requires crt1.o to have this
  bit set for the symbols it defineds and for __mh_execute_header.  Which is
  done with the .desc assembler directive (bug #54660).

Changes for the 4.0 PR1 release (the cctools-166.1 and cctools-167 releases):
- Fixed a bug in lookup_symbol where the test case for the internal error of
  the lookup failing was off by one (bug #53390).

Changes for the 4.0 release (the cctools-166 release):
- Changed the reference to NXArgv and _mh_execute_header in rld.c to use
  _dyld_lookup_and_bind() in the case of __DYNAMIC__ .
- Changed the use of the cpp macro DYNAMIC (set by the Makefile) to __DYNAMIC__
  (set by the compiler when -dynamic is in effect).
- Removed -fomit-frame-pointer because of compiler bug with -dynamic (bug
  #52986).

Changes for the 4.0 release (the cctools-164 release):
- Fixed a bug in output_flush() in pass2.c that was causing the internal error
  "first block written_offset not 0" in final_output_flush().  The fix to
  output_flush() was to not set written_offset to the rounded offset, but rather
  zero, when the offset is less than the pagesize and nothing got written from
  the block.  This happens only for the first page.
- Added the -arch_errors_fatal flag to make mis-matching architectures errors
  fatal.

Changes for the 4.0 release (the cctools-163 release):
- Changed the default to -dynamic.  This is done in ld.c with:
    enum bool dynamic = TRUE;

Changes for the 4.0 release (the cctools-161 release):
- Added in the Makefile passing -DDYNAMIC for things built with -dynamic
  Then ifdef'ed out some const's in section.[ch] and symbols.c with DYNAMIC so
  that when this is put in a dynamic shared library it does not have relocation
  entries in a read-only section.
- Fixed a bug that caused the error message that an indirect symbol could not be
  a private_extern symbol when -keep_private_externs was on with -r.  The fix
  was in indirect_sections.c where the if condition for the error checked for
  private extern bit this "(...nlist.n_type & N_EXT) != N_EXT" condition was
  also added.
- Added checking for relocation entries in read only sections when the output
  is for the dynamic linker.  This is controled by the flag -read_only_relocs
  which takes arguments {error,warning,suppress} where warning is the default.
  This checking is done in reloc_output_for_dyld() in sections.c and has some
  functions in symbols.c to clear and flag symbols based on a bit in the merged
  symbol structure.

Changes for the 4.0 release (the cctools-157 release):
- Fixed a bug in ld that caused dynamic libraries built with dependent dynamic
  librarys to have bad table of contents.

Changes for the 4.0 release (the cctools-154 release):
- Added marking symbols defined in the output file referenced from a dylib with
  REFERENCED_DYNAMICALLY in the n_desc field.

Changes for the 4.0 release (the cctools-153 release):
- Fix a problem with the cctools-151 change that showed up in
  indirect_section_merge() because it was checking the section's flags for
  correctness and the "link editor" created object did not copy the flags.
  So the quick fix was to add if s->size == 0 then return.

Changes for the 4.0 release (the cctools-152 release):
- Fixed an error check in check_cur_obj() in pass1.c() that was checking the
  irefsym field of a module table entry against size of the symbol table
  instead of the size of the reference table.

Changes for the 4.0 release (the cctools-151 release):
- Fixed a bug in setting the value of non-lazy pointers for link editor defined
  symbols.  The problem was that indirect sections were merged before the 
  link editor defined symbols were set up so the appeared to not be defined and
  their value was never set in the non-lazy pointer.  The fix was in layout.c
  to just reorder the calls setup of these symbols before the merge of literal
  sections.

Changes for the 4.0 release (the cctools-150 release):
- Changed the profiled objects to be compiled with -dynamic.
- Changed everything to use extern .
- Changed to allow private externs without the -dynamic flag.
- Added a check in indirect_section_merge() to treat an indirect symbol that
  turns out to be a private extern as an error.
- Added a vm_protect() call for the rld memory to turn on execute protection.
  This is needed as the kernel has changed to not include VM_PROT_EXECUTE on
  vm_allocate()'ed memory.  Without this it fails on the hppa which uses this
  in it's hardware (bug #50860)

Changes for the 4.0 release (the cctools-149 release):
- Fixed a problem with standard_framework_dirs[] that the strings did not
  contain a trailing /.
- Added the -filelist list[,dirname] option to ld (bug #50779).
- Added the -bind_at_load option that marks the output with MH_BINDATLOAD in
  the mach header.  This is not allowed for dynamic libraries.

Changes for the 4.0 release (the cctools-148 release):
- Changed how the librld builds.  It now builds 4 objects.  One for the
  following uses: static, dynamic, profiled and shlib.  Also added the -static
  flag to sarld building.
- Fixed a bug in fine_reloc_output_sectnum() in objects.c returned the wrong
  section number where if an indirect section's relocation entry refered to an
  merged_symbol who's n_type was N_INDR and the indirection was not removed.
  This resulted on getting an internal error in output_section() for the count
  of local relocation entries.  This was found when linking dyld when it was
  compiled with -dynamic.

Changes for the 4.0 release (the cctools-147 release):
- Changed -framework Foo and removed the .dylib at the end of the name to be
  search for.
- Fixed yet another problem with not getting the local relocation entrys right
  when output_for_dyld.  The problem was that code that was added in
  count_reloc() to fake the relocation to get the correct resulting r_symbolnum
  was not working.  In merge_section() only S_SYMBOL_STUBS sections were
  getting ms->output_sectnum set to 1 (a non-NO_SECT value) when all sections
  needed this.  So this is now done for all sections.

Changes for the 4.0 release (the cctools-146 release):
- Fixed a bug in linking dylibs across byte sex.  The symbol table was not
  swapped before it was used in searching in pass1.  This was added and a check
  for MH_DYLIB was added in symbols.c to not swap it again.
- Fixed a problem where creating sparc binaries on a little endian machine
  did not get the 6 reserved bits of the psw correct.  The fix was in libstuff
  swap_sparc_thread_state_regs() (bug #49685).  This was CCC approved for
  3.3risc and a cctools-142.1 clone with just this fix was submitted.

Changes for the 4.0 release (the cctools-144 release):
- Fixed a bug in in -preload introduced in cctools-143 when support for
  undefined checking against dylibs was added.

Changes for the 4.0 release (the cctools-143 release):
- Added support for undefined checking against dylibs.
- Made a change to parse_order_line() in sections.c to parse out an objective-C
  symbol name differently to handle the problem with 3.2 C++ compiler where the
  symbol name (McCaw's problem).  This should not really be in 4.0 as the 3.3
  and later C++ compilers do not have this problem.
- Fixed a bug in rld code in remove_objects() in objects.c where cur_obj was
  being used instead of object_file to test for the undefined_list and free
  it.

Changes for the 4.0 release (the cctools-142 release):
- Fixed the call to pass1() in rld.c to added the extra argument for frameworks.

Changes for the 4.0 release (the cctools-141 release):
- Made ld search all frameworks specified with -framework (e.g. -framework Foo)
  in the framework search path as Foo.framework/Foo.dylib.  Default path is
  /LocalLibrary/Frameworks, /NextLibrary/Frameworks . Additional search
  directories can be specified with -Fdir .
- Added the -no_arch_warnings for libtool to use which prevents warnings
  for file which don't have the correct architecture for the -arch flag.
- Fixed an edge case in all relocation routines for scattered relocation entries
  where the last address past then end of the last section is referenced.  In
  this case it was getting an out of range error when infact an address could be
  referenced as the last address of all of the sections if a lable exist with no
  data following it.
- Fixed the spelling of "compatibility" in the compatibility_version for dylibs.
- Fixed a bug in hppa_reloc() for MH_DYLIB files where a check on line 914 was
  checking merged_symbol's type  without checking r_extern == 1 to see if
  merged_symbol was valid (bug #48008).

Changes for the 4.0 release (the cctools-140 release):
- Picked up sparc changes to sparc_reloc.c which fixes scattered relocation
  problems.

Changes for the 4.0 release (the cctools-138 release):
- Added the MH_BUNDLE object file type to be used with NSLinkModule().
- Fixed a bug in reporting common symbols for -dylib where the wrong object file
  was referenced.  The fix was in merge_symbol() when an merged symbol changes
  from an undefined to a common the definition_object needed to be assigned to
  the current object.
- Fixed a bunch of bugs in getting the right relocation entries out for ld -r
  with indirect sections.  The approach now taken is to relocate all things
  who's contents are not used in the output to past the end of the section and
  then the r_address after relocation can be used to determine if the relocation
  entry is to be saved.

Changes for the 4.0 release (the cctools-137 release):
- Picked up sparc_reloc.c.
- Added the -Y n flag to print n references to undefined symbols (bug #46166).
- Fixed a problem with parsing -dynamic which ate the next argument (crt1.o in
  the case used by the driver).
- Fixed a bug when using -output_for_dyld and libsys local relocation entrys
  were not correct because a local relocation entry to a symbol stub that is
  eliminated because the symbol is defined as an N_ABS symbol causes the
  relocation entry to be need to be saved even though it started out as a local
  r_pcrel but now refers to an N_ABS symbol.  The fix was in count_reloc() in
  sections.c to fake doing the relocation on such an item to get the correct
  resulting r_symbolnum (which in this case is N_ABS) which will then be used
  to determine if the relocation entry is pic.
- Fixed a bug in sparc_reloc() for the SPARC_RELOC_WDISP30 relocation type for
  scattered loading which was a copy and paste error that did not set "value"
  but rather "offset" when picking up the item to be relocated for a local
  relocation entry with fine relocation.

Changes for the 4.0 release (the cctools-134 release):
- Fixed a bug in ld -M in printing the map that core dumps.  There was a use of
  cur_obj in a couple of places that should have been object_file in layout.c
  when testing the dylib and dylinker fields (bug #44619).

Changes for the 4.0 release (the cctools-133 release):
- Picked up sparc changes to layout.c for the name changes of the sparc thread.
- Fixed a bug in fine_reloc_output_address() in object.c that was testing for
  non-lazy not lazy section pointers and cause a fatal internal error when a
  defined symbol had a symbol stub entry and a lazy symbol.
- Changed it so that undefined symbols are not allowed if the output is a
  dynamic linker.
- Fixed a bug in rld that didn't get the alignment right because the header_size
  was not rounded to the maximium section alignment which was used as the
  starting address (bug #44241).
- Added three Project builder messages, "Link errors", "Undefined symbols" and
  "Multiply defined symbols" to ld (bug #40745).
- Fixed a bug for hppa in the relocation for JBSR's in MH_DYLIBS for external
  relocation entries.  This should not have relocated a JBSR to the defined
  external for MH_DYLIBS if the symbol was not a private_extern.

Changes for the 4.0 release (the cctools-132 release):
- Picked up sparc changes to sections.c for sparc relocation.
- Picked up sparc changes to layout.c for sparc thread.
- Picked up new sparc files sparc_reloc.h and sparc_reloc.c and change the
  Makefile.
- Added -dynamic to eventually replace -NEXTSTEP-deployment-target 3.3 and
  -static to eventually replace -NEXTSTEP-deployment-target 3.2.  Changed all
  the incompatiblity error messages to use -dynamic.
- Removed the private externs from the toc for dylibs and desided to leave them
  in the reference table.  They could be pulled from the reference table but
  then it would be harder to size and construct it as it would take another
  pass to determine if an undefined symbol mached up with a private extern.
  This still could be done later if space is an issue.  It also could be an
  issue if a library module with private externs wants to be unloaded or
  replaced which may not be possible.
- Changed the way private externs are handled.  Now the N_PEXT is never turned
  off and symbols with this bit are always saved with the -x flag.  This
  effected a number of places.  Also changed was the handling of non-lazy
  pointers to allow private externs as the indirect symbol.  This allowed
  a non-external symbol (that was previouly a private extern) to be an indirect
  symbol.  This caused all sorts of changes to indirect symbols and the handling
  of fine relocs.
- Changed hppa_reloc()'s handling of JBSR relocs for output_for_dyld for JBSR
  undefined symbols.  In this case the bl instruction is not changed so that
  it will continue to point at the long branch stub (which in the case of
  output_for_dyld should be targeted at symbol stub).
- Fixed a bug in hppa_reloc() for ld -r of JBSR reloc types for external
  relocation entries turning into local when the symbol was defined as a
  private extern with the N_SECT type.  The problem was that n_type & N_TYPE
  was not used but rather n_type == (N_EXT | N_SECT) when testing to determine
  if the other_half needed to be adjusted.  This same problem shows up in many
  other places which have been corrected.
- For the hppa corrected the output when the output is for dyld so JBSR relocs
  are never in the output.
  This effected count_relocs() and reloc_output_for_dyld() in sections.c .

Changes for the 3.3 release (the cctools-130 release):
- Fixed a problem with the CATS bug fix.  In remove_set() in sets.c it was doing
  a free() of the data structures not a memset() back to zero.

Changes for the 3.3 release (the cctools-128 release):
- Removed the make app stuff (bug #40745) effected ld.c.
- Fixed an rld bug that CATS software found when loading more than 10 objects
  with commons.  The bug was that the sets data structure was being realloced
  after 10 rld_load()'s and the merged_symbol structure for previous loaded
  common symbols had a definition_object pointer pointing to the old memory.
  The fix was to change the sets data structure and change the three structs
  in there to pointers to pointers to structs and allocate each of those
  structs. Effects sets.c sets.h symbols.c (bug #42703).
- Fixed a bug in rld where in set_merged_string_block_indexes() in pass2() was
  not being called because it got if'ndefed RLD out (bug #42283) introduced in
  cctools-122.

Changes for the 3.3 release (the cctools-127 release):
- Changed the order of the symbol information to optimize dyld's memory use.
  strip(1) has been changed to handle this new order.
- Fixed a bug where ld -r for indirect sections would not get the relocation
  entries put out.  The bug was in scatter_copy_relocs() that was calling
  fine_reloc_offset_in_output() which should have been calling
  fine_reloc_offset_in_output_for_output_offset().  Then the problem was that
  fine_reloc_offset_in_output_for_output_offset() was not mapping to the correct
  fine_reloc for use_contents == 0 because the output_offset was relocated using
  a fine_reloc that it's output_offset did matter and was zero.  This caused
  fine_reloc_offset_in_output_for_output_offset() not to map the relocated
  output_offset back to the correct fine_reloc.  The fix to this problem was to
  set output_offset in all the fine_relocs with use_contents == 0 before
  relocation to the output_section's size so later the correct fine_reloc would
  be mapped to and use_contents will have 0 for these.  This is done in
  output_section() in sections.c if the output is relocatable and it is for
  an indirect section.
- Changed the thread command of a MH_DYLINKER from a LC_UNIXTHREAD to an
  LC_THREAD (bug #42338).
- Fixed a bug where for MH_FVMLIB and MH_DYLIB formats commons were not traced
  when found in define_common_symbols().  I removed the if test that caused
  this routine to return for these formats I mistakenly added and not to drop
  in to the loop to define them and also to trace the symbols.

Changes for the 3.3 release (the cctools-125 release):
- Changed the temporary warning "current limitation: dynmaic linker used so
  undefined symbols not reported" in layout_merged_symbols() in symbols.c to
  not dependend on using a dylib but just rather having a dynamic linker
  command and being output for dyld.

Changes for the 3.3 release (the cctools-124 release):
- Temporarily added a the warning "current limitation: dynmaic linker used so
  undefined symbols not reported" in layout_merged_symbols() in symbols.c.
- Added allowing fat object files in archives when -all_load is specified.  This
  was done in pass1_archive() in pass1.c.  This was added to allow libtool to
  use it when creating libs with -dynamic.
- Added a check for private externs if the deployment target is 3.2 to flag it
  as incompatable.
- Changed define_common_symbols() in symbols.c to defined commons for when
  output_for_dyld is TRUE.

Changes for the 3.3 release (the cctools-122 release):
- Fixed a bug where the module names of a dylib did not have the right indexes.
  The assignment of merged string blocks index's was moved from the function
  output_merged_symbols() into a new function set_merged_string_block_indexes()
  and called in pass2.c before output_dylib_tables().
- Fixed a bug in reloc_output_for_dyld() for indirect sections where the call to
  fine_reloc_offset_in_output() did not work because the r_address had been
  relocated to the output address.  So a new function that takes an
  output_offset, fine_reloc_offset_in_output_for_output_offset(), was written
  and is now used.  This caused local relocation entries to be missing and the
  link editor to get an internal error.
- Fixed a bug in merged_symbol_string_index() for rld which was crashing when
  things got unloaded because the static var saved a pointer to a deallocated
  string block (bug #41376).
- Added the -NEXTSTEP-deployment-target flag.  Also added -k that implys 3.3.
- Added a bunch of checks based on the deployment target in the area of what
  flags could be used (-dylib, etc) and checks for new sections in the input
  files.  Also added for deployment on 3.2 the removal of section attributes
  so PURE_INSTRUCTION objects just work.
- Added searching for libx.dylib for -lx if deployment is not 3.2.

Changes for the 3.3 release (the cctools-120 release):
- Fixed a bug in fine_reloc_output_address() in objects.c when a symbol stub's
  indirect symbol table is for an N_INDR symbol the chain through the n_value
  being a (struct merged_symbol *) was not followed.
- Fixed a bug when building MH_DYLINKER format where setup_link_editor_symbols()
  should not have incremented dysymtab_command.nextrefsyms for MH_DYLINKER but
  only for MH_DYLIB.  This causes a flush overlap error.  This fix is needed to
  build the dynamic linker.
- Fixed a bug where the indirect symbol table was not swapped on cross links for
  differing bytesex.  The swaping was added in check_cur_obj() in pass1.c as
  well as checking each entry that it is in range.
- Fixed a in all the *_reloc() routines with respect to relocating a sectdiff
  entry where one of the values has fine relocation.  The bug was that the value
  that didn't have the fine relocation did not have it's *_map->offset (the
  offset into the output section where this object file's section starts) added
  in to calculate it's value.  This effected all *_reloc.c routines (except
  i860_reloc.c which has no fine relocs).
- Fixed a bug in generic_reloc() when pcrel_at_end_of_disp is TRUE (the i386
  case) for a pcrel external relocation entries in calculating the offset in the
  item to relocated.  Which is used to decide to create a scattered or local
  reloc.  This caused a flush overlap error when the relocation entry was tried
  to be created that was not to be there for output_for_dyld.

Changes for the 3.3 release (the cctools-119 release):
- Fixed the rld bug where C++ constructors/destructors were not called.  The
  fix is at the end of the internal_rld_load() where the it loops through the
  section and does the call or registers it with atexit() (bug #40616).
- Added the S_ATTR_EXT_RELOC and S_ATTR_LOC_RELOC attributes to sections so the
  dynamic linker can determine if it needs to vm_protect() it's segments.  This
  Was added in count_relocs() and layout_relocs_for_dyld() in sections.c.

Changes for the 3.3 release (the cctools-118 release):
- Fixed a bug that when an "ld -arch xx -ifoo:bar" was done the target byte
  sex was picked as the host bytesex not based on the -arch flag.  The fix was
  in ld.c to set target_byte_sex when a -arch flag was seen and later to not set
  it to the host_byte_sex if a -arch flag was specified.

Changes for the 3.3 release (the cctools-117 release):
- Fixes a bug in assign_output_symbol_indexes() in symbols.c for RLD which got
  the internal error "internal error: assign_output_symbol_indexes()
  inconsistent local symbol counts" because the loop that sets the indexes for
  the local symbols did not have an ifdef RLD for skiping the objects not in the
  current set.

Changes for the 3.3 release (the cctools-116 release):
- Fixed a bug in layout() that did not allow an entry point if the first segment
  did not have any non-zerofill segments and a -e option was specified.

Changes for the 3.3 release (the cctools-115 release):
- Fixed what was included for the SA_RLD code so the the time() and qsort()
  functions are not needed.  Dis-allow all indirect sections for SA_RLD code
  which allows merged_symbol_output_index() not to be needed and the symbol
  table not to be ordered so qsort() in not needed.  The need for time() was
  because of time stamp for creating dylibs which was ifdef'ed SA_RLD out.
- Fixed a bug in legal_reference() in indirect_sections.c to allow references
  to a symbol stub section not at the start of the stub by the symbol stub
  itself which is what happens in pic symbol stubs.
- Made a change to what is allowed for indirect symbols.  Previously only
  undefined external symbols were allowed.  Now
  1) Any external symbol is allowed as an indirect symbol (even if defined)
  2) A local symbol is allowed as an indirect symbol for a symbol stub and lazy
     pointer section (which the stub and pointer will then always get removed).

Changes for the 3.3 release (the cctools-114 release):
- Fixed a bug introduce in cctools-112 with command line created symbols, -i
  options, that produce warnings when scatter loaded because the object file
  "command line" was multiply loaded.
- Fifth major round of changes for the new shlib stuff.
  1) Added the code to produce and link with the dylinker format.
  2) Added the code to link with the dylib format (for now only the load command
     is copied to the output file).
  3) Added the optimization to the link editor to use the value of the symbol
     for a non-lazy pointer section if it is defined.  This will allow the
     compiler code generation to be developed and tested without the dynamic
     linker).

Changes for the 3.3 release (the cctools-113 release):
- Fixed a bug introduced in cctools-112 in outputing the relocatation entries
  for S_LITERAL_POINTERS sections.  Both ld -r and ld -output_for_dylib were
  broken.  The problem for ld -r was the counting of the relocation entries for
  literal pointers was wrong.  A new routine, count_relocs, was added in
  literal_pointers.c based on if the literal pointer as newly seen.

Changes for the 3.3 release (the cctools-112 release):
- Fixed a bug in the hppa reloc for scatter loading BL17 relocation types that
  was always 8 past the target.  "value -= 8;" was added in the local reloc case
  with fine relocs.
- Forth major round of changes for the new shlib stuff.
  1) Added the code to produce the dylib format.  New tables and relocation
     info changes.

Changes for the 3.3 release (the cctools-108 release):
- Third major round of changes for the new shlib stuff.
  1) Added the code to order the symbol table and string table.

Changes for the 3.3 release (the cctools-104 release):
- Second major round of changes for the new shlib stuff.
  1) Added support for indirect sections and relocation to them when indirect
     symbols get defined.
- Fixed a bug with the hppa JBSR reloc types (mostly when saving relocation
  entries, scattered loading and non-zero based sections).
- Found and fixed a bug in the 3.2 released link editor.  This bug happens when
  relocation entries are saved and there are scattered relocation entries which
  reference a section with fine relocation the r_value field is not updated
  correctly.  The code was:
    sreloc->r_value = fine_reloc_output_offset(local_map,
			    		       r_value - local_map->s->addr) +
		      local_map->output_section->s.addr + local_map->offset;
  which was corrected to:
    sreloc->r_value = fine_reloc_output_offset(local_map,
					       r_value - local_map->s->addr) +
		      local_map->output_section->s.addr;
  as the value of local_map->offset should not have been added.

Changes for the 3.3 release (the cctools-103 release):
- Removed the "__attribute__ ((format (printf, 1, 2))" from vprint in ld.h as
  it was incorrect and the new compiler treats this as an error.

Changes for the 3.3 release (the cctools-102 release):
- Integrated in the hppa support.
  * Added the SECTDIFF support for the hppa with the HI21 and LO14 SECTDIFF
    relocation types.
  * Fixed the use of calc_hppa_HILO() in hppa_reloc() in hppa_reloc.c to
    correctly pass the symbol value and offset value as the two first
    parameters.
different ld/Makefile (integrated for cctools-102)
     Using cctoolshppa-37.  New hppa files.
different ld/layout.c (integrated for cctools-102)
     Using cctoolshppa-37.  hppa thread stuff.
different ld/ld.h (NOT picked up for cctools-102)
     Using cctoolshppa-37.  The define CHECK_PRINTFS is ifndef'ed out hppa
     with the comment /* va_list defined differently for hppa.  Check this */
different ld/notes
     Using cctools-29. Late 3.2 fixes the hppa base did not have.
different ld/pass1.c
     Using cctools-29. Late 3.2 fixes the hppa base did not have.
different ld/rld.c
     Using cctools-29. Late 3.2 fixes the hppa base did not have.
different ld/sections.c (integrated for cctools-102)
     Using cctoolshppa-37.  hppa reloc call based on cpu type.
Only in cctoolshppa-37/ld: hppa_bitfuncs.c (NOT picked up for cctools-102)
     Pickup cctoolshppa-37/ld/hppa_bitfuncs.c from cctoolshppa-37.
Only in cctoolshppa-37/ld: hppa_bitfuncs.h (NOT picked up for cctools-102)
     Pickup cctoolshppa-37/ld/hppa_bitfuncs.h from cctoolshppa-37.
Only in cctoolshppa-37/ld: hppa_reloc.c (integrated for cctools-102)
     Pickup cctoolshppa-37/ld/hppa_reloc.c from cctoolshppa-37.
Only in cctoolshppa-37/ld: hppa_reloc.h (integrated for cctools-102)
     Pickup cctoolshppa-37/ld/hppa_reloc.h from cctoolshppa-37.

Changes for the 3.3 release (the cctools-101 release):
- Added code in the reloc routines to check that byte and short relocation
  fits.

Changes for the 3.3 release (the cctools-100 release):
- First major round of changes for the new shlib stuff.
  1) Support for spliting the sections flags field in to types and attributes.
     Lots of places that used flags now use (flags & SECTION_TYPE).
  2) Support for possition-independent code through the SECTDIFF relocataion
     type.  This effected all the *reloc.c sources.
  3) Support for .private_extern directive with -keep_private_externs.  Where
     the change from external to static happens in in layout_merged_symbols()
     in symbols.c.

Changes for the 3.1 release (the cctools-28 release):
- Fixed a bug where pass1_fat() cleared the error variable and caused multiple
  defined errors not to cause the link editor to exit and instead produce an
  output file (bug #37043).
  
Changes for the 3.1 release (the cctools-27 release):
- Fixed a bug in sarld's vprint() which did not advance the error buffer
  correctly.

Changes for the 3.1 release (the cctools-25 release):
- Fixed bug #36216 which did not issue a warning when -Ldir's don't exist.
- Added stand alone rld as libsarld.a which is supported by the ifdef SA_RLD.

Changes for the 3.1 release (the cctools-20 release):
- Changed the m98k seg1addr to 0x13a00000 for the m98k (-object too).

Changes for the 3.1 release (the cctools-19 release):
- Fixed a bug in output_literal_pointers() that was not swapping correctly.
  The problem was it was using set_long() which used cur_obj->swapped but at
  this point in the code cur_obj is not set.  So the change was to do the
  swaping based on host_byte_sex != target_byte_sex.

Changes for the 3.1 release (the cctools-16 release):
- Fixed a bug in the checking of BR24 relocation where a mask was 0xf8000000
  which should have been 0xfc000000.  Thus when a displacement of 0x04000000
  or greater was generated the relocation overflow was not caught.
- Changed the default seg1addr used for the m98k to 0x10000000 (which should be
  VM_MAX_ADDRESS in mach/m98k/vm_param.h but would require files to include
  that file).  This change was made in layout_segments() in layout.c.

Changes for the 3.1 release (the cctools-15 release):
- Changed not finding an arch in a fat file to a warning from an error and not
  finding an arch from a thin archive to a warning from an error (bug #30659).
- Fixed a bug in m98k_reloc() where HA16 was not relocated correctly because a
  constant was written 0x000080000 not 0x00008000 (has an extra 0 on the end).

Changes for the 3.1 release (the cctools-13 release):
- Added the m98k (PowerPC) architecture.  This includes a kludged
  mach/m98k/thread_status.h with only an entry point.

Changes for the 3.1 release (the cctools-10 release):
- Changed the handling of the cpusubtypes to support this design:
    The design allows each architecture family (m68k, m88k, i386) to have a
    cpusubtype that will run on all implementations of that architecture and
    have cpusubtypes that will run only on specific implementations of an
    architecture.  The design also gives the programmer the option to force the
    cpusubtype indicating all implementations (at build time with a flag) when
    using instructions that are implementation specific leaving it up to the
    program to runtime select the correct code to execute.

  The link editor operation in this design:
    By default the link editor will change it's operation (starting with
    cctools-10) as specified on the ld(1) man page from:
	If no -arch arch_type is specified and the first object file encountered
	on the link line is a "fat" file the output architecture is as follows:
	if the fat file contains only one architecture then that architecture is
	used else if the ``fat'' file contains the host architecture then the
	host architecture is used otherwise it is an error and an -arch
	arch_type must be specified.
    to:
	If no -arch arch_type is specified and the first object file encountered
	on the link line is a "fat" file the output architecture is as follows:
	if the fat file contains only one architecture then that architecture is
	used else if the ``fat'' file contains the an architecture that would
	execute on the host then the "best" architecture as defined by what the
	kernel exec(2) would select is used otherwise it is an error and an
	-arch arch_type must be specified.
    In addition the cpusubtype will be promoted from an ALL subtype to a
    specific cpusubtype if an object file with a specific cpusubtype is linked
    in and the resulting linked object file will have that specific cpusubtype.
    As this promotion occurs during the linking this effects the selection of
    which component of a fat file will be selected for linking for subsequent
    fat files encountered on the link line.

    When a -arch arch_type flag for an architecture family (m68k, i386, etc) is
    specified it has the effect as if the link editor is linking for that host
    architecture and the cpusubtype will be promoted as described above.  If a
    -arch arch_type flag for a specific implementation of an architecture
    (m68040, i486, etc.) is specified the result is an object file with that
    specific cpusubtype and any object that has a cpusubtype which will not
    promote to the cpusubtype for that -arch flag is an error.

    The link editor will also accept the optional -force_cpusubtype_ALL flag
    causing the cpusubtype to remain ALL an not be promoted.  This flag has
    precedence over any -arch arch_type flag for a specific implementation.
    Use of this flag has an effect on the selection of which component of a
    fat file will be selected for linking and the cpusubtype always remains
    the _ALL type.

    The link editor will change it's operation in this area (starting with
    cctools-10):
	Previously when a fat file was encountered during linking and there was
	no architecture in the fat file for the current architecture being
	linked the fat file is ignored without any error or message.
    This will change to:
	If a fat file is encountered during linking and there is no "best"
	architecture in the fat file for the current architecture being linked
	this is treated as an error.
    The selection of the "best" architecture will be the same as the kernel's
    exec(2) and is defined by the library function cpusubtype_findbestarch().

    During linking a "current cpusubtype" will be maintained and objects being
    linked will be combined with it based on the library function
    cpusubtype_combine() and will produce a new "current cpusubtype" or an
    error if the cpusubtypes can't be combined.  If the -force_cpusubtype_ALL
    flag is specified the above routine will not be used and the cpusubtypes
    will always be combined and the "current cpusubtype" will always remain the
    _ALL cpusubtype.
  The rld(3) operation in this design:
    For reasons of compatiblity and existing bugs in the the cpusubtype handling
    the rld(3) package will function as if -force_cpusubtype_ALL were specified.
    As of the 3.0 release the rld(3) package does not do the same checking as
    exec(2) does with reguard to the handling of the cpusubtype.  Specificly for
    the m68k if on an 030 an object file with the 040 cpusubtype is used with
    the rld(3) package no error is generated.  This "bug" has the effect of the
    functionality of the -force_cpusubtype_ALL flag but lacts the error
    detection supported by exec(2).  Since adding the error detection could
    break existing uses of rld(3) the rld(3) package will function as if
    -force_cpusubtype_ALL were specified.
  This effected ld.c, ld.h, pass1.c and rld.c.

Changes for the 3.1 release (the cctools-9 release):
- Fixed a bug introduced by adding the -pagezero_size option where -p was not
  recognized the same as -preload.

Changes for the 3.1 release (the cctools-8 release):
- Added a "-pagezero_size hex_value" argument at the request of the Lono team.
- Changed the default segment alignment to 0x2000 for the I386.  This effects
  check_cur_obj() in pass1.c.

Changes for the 3.1 release (the cctools-7 release):
- Fixed a bug in cross linking on a risc machine in generic_reloc.h in the
  {get,set}_{long,short} routines where the compiler was taking the 'long *'
  and the memcpy() and assuming it could do the copy in line and it was
  correctly aligned.  The change was to make the type a 'void *'.
- Changed the way the messages for -sectorder_detail is printed in the case a
  symbol is not specified in the load file so the output of ld can be cut and
  pasted into an order file (bug #26204).
- Allow multiple -arch flags of the same name (bug #26197).

Changes for the 3.1 release (the cctools-6 release):
- Added the -arch_multiple flag that will cause one line to printed before all
  error messages which will contain the architecture name.
- Added checks for m88k relocation overflows in m88k_reloc.c for PC16 and PC26.
- Maded the changes to handle cross bytesex linking.
- Changed the way the non-zero values of the i386 thread_state registers get set
  from an initialized struct to direct assignment.  This was also added to the
  ifdef RLD code.  These are the asignments:
    intel386.es = UDS_SEL;
    intel386.ds = UDS_SEL;
    intel386.ss = UDS_SEL;
    intel386.cs = UCS_SEL;
- Fixed a bug introduce in cctools-5 item:
      Changed the default order when all the symbols in an object file are not
      listed in an order file to caused that object to be loaded as it had a
      .section_all specification (nrw team request).
  The bug was that if object had a .section_all this new code would reassign the
  order.  Another condition was added to the if that trigers this new code to
  test for this case.
- Fixed a bug in the Makefile when more than on RC_ARCHS was set.  The change
  of "$(RC_ARCHS)" in the for loop to `cat $(RC_ARCHS)` was done to fix it.

Changes for the 3.1 release (the cctools-5 release):
- Picked up a change from the lono team where the variable named "i386" was 
  changed to "intel386" so that it wouldn't collide with the CPP macro named
  "i386" in layout.c .
- Picked up a fix from the lono team where calculating the output_pc was done
  incorrectly when doing pc relative offsets for the i386 in generic_reloc.c .
- Changed the default order when all the symbols in an object file are not
  listed in an order file to caused that object to be loaded as it had a
  .section_all specification (nrw team request).
- Fixed a bug where the relocation references in rld to sections with fine
  relocation entries was wrong because the fine relocation entries were free'ed
  too soon in pass2() in pass2.c (bug #22046).

Changes for the 3.1 release (the cctools-3 release):
- Changed the way the default segalign gets set.  It is now set when the
  output cputype is set in check_cur_obj() in pass1.c based on the cputype and
  not initialized to the cpp macro TARGET_PAGESIZE set via the Makefile but
  initialized to zero in ld.c.  This was done because it is different for the
  i386 architecture.
- Fixed a bug with generic_reloc where the a pcrel relocation entry on the i386
  is relative to the end of the displacement not the beginning.  This involved
  adding an extra argument to generic_reloc() and passing the correct argument
  in sections.c where this is called.
- Fixed a bug with librld.o needing to be linked with libstuff.a (Makefile
  change).

Changes for the 3.1 release (the cctools-3 release):
- Removed the M88K_TIME_HACK code in pass1.c
- Changed CPU_TYPE_I80x86 to CPU_TYPE_I386 in lipo.c

Changes for the 3.1 release (the cctool-2 release):
- Added support for fat files.  The -arch flag was added to help support this.
  The changes are in pass1.c for the fat stuff.  The global variables cputype
  and cpusubtype are now used out of the global struct arch_flag this effected
  a hand full of files.
- Removed the obsolete flags: -a, -T, -Ttext, -Tdata, -ident, -v, -g, -G, -D.

Changes for the 3.0 release (the -57 compiler release):
- Corrected the -whyload message in pass1.c for -all_load that printed -all
  (bug #20024).

Changes for the 3.0 release (the -56 compiler release):
- Added the -all_load flag that causes all of the members of archives to be
  loaded.  This effected ld.c, ld.h and pass1.c (bug #19644).
- Added the -ObjC flag that causes the members of archives that defined
  objective-C classes or categories to be loaded.  This effected ld.c, ld.h
  and pass1.c (bug #19643).
- Added the feature of ".section_offset <value>" in the load order file.  This
  as in layout_ordered_section() in sections.c .
- Fixed a bug in in lookup_load_order() in sections.c if the same named symbol
  appears more than once in the loaded objects (in the case of static symbols)
  and the sectorder file has that symbol listed more times than it appears in
  the objects being loaded.  So when lookup_load_order() is handed one of the
  lines for this symbol and all orders for those symbols have been assigned it
  failed to test for this and incorrectly dropped into the code that was
  assuming that there was multiple matches for this symbol and tried to return
  the first non-ordered match.  But since all the symbols were assigned there
  was non first non-ordered match and this caused an indirection through a NULL
  pointer.  So the fix was to add the following code:
	if(number_of_matches == 0)
            return(NULL);
  after the first loop that determined the number of non-ordered matches were
  left. (found by Stone Design in the 2.1 release) (bug #19640)

Changes for the 3.0 release (the -55 compiler release):
- Fixed a bug when ordering a section where two symbols had the same value.
  The problem caused a the block to not be written to the correct output
  offset leaving a hole of zeros.  The fix is to make sure that zero sized
  blocks get the output_offset size of the previous block.  The fix is in
  sections.c in layout_ordered_section() (see the use of prev_output_offset).
- Fixed the spelling of ambiguous in places it appeared abiguous and ambigious
  (bug #19353) in sections.c.
- Added a test to see if an archive member name could have been truncated before
  printing the warning saying it could be ambigious when used with -sectorder
  (bug #19352).

Changes for the 3.0 release (the -53 compiler release):
- For RLD internal_rld_load() in rld.c if the output_file is
  RLD_DEBUG_OUTPUT_FILENAME (used by the debugger for automatic debugging of
  rld using the rld_state stuff) the flag RLD_DEBUG_OUTPUT_FILENAME_flag is set
  so the code in layout_segments() in layout.c will know to pass address_func()
  the allocate_size (including the symbol table) so the debugger can save this
  and deallocate the memory correctly.
- For RLD in rld.c if the object file name is not a full path the fullpath is
  created and saved as the object file name.  This is so that the debugger can
  find the object when using the automatic debugging is done using the rld_state
  stuff.
- For RLD changed the enter_symbol() routines to use the string from the object
  if it is in the base file.
- For RLD allocate from an NXZone for all allocations.

Changes for the 3.0 release (the -52 compiler release):
- Added ignoring the new LC_PREPAGE load command (two places in pass1.c).
- Added the Make.app stuff (new files make.defs, make_defs.h, and notifyMake.c)
  This effected the Makefile and ld.c.

Changes for the 3.0 release (the -51 compiler release):
- Fixed a bug that did not pad out the string table to a multiple of 4 bytes.
  A output_strpad field was added to the symtab_info struct which was filled
  in layout_segments() and the size of the string table was changed to be
  rounded to 4 byte size.  Then the strpad was flushed in setup_output_flush().
  This effected layout.c, layout.h and pass2.c.
- Changed the m88k thread status to match the kernel struct (layout.c).

Changes for the 3.0 release (the -49 compiler release):
- Changed where ld3.1 gets installed it now gets installed in
  /usr/local/bin3.1/ld .
- Added LC_FVMFILE to pass1.c to be ignored.
- Changed the strip line for librld.o because it strips the rld_state the
  debugger needs and messes up the debugger when the debugging symbols are
  saved and some globals are stripped. It now uses nmedit.
- Changed the Makefile to meet the RC api.

Changes for the 3.0 release (the -47 compiler release):
- ld sources split in to ld and ld3.1 and all m88k and ix86 stuff removed.
- Added rld_forget_symbol() for Franz Inc. to use with Lisp.
- Changed shlib_ofiles and profile_ofiles to build one librld.o object using
  strip to limit the number of globals to only the api listed on the man page
  (bug #15808).
- Changed the alignment of .section_all blocks from using the merge section's
  alignment to using the original section's alignment.  (sections.c
  layout_ordered_section() second use of function round()).  This allows shlib's
  to stay compatible when the alignment of an ordered section increases.
- Added #include <errno.h> to ld.c to match header file changes.
- Changed the includes in layout.c to match the header file changes:
  m68k/mach/thread_status.h -> mach/m68k/thread_status.h
  m88k/mach/thread_status.h -> mach/m88k/thread_status.h
  ix86/mach/thread_status.h -> mach/ix86/thread_status.h
  i860/mach/thread_status.h -> mach/i860/thread_status.h

Changes for the 3.0 release (the -44 compiler release):
- Switch over to the new header file organization.  This also involed changing
  thread_status structure names and constants.

Changes for the 3.0 release (the -43 compiler release):
- Added support for the i386.
- Changed rld_load to fail if the output file for the debug file can't be
  created (bug #14799).
- Added rld_loaded_state for the debugger so it can automaticly debug things
  that use rld (the interface in in the header file rld_state.h) (bug #15163).
- Fixed all new warnings with the cc-37 compiler and added the __attribute__
  format stuff for all error messages.  This involved touching every file and
  all long declrations to be unsigned long.  This also involved touching most
  error strings for fix up.  This did find 6 or so real bugs.

Changes for the 3.0 release (the -37 compiler release):
- Added a check in pass1.c to check for old 88k objects based on the date this
  is installed internally to NeXT (Wed Jun 12 16:00:00 PST 1991 (676681200)).
  This is ifdef'ed M88K_TIME_HACK.
- Changed the RLD ifdefs in sections.c and m88k_reloc.c to allow 88k objects
  to be used with the RLD package.
- Removed all #error's and most uses of mc68000 in all the code.  The relocation
  routines now have static inline routines to get/set longs, shorts, and bytes
  reguardless of the alignment (see generic_reloc.h).  Other checking code in
  pass1.c has also been updated.  This effected pass1.c, *_reloc.c and
  literal_pointers.c
- Changed m88k_reloc() to handle scattered relocation and the change of storing
  the other half in pair relocation entries in the r_address field.
- Changed i860_reloc() to handle the change of storing the other half in pair
  relocation entries in the r_address field.
- Fixed a bug in generic_reloc() where if a pc-relative external relocation
  entry had an offset equal to it's pc and that symbol was defined (in another
  object being loaded) and relocation entries were saved a local relocation
  entry would be created where a scattered relocation entry should have been.
  For this bug to show up an 'ld -r' would be needed and then a scattered load
  where the symbol+offset did not end up in the same block.  The fix was to
  adjust the offset by the input_pc if the entry was pc-relative. (very obscure
  bug, found by reading the code).

Changes for the 3.0 release (the -36 compiler release):
- Fixed an obscure bug when ordering a section where two symbols have
  the same value.  The fix is in qsort_load_order_values() in sections.c .
  This fix makes the load_orders and the fine_relocs
  sorted by value end up in the same order even though the load_order
  sorted by name between their sorts by value.  Without this the
  blocks for the symbols at the same address get placed in the file
  in the wrong place because the subtraction of their input offsets
  does not yeild the size of the block in this case.  This is kinda
  a funky fix to avoid adding a size field to the fine reloc struct
  which would be very expensive in space.
- Fixed a bug in create_order_load_maps() in sections.c which used more
  order_load_maps than it allocated.  It used maps for sections that had
  no_load_order == TRUE.

Changes for the 3.0 release (the -34 compiler release):
- Fixed a bug where multiple pass1 errors were not processed because the code
  in merge() in pass1.c always returned if there had been any previous errors.
  The fix was to have merge() save and restore the previous errors and only
  return if an error happened while processing that file. (second bug in first
  released version).
- Added the -m flag to allow multiply defined symbols with a warning instead of
  treating them as a hard error.  In this case the first symbol is used for
  linking and is the value of the symbol.
- Added installsrc, installIBMsrc and installGNUsrc targets to the Makefile.
- Fixed a bug that would cause the output flush stuff to fail.  The problem was
  when a section in an object file had a size that was not a multiple of its
  alignment and the next object file loaded with that section had a size of
  zero the section would be padded to get the alignment but the routine out
  output the section returned when the size of the section was zero and thus
  the area was not flushed and ld got an internal error.  This was fixed in
  merge_section() in sections.c where the test for the section size being zero
  is made and the merged section size (ms->s.size) is not changed if the size
  of the section being merged is zero. (first bug in first released version)

Changes for the 3.0 release (the -33 compiler release):
- Added the support needed for the 88k and the i860 processors.
- Changed the use of r_reserved field of the relocation_info to match the
  change to r_type.  This effected only generic_reloc.c and literal_pointers.c .

Release 2.0
Changes for the Warp ?? release (the -30 compiler release):
- Allowed using -sectorder on zero fill sections (including the section for
  common symbols) and for all literal sections (each type of literal section
  has it's own format of the sectorder file) (bug #9404).
- Improved handling of sectorder file where the specifications don't exactly
  match the object names of what's loaded.  A hash table of symbol names is used
  to attempt to match up symbol names in the specifications to the symbol names
  in the object files loaded.  Also removed the requirement of a separating ':'
  between the object name and symbol name which allows just a symbol name to be
  specified.  Also removed the fatal error of the same object file loaded more
  than once with -sectorder and the same symbol in the same object file.  This
  introduces ambiguity but that exist anyway when the requirement of exact
  matches was removed.  Also improved the allocation of the name arrays data
  structure for better performance (bug #9403). 
- Fixed a bug in clean_archives that indexed the sets array with cur_set when
  cur_set was equal to -1 (bug #9402)
- Fixed a bug if any section specification was given for the (__DATA,__common)
  section it caused the common symbols not to be defined (bug #9401).
- Fixed a bug that caused ld to hang if processing an old library and a member
  had an error in the object file.  The fix was to add the expresion errors == 0
  to the while loop to terminate the algorithm in the case of an error.  The
  error was that an object contained an LC_SYMSEG which was handled as an error.
  This is now a warning and the message was changed to include "object produced
  by pre-1.0 compiler, please recompile" (bug #9141).

Changes for the Warp ?? release (the -29 compiler release):
- Fixed a bug in new_sets that did not zero out the entire structure when
  reallocating it (bug #8037).
- Replaced the buggy literal pointer code (literal_ptrs.[ch] got
  literal_pointers.[ch]) (bug #7994).
- Changed the sizes of the literal 4 and 8 tables from 20 to 60 which seems to
  be about the right number of literals so that a large program will have only
  one table.
- Changed the calls to map_fd again to match the current prototype in libc.h
  which now matches the NeXT documentation.  Casts for all the parameters were
  added.  Hopefully this will now remain correct.

Changes for the Warp ?? release (the -28 compiler release):
- Fixed bug #7770 where the logic around free() in the literal 8,4,pointers
  free code was wrong.

Changes for the Warp ?? release (the -27 compiler release):
- The first version of the literal pointers code was added.
- Fixed a bug that caused floating-point constants to be relocated wrong.  The
  output_offset for the fine relocation map for the first table entry of all
  second and larger tables got set wrong.
- Fixed a bug where if symbols were being traced with -y and common symbols
  were being allocated then some of the common symbols might not be allocated.
  The problem was in defined_common_symbols() where the loop that looped through
  the trace symbols and the loop that looped through the merged symbol list were
  using the same variable.
- Fixed a bug where the contents of a section was not placed in the output file
  at the right address.  This was caused by an zero sized section that had an
  alignment that caused it's address to be greater than its previous section.
  Then when the offsets were assigned to the sections a test for zero sized
  sections prevented the running "offset" to be incremented if the size of the
  section was zero even though the difference of the address of the section and
  the next section in this case was not zero.  This showed up with a zero sized
  literal8 section with rld because the section came from the basefile and was
  not in the loaded objects.

Changes for the Warp 3H release (the -26 compiler release):
- Fixed a bug in generic_reloc that produced scattered relocation entries for
  absolute symbols.
- Fixed a bug in the rld package and ld -A where the common section did not have
  the correct alignment.  The problem was in merge_sections if the base file was
  being merged the alignment was not propagated into the merged section.
- Fixed a bug in layout_sections that did not assign addresses to zerofill
  sections correctly aligned (it was fixed for content sections but not for
  zerofill sections).
- Fixed a bug in output_cstrings() when freeing up the data the loop was using
  a pointer to a free()'ed item.
- Changed the checks in check_symbol() to allow stabs to have any of the N_TYPE
  bits on and treated like N_SECT (their n_sect feild checked).
- Added 4 byte and 8 byte literals.
- Added a test in allocate() so that if a size of zero is asked for then NULL
  is returned and malloc is not called.  This allows malloc() to return NULL 
  if a zero size is requested and not to be flagged as an error.
- Added a comma between the perror string and the printing of errno = x in the
  error routines.

Changes for the Warp 3 (OS update) release (the -25 compiler release):
- Added rld_load_from_memory() and fixed a vm_allocate leak for the input object
  file when an error ocurred.
- Added scattered relocation entries to generic_reloc() in generic_reloc.c.
  See the comments in <reloc.h>.  This allows scattered loading to work
  relibly.
- Fixed bug 6264 which produced a error with an archive that had zero ranlib
  structures in it.  It now prints a warning.
- Fixed bug 6261 which printed the linkedit segment has zero size when using -s
  and the no seglinkedit flag was specified.  It is no longer printed in this
  case but is printed when the -seglinkedit flag is specified.

Changes for the Warp 3 release (the -24 compiler release):
- Fixed a bug in lookup_fvmlib() which did not bzero the memory it allocated
  for a merged_fvmlib structure causing a bogus next pointer in that struct.
- Fixed a bug in rld_load_basefile() that is not set the host_pagesize which
  caused enter_string to allocate each string in it's own string block.
- Fixed a bug where the <segment>__end symbols did not get the correct value
  because their section number was set to the last section in their segment
  and not their first as they should have been.
- Removed all compiler "might be" warning messages for -DDEBUG and -DRLD.
- Implemented scattered loading vi -sectorder <segname> <sectname> <orderfile>
  (and added the -sectorder_detail option along with this).  This has NOT been
  put on the man page because of the relocation limititations it can't detect.
- Removed "mach_missing.h" (mach_error_string from <mach_error.h> and map_fd
  from libc.h (brain damaged but there)).
- Added one argument (headers_size) to the function passed to rld_address_func.
- Moved rld.h to ../include and it will be installed in /usr/include.
- Added a -w flag to suppress warnings.
- Added saving away errno in the system_{error,fatal} routines before doing any
  thing that could cause a system call (like a print).  This is in hope to get
  rid of the wrong error string (Inapropate ioctl for device) when it can't open
  a file (the value of errno is also printed).

Changes for the Warp 1 release (the -23 compiler release):
- Added the -headerpad <hex value> option to pad the header for MH_EXECUTE
  files.  The header is allways padded for MH_EXECUTE by the greater of this or
  the round off due to the segment rounding.
- Fixed a bug in clean_archives() when an rld_load_basefile() was called there
  are no sets so the the loop in clean_archives() was wrapped with an
  if(sets != NULL) .
- Fixed a bug that merge_literal_sections() merged the sections contents from
  the base file.
- Now is linked with libsys.
- Made created seglinkedit by default for object formats that can have it and
  set the default init protect to r-x.  Also added the -noseglinkedit option
  to turn this off.
- Added a message to the rld() calls when they return failure because of
  previous fatal errors (otherwise they print nothing and it fails).

Changes for the 2.0 impulse X.X release (the -22 compiler release):
- Added the ablity to link from archives with rld_load().
- Fixed a memory leak in the rld package when an rld_load() failed before
  pass2() and it was never called then the undefined_maps for that object set
  were not free()'ed.  Remove object now also frees these maps if they are not
  already free.

Changes for the 2.0 impulse X.X release (the -21 compiler release):
- Changed the default format if -A is specified and no filetype is specified,
  it now is MH_OBJECT.
- Added the following functions to the rld package: rld_unload_all,
  rld_load_basefile, rld_address_func and added another argument to rld_load
  which is the output name of the debugging file for gdb.
- Fixed -X to not strip stab symbols that start with 'L'.
- Added the -b flag to strip the base symbols from the output file when doing
  an ld -A.  This results in a much smaller output file which should still be
  useful for gdb(1)'s addfile command.
- Added coded in pass1() and rld_load() to handle the bug in the kernel that
  will not allow map_fd() to map a file with zero length.

Changes for the 2.0 impulse X.X release (the -20 compiler release):
- Added the -sectobjectsymbols <segname> <sectname> option to produce the
  file.o symbols.
- Fixed some nits in pass1() in some error cases printing the member name with
  out trimming the trailing blanks.
- Fixed two bugs in generic_reloc() in the error case when an external
  relocation entry's r_symbolnum is not found in the undefined_map and then
  the wrong index (i) was used instead of (symbolnum) to index the symbol table
  and determine the error in the object file.

Changes for the 2.0 impulse X.X release (the -19 compiler release):
- Fixed a bug in the rld package to correctly unload common symbols allocated
  in a set of objects loaded.
- Fixed a bug in the rld package to not enter undefined, common and indirect
  symbols from the base program (this causes the hash table to be in an
  incorrect state if a dymnamicly loaded object defines one of these symbols
  and it is unloaded).
- Added a check to make sure the string table ends with a '\0'.
- ld is no longer installed as ld-<version_number> to match the rest of the
  project.
- Changed so that no longer allow two absolute symbols with the same value to
  not cause a multiply defined symbol.
- Updated for the changes to CPU_TYPE and CPU_SUBTYPE with the changes to
  <sys/machine.h>
- Fixed a bug in layout() that didn't get the addresses of sections right (and
  then possibly the filesizes of segments right).  This was cause by setting
  the section address to the rounded 
