Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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. (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...



> 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.


> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: