1. 17 8月, 2020 1 次提交
  2. 13 3月, 2019 1 次提交
    • R
      make FILE a complete type for pre-C11 standard profiles · f368d9fd
      Rich Felker 提交于
      C11 removed the requirement that FILE be a complete type, which was
      deemed erroneous, as part of the changes introduced by N1439 regarding
      completeness of types (see footnote 6 for specific mention of FILE).
      however the current version of POSIX is still based on C99 and
      incorporates the old requirement that FILE be a complete type.
      
      expose an arbitrary, useless complete type definition because the
      actual object used to represent FILE streams cannot be public/ABI.
      
      thanks to commit 13d1afa4, we now have
      a framework for suppressing the public complete-type definition of FILE
      when stdio.h is included internally, so that a different internal
      definition can be provided. this is perfectly well-defined, since the
      same struct tag can refer to different types in different translation
      units. it would be a problem if the implementation were accessing the
      application's FILE objects or vice versa, but either would be
      undefined behavior.
      f368d9fd
  3. 18 10月, 2018 1 次提交
    • R
      bypass indirection through pointer objects to access stdin/out/err · d8f2efa7
      Rich Felker 提交于
      by ABI, the public stdin/out/err macros use extern pointer objects,
      and this is necessary to avoid copy relocations that would be
      expensive and make the size of the FILE structure part of the ABI.
      however, internally it makes sense to access the underlying FILE
      objects directly. this avoids both an indirection through the GOT to
      find the address of the stdin/out/err pointer objects (which can't be
      computed PC-relative because they may have been moved to the main
      program by copy relocations) and an indirection through the resulting
      pointer object.
      
      in most places this is just a minor optimization, but in the case of
      getchar and putchar (and the unlocked versions thereof), ipa constant
      propagation makes all accesses to members of stdin/out PC-relative or
      GOT-relative, possibly reducing register pressure as well.
      d8f2efa7