def find_relocations_for_section(elf, section_name):
    """ Given a section, find the relocation section for it in the ELF
        file. Return a RelocationSection object, or None if none was
        found.
    """
    rels = elf.get_section_by_name(b'.rel' + section_name)
    if rels is None:
        rels = elf.get_section_by_name(b'.rela' + section_name)
    return rels