The call to memcpy() meant to cause plt resolution in _thr_rtld_init()
was getting optimized by the compiler. Tell the compiler not to use its
memcpy() builtin in thr_rtld.c.
Details
- Reviewers
kib - Commits
- rG39733922edc4: rtld: actually resolve memcpy plt
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 58529 Build 55417: arc lint + arc unit
Event Timeline
That makes sense to me, for future insurance. I checked just now that -fno-builtin didn't reveal any additional cases. Do you prefer to make that change?
lib/libthr/Makefile | ||
---|---|---|
35 | I would add a comment there, noting that this flag is there for functional purpose, instead of suppressing some warning. |
No sure how much the builtins optimization matters here but if it does the other workaround would be:
void* memcpy_for_plt(void*, const void*, size_t) asm("memcpy")
And then call that.
Thanks for the info. I think @kib could speak better to whether any code in this file could be important in terms of performance. In any case, I believe the one memcpy was the only site actually affected when I examined the codegen for amd64.
lock_acquire/release are the only functions which performance is critical for runtime.
That said, I do believe that correctness trumps speed.