Skip to content

Commit

Permalink
pyk: added --llvm-hidden-visibility attribute (#4714)
Browse files Browse the repository at this point in the history
  • Loading branch information
traiansf authored Dec 17, 2024
1 parent 29aedd7 commit 38acfbb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pyk/src/pyk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ def exec_kompile(options: KompileCommandOptions) -> None:
kompile_dict['llvm_kompile_output'] = options.llvm_kompile_output
kompile_dict['llvm_proof_hint_instrumentation'] = options.llvm_proof_hint_instrumentation
kompile_dict['llvm_proof_hint_debugging'] = options.llvm_proof_hint_debugging
kompile_dict['llvm_hidden_visibility'] = options.llvm_hidden_visibility
elif len(options.ccopts) > 0:
raise ValueError(f'Option `-ccopt` requires `--backend llvm`, not: --backend {options.backend.value}')
elif options.enable_search:
Expand All @@ -344,6 +345,10 @@ def exec_kompile(options: KompileCommandOptions) -> None:
raise ValueError(
f'Option `--llvm-proof-hint-debugging` requires `--backend llvm`, not: --backend {options.backend.value}'
)
elif options.llvm_hidden_visibility:
raise ValueError(
f'Option `--llvm-hidden-visibility` requires `--backend llvm`, not: --backend {options.backend.value}'
)

try:
Kompile.from_dict(kompile_dict)(
Expand Down
9 changes: 9 additions & 0 deletions pyk/src/pyk/cli/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class KompileOptions(Options):
llvm_kompile_output: Path | None
llvm_proof_hint_instrumentation: bool
llvm_proof_hint_debugging: bool
llvm_hidden_visibility: bool
read_only: bool
o0: bool
o1: bool
Expand All @@ -220,6 +221,7 @@ def default() -> dict[str, Any]:
'llvm_kompile_output': None,
'llvm_proof_hint_instrumentation': False,
'llvm_proof_hint_debugging': False,
'llvm_hidden_visibility': False,
'read_only': False,
'o0': False,
'o1': False,
Expand Down Expand Up @@ -479,6 +481,13 @@ def kompile_args(self) -> ArgumentParser:
action='store_true',
help='Enable additional proof hint debugging information in LLVM backend kompilation.',
)
args.add_argument(
'--llvm-hidden-visibility',
dest='llvm_hidden_visibility',
default=None,
action='store_true',
help='Whether to make all symbols hidden by default in LLVM backend kompilation.',
)

args.add_argument(
'--no-exc-wrap',
Expand Down
6 changes: 6 additions & 0 deletions pyk/src/pyk/ktool/kompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ class LLVMKompile(Kompile):
enable_llvm_debug: bool
llvm_proof_hint_instrumentation: bool
llvm_proof_hint_debugging: bool
llvm_hidden_visibility: bool
llvm_mutable_bytes: bool
iterated_threshold: Fraction | None
heuristic: str | None
Expand All @@ -445,6 +446,7 @@ def __init__(
enable_llvm_debug: bool = False,
llvm_proof_hint_instrumentation: bool = False,
llvm_proof_hint_debugging: bool = False,
llvm_hidden_visibility: bool = False,
llvm_mutable_bytes: bool = False,
iterated_threshold: Fraction | None = None,
heuristic: str | None = None,
Expand All @@ -468,6 +470,7 @@ def __init__(
object.__setattr__(self, 'enable_llvm_debug', enable_llvm_debug)
object.__setattr__(self, 'llvm_proof_hint_instrumentation', llvm_proof_hint_instrumentation)
object.__setattr__(self, 'llvm_proof_hint_debugging', llvm_proof_hint_debugging)
object.__setattr__(self, 'llvm_hidden_visibility', llvm_hidden_visibility)
object.__setattr__(self, 'llvm_mutable_bytes', llvm_mutable_bytes)
object.__setattr__(self, 'iterated_threshold', iterated_threshold)
object.__setattr__(self, 'heuristic', heuristic)
Expand Down Expand Up @@ -507,6 +510,9 @@ def args(self) -> list[str]:
if self.llvm_proof_hint_debugging:
args += ['--llvm-proof-hint-debugging']

if self.llvm_hidden_visibility:
args += ['--llvm-hidden-visibility']

if self.llvm_mutable_bytes:
args += ['--llvm-mutable-bytes']

Expand Down

0 comments on commit 38acfbb

Please sign in to comment.