3 ms·
What a weird coincidence seeing a comment about mergeable sections today... A patch I helped review that's related to this in LLVM just landed today: https://r
by ndesaulniers 7y ago
What a weird coincidence seeing a comment about mergeable sections today...
A patch I helped review that's related to this in LLVM just landed today: https://reviews.llvm.org/D72194 https://reviews.llvm.org/D72194. (LLVM previously had support, but would perform bad merges in specific and rare edge cases; that patch fixes those cases).
Also, note that you need a custom linker script to define those symbols (__start_some_array, __stop_some_array). The Linux kernel does this, as noted in: https://nickdesaulniers.github.io/blog/2020/04/06/off-by-two/ https://nickdesaulniers.github.io/blog/2020/04/06/off-by-two...
- haberman 7y ago> A patch I helped review that's related to this in LLVM just landed today Cool. :) > Also, note that you need a custom linker script to define those symbols The code I posted above compiles and runs without any custom linker script.
- ndesaulniers 7y ago> The code I posted above compiles and runs without any custom linker script. What?! Ok, I've seen the Linux kernel's custom linker script define symbols for custom ELF section boundaries, but TIL that you can get these automagically. I'm curious to see if LLD implements this logic, too.