# \[PATCH 2/5\] kernel/jump\_label: implement generic support for relative references

- From: Peter Zijlstra \<peterz@infradead.org\>
- Date: 2018-06-28 09:25:19 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2018/06/5318930
- Thread: https://ratatoskr.run/linux-arm-kernel/2018/06/5318423/t.md

```text
On Thu, Jun 28, 2018 at 11:04:45AM +0200, Ard Biesheuvel wrote:
> On 28 June 2018 at 11:02, Ard Biesheuvel [ref] wrote:
> >>> @@ -56,7 +72,9 @@ jump_label_sort_entries(struct jump_entry *start, struct jump_entry *stop)
> >>>
> >>>       size = (((unsigned long)stop - (unsigned long)start)
> >>>                                       / sizeof(struct jump_entry));
> >>> -     sort(start, size, sizeof(struct jump_entry), jump_label_cmp, NULL);
> >>> +     sort(start, size, sizeof(struct jump_entry), jump_label_cmp,
> >>> +          IS_ENABLED(CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE) ? jump_label_swap
> >>> +                                                           : NULL);
> >>>  }
> >>
> >> That will result in jump_label_swap being an unused symbol for some
> >> compile options.
> >
> > No, and isn't that the point of IS_ENABLED()? The compiler sees a
> > reference to jump_label_swap(), so it won't complain about it being
> > unused.

Ah, ok. I hadn't figured it was quite that smart about it.

> > Meh. I thought IS_ENABLED() was preferred over #ifdef, no?

Dunno, I just reacted to the proposed code's uglyness :-)

> ... and it means the sort() routine will unconditionally perform an
> indirect function call even if the arch does not require it.

Yeah, not sure I care about that here, this is a one time affair, very
far away from any fast paths.
```
