1. 25 4月, 2015 1 次提交
    • R
      fix ldso name for sh-nofpu subarch · 1fb0878e
      Rich Felker 提交于
      previously it was using the same name as the default ABI with hard
      float (floating point args and return value in registers).
      
      the test __SH_FPU_ANY__ || __SH4__ matches what's used in the
      configure script already, and seems correct under casual review
      against gcc's config/sh.h, but may need tweaks. the logic for
      predefined macros for sh, and what they all mean, is very complex.
      eventually this should be documented in comments here.
      
      configure already rejects "half-hard" configurations on sh where
      double=float since these do not conform to Annex F and are not
      suitable for musl, so these do not need to be considered here.
      1fb0878e
  2. 24 4月, 2015 1 次提交
  3. 13 4月, 2015 1 次提交
    • R
      dynamic linker bootstrap overhaul · f3ddd173
      Rich Felker 提交于
      this overhaul further reduces the amount of arch-specific code needed
      by the dynamic linker and removes a number of assumptions, including:
      
      - that symbolic function references inside libc are bound at link time
        via the linker option -Bsymbolic-functions.
      
      - that libc functions used by the dynamic linker do not require
        access to data symbols.
      
      - that static/internal function calls and data accesses can be made
        without performing any relocations, or that arch-specific startup
        code handled any such relocations needed.
      
      removing these assumptions paves the way for allowing libc.so itself
      to be built with stack protector (among other things), and is achieved
      by a three-stage bootstrap process:
      
      1. relative relocations are processed with a flat function.
      2. symbolic relocations are processed with no external calls/data.
      3. main program and dependency libs are processed with a
         fully-functional libc/ldso.
      
      reduction in arch-specific code is achived through the following:
      
      - crt_arch.h, used for generating crt1.o, now provides the entry point
        for the dynamic linker too.
      
      - asm is no longer responsible for skipping the beginning of argv[]
        when ldso is invoked as a command.
      
      - the functionality previously provided by __reloc_self for heavily
        GOT-dependent RISC archs is now the arch-agnostic stage-1.
      
      - arch-specific relocation type codes are mapped directly as macros
        rather than via an inline translation function/switch statement.
      f3ddd173
  4. 18 6月, 2014 2 次提交
    • R
      refactor to remove arch-specific relocation code from dynamic linker · adf94c19
      Rich Felker 提交于
      this was one of the main instances of ugly code duplication: all archs
      use basically the same types of relocations, but roughly equivalent
      logic was duplicated for each arch to account for the different naming
      and numbering of relocation types and variation in whether REL or RELA
      records are used.
      
      as an added bonus, both REL and RELA are now supported on all archs,
      regardless of which is used by the standard toolchain.
      adf94c19
    • R
      multiple fixes to sh (superh) dynamic linker relocations · f4cc2760
      Rich Felker 提交于
      the following issues are fixed:
      
      - R_SH_REL32 was adding the load address of the module being relocated
        to the result. this seems to have been a mistake in the original
        port, since it does not match other dynamic linker implementations
        and since adding a difference between two addresses (the symbol
        value and the relocation address) to a load address does not make
        sense.
      
      - R_SH_TLS_DTPMOD32 was wrongly accepting an inline addend (i.e. using
        += rather than = on *reloc_addr) which makes no sense; addition is
        not an operation that's defined on module ids.
      
      - R_SH_TLS_DTPOFF32 and R_SH_TLS_TPOFF32 were wrongly using inline
        addends rather than the RELA-provided addends.
      
      in addition, handling of R_SH_GLOB_DAT, R_SH_JMP_SLOT, and R_SH_DIR32
      are merged to all honor the addend. the first two should not need it
      for correct usage generated by toolchains, but other dynamic linkers
      allow addends here, and it simplifies the code anyway.
      
      these issues were spotted while reviewing the code for the purpose of
      refactoring this part of the dynamic linker. no testing was performed.
      f4cc2760
  5. 16 6月, 2014 1 次提交
    • R
      dynamic linker: permit error returns from arch-specific reloc function · bfa09700
      Rich Felker 提交于
      the immediate motivation is supporting TLSDESC relocations which
      require allocation and thus may fail (unless we pre-allocate), but
      this mechanism should also be used for throwing an error on
      unsupported or invalid relocation types, and perhaps in certain cases,
      for reporting when a relocation is not satisfiable.
      bfa09700
  6. 28 2月, 2014 2 次提交
    • R
      fix endian subarchs for sh arch · 5c27c445
      Rich Felker 提交于
      default endianness for sh on linux is little, and while conventions
      vary, "eb" seems to be the most widely used suffix for big endian.
      5c27c445
    • R
      rename superh port to "sh" for consistency · aacd3486
      Rich Felker 提交于
      linux, gcc, etc. all use "sh" as the name for the superh arch. there
      was already some inconsistency internally in musl: the dynamic linker
      was searching for "ld-musl-sh.path" as its path file despite its own
      name being "ld-musl-superh.so.1". there was some sentiment in both
      directions as to how to resolve the inconsistency, but overall "sh"
      was favored.
      aacd3486
  7. 24 2月, 2014 1 次提交