• Ard Biesheuvel's avatar
    ARM: kernel: sort relocation sections before allocating PLTs · 1031a7e6
    Ard Biesheuvel authored
    The PLT allocation routines try to establish an upper bound on the
    number of PLT entries that will be required at relocation time, and
    optimize this by disregarding duplicates (i.e., PLT entries that will
    end up pointing to the same function). This is currently a O(n^2)
    algorithm, but we can greatly simplify this by
    - sorting the relocation section so that relocations that can use the
      same PLT entry will be listed adjacently,
    - disregard jump/call relocations with addends; these are highly unusual,
      for relocations against SHN_UNDEF symbols, and so we can simply allocate
      a PLT entry for each one we encounter, without trying to optimize away
      duplicates.
    Tested-by: default avatarJongsung Kim <neidhard.kim@lge.com>
    Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    1031a7e6
module-plts.c 5.91 KB