Last active
February 19, 2021 21:32
-
-
Save lpereira/2640f26e1d670d899ca80b9f3910df72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import subprocess | |
unmappable_funcs = set() | |
out, err = subprocess.Popen(["objdump", "-t", "Build/Kernel/Kernel"], stdout=subprocess.PIPE).communicate() | |
for line in out.splitlines(): | |
line = line.strip() | |
line = line.decode('ascii') | |
if '.unmap_after_init' in line: | |
func = line.split()[-1] | |
unmappable_funcs.add(func) | |
potentially_unmappable = set() | |
out, err = subprocess.Popen(["objdump", "-d", "Build/Kernel/Kernel"], stdout=subprocess.PIPE).communicate() | |
for line in out.splitlines(): | |
in_text = False | |
cur_func = '' | |
finished_reading_text = False | |
for line in out.splitlines(): | |
line = line.strip() | |
line = line.decode('ascii') | |
if 'Disassembly of section .text:' in line: | |
in_text = True | |
continue | |
if 'Disassembly of section ' in line: | |
finished_reading_text = True | |
break | |
if not in_text: | |
continue | |
if line.endswith('>:'): | |
cur_func = line | |
for symbol in unmappable_funcs: | |
if symbol in line: | |
potentially_unmappable.add(cur_func) | |
break | |
if finished_reading_text: | |
break | |
for func in potentially_unmappable: | |
print(func) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment