Page MenuHomeFreeBSD

libmd: Only define SHA256_Transform_c when using the ARM64 ifunc.
Needs ReviewPublic

Authored by jhb on Mon, Sep 13, 6:25 PM.

Details

Summary

GCC 9 doesn't define a SHA256_Transform symbol when the stub just wraps
SHA256_Transform_c resulting in an undefined symbol for
_libmd_SHA256_Transform in libmd.so.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 41499
Build 38388: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Mon, Sep 13, 6:25 PM

This is definitely a workaround, and I don't fully understand why the tail call messes up this way when using GCC.

I don't think I understand the problem. SHA256_Transform is static, it should never be visible outside the object.

sys/crypto/sha2/sha256c.c
397

This reference is not static however.

sys/crypto/sha2/sha256c.c
397

Oh I see. That's still a bit fragile, even if it happens to work. The correct way to fix that is to mark any static symbols referenced by inline assembly via strings as __used, which will ensure it gets emitted.

397

(Though this refactoring is perhaps *also* a better way to write the original code, not sure, it's shorter, though requires two places to know about the ifdef).

sys/crypto/sha2/sha256c.c
397

So is __used the better long term fix? I could maybe have a wrapper macro that only maps to __used when WEAK_REFS is defined (WEAK_REFS_USED or some such) and then tag all the static functions with weak references with that?