Support MOVLPS and MOVHPS in delocate.

GCC 10.2.1 seems to be emitting code like this:

    movq    gcm_gmult_clmul@GOTPCREL(%rip), %xmm0
    movhps  gcm_ghash_clmul@GOTPCREL(%rip), %xmm0
    movaps  %xmm0, (%rsp)

This is assembling a pair of function pointers in %xmm0 and writing the
two out together. I've not observed the compiler output movlps, but
supporting movhps and movlps are about as tricky. The main complication
is that these instructions preserve the unwritten half of the
destination, and they do not support register sources, only memory.

This CL supports them by loading in a general-purpose register as we
usually do, pushing the register on the stack, and then running the
instruction on (%rsp). Some alternatives I considered:

- Save/restore a temporary XMM register and then use MOVHLPS and
  MOVLHPS. This would work but require another saveRegister-like
  wrapper.

- Take advantage of loadFromGOT ending in a memory mov and swap out
  the final instruction. This would be more efficient, but we downgrade
  GOT-based accesses to local symbols to a plain LEA. The compiler will
  only do this when we write a pair of function pointers in a row, so
  trying to optimize the non-local symbols seems not worth the trouble.
  (Really the compiler should not be emitting GOT-relative loads at all,
  but the compiler doesn't know these symbols will be private and in the
  same module, so it has a habit of pessimally using GOT-based loads.)

This option seemed the simplest.

Change-Id: I8c4915a6a0d72aa4c5f4d581081b99b3a6ab64c2
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/45244
Reviewed-by: Adam Langley <agl@google.com>
3 files changed
tree: 70f215849733bcfc8028cfc6306a824939e2400f
  1. .github/
  2. crypto/
  3. decrepit/
  4. fuzz/
  5. include/
  6. ssl/
  7. third_party/
  8. tool/
  9. util/
  10. .clang-format
  11. .gitignore
  12. API-CONVENTIONS.md
  13. BREAKING-CHANGES.md
  14. BUILDING.md
  15. CMakeLists.txt
  16. codereview.settings
  17. CONTRIBUTING.md
  18. FUZZING.md
  19. go.mod
  20. go.sum
  21. INCORPORATING.md
  22. LICENSE
  23. PORTING.md
  24. README.md
  25. SANDBOXING.md
  26. sources.cmake
  27. STYLE.md
README.md

BoringSSL

BoringSSL is a fork of OpenSSL that is designed to meet Google's needs.

Although BoringSSL is an open source project, it is not intended for general use, as OpenSSL is. We don't recommend that third parties depend upon it. Doing so is likely to be frustrating because there are no guarantees of API or ABI stability.

Programs ship their own copies of BoringSSL when they use it and we update everything as needed when deciding to make API changes. This allows us to mostly avoid compromises in the name of compatibility. It works for us, but it may not work for you.

BoringSSL arose because Google used OpenSSL for many years in various ways and, over time, built up a large number of patches that were maintained while tracking upstream OpenSSL. As Google's product portfolio became more complex, more copies of OpenSSL sprung up and the effort involved in maintaining all these patches in multiple places was growing steadily.

Currently BoringSSL is the SSL library in Chrome/Chromium, Android (but it's not part of the NDK) and a number of other apps/programs.

Project links:

There are other files in this directory which might be helpful: