Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Actually, yes. You are correct - this one is not needed for ASAN support... My understanding is that this may be needed if we link against some custom runtime. I'll adjust the description of the patch.
I would prefer let those custom runtime to using their crt files, otherwise that add extra 18 byte(auipc+jal+auipc+jal+c.nop) or 20 byte (auipc+jal+auipc+jal+nop) for all RISC-V program which using compiler-rt.
But this logic is enabled only if CRT_HAS_INITFINI_ARRAY is not defined. Which is controlled by cmake (configuration script). In addition, other architectures (x86, sparc, arm, aarch64, sparc, powerpc) - do allow such fallback option. It just seems strange that RISCV does not have one.
But this logic is enabled only if CRT_HAS_INITFINI_ARRAY is not defined. Which is controlled by cmake (configuration script). In addition, other architectures (x86, sparc, arm, aarch64, sparc, powerpc) - do allow such fallback option. It just seems strange that RISCV does not have one.
Oh, I didn't noticed that #elif is associated with #ifdef CRT_HAS_INITFINI_ARRAY, thanks your clarify, that's LGTM now.
LGTM
compiler-rt/lib/crt/crtbegin.c | ||
---|---|---|
120 | Do you need the nop here? It's not used for __do_init call. |
LGTM. Just remove nop, ensure it isn't actually needed (rerun the tests, etc.), and feel free to commit this patch. Thanks!
compiler-rt/lib/crt/crtbegin.c | ||
---|---|---|
120 | I agree the nop doesn't seem to be needed, and so should be removed. I'm not sure why it was added to the powerpc implementation, but I suspect that it's for branch relaxation. |
@phosek, @luismarques thanks for your feedback (sorry for the delay with reply)!
Yes, the nop is not really needed. I'll make appropriate adjustments.
This does not look right to me. Newer architectures like aarch64/risc-v do not need to have .ctors/.dtors support. Can you investigate why -DCRT_HAS_INITFINI_ARRAY isn't set in your build instead?
Do you need the nop here? It's not used for __do_init call.