mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Merge pull request #21 from pythonbpf/globals
Adds support for globals SO...... *I'm not merging this because it's complete, but because I don't want it to diverge from master too much. *Stuff I still need to complete: -> Structs and eval expressions in these globals. -> handling the global keyword. -> assigning back to the global and reading from inside a function. -> Basically, `global` keyword in Python is used to write only and reading can be done directly without declaring as global as a direct assign without global declaration is going to diverge from Python. -> The above logic is going to be supported by `global_sym_tab` generated using the new order of passes that we are doing. -> This needs to be fixed and done ASAP to avoid conflicts. so yes, im gonna do it soon.
This commit is contained in:
@ -4,7 +4,11 @@ from .license_pass import license_processing
|
||||
from .functions import func_proc
|
||||
from .maps import maps_proc
|
||||
from .structs import structs_proc
|
||||
from .globals_pass import globals_processing
|
||||
from .globals_pass import (
|
||||
globals_list_creation,
|
||||
globals_processing,
|
||||
populate_global_symbol_table,
|
||||
)
|
||||
from .debuginfo import DW_LANG_C11, DwarfBehaviorEnum, DebugInfoGenerator
|
||||
import os
|
||||
import subprocess
|
||||
@ -40,12 +44,15 @@ def processor(source_code, filename, module):
|
||||
for func_node in bpf_chunks:
|
||||
logger.info(f"Found BPF function/struct: {func_node.name}")
|
||||
|
||||
populate_global_symbol_table(tree, module)
|
||||
license_processing(tree, module)
|
||||
globals_processing(tree, module)
|
||||
|
||||
structs_sym_tab = structs_proc(tree, module, bpf_chunks)
|
||||
map_sym_tab = maps_proc(tree, module, bpf_chunks)
|
||||
func_proc(tree, module, bpf_chunks, map_sym_tab, structs_sym_tab)
|
||||
|
||||
license_processing(tree, module)
|
||||
globals_processing(tree, module)
|
||||
globals_list_creation(tree, module)
|
||||
|
||||
|
||||
def compile_to_ir(filename: str, output: str, loglevel=logging.INFO):
|
||||
|
||||
Reference in New Issue
Block a user