From 387ebe67fe695772fa55731fa1bf85827750eb3b Mon Sep 17 00:00:00 2001 From: Sam Lerner Date: Wed, 22 May 2024 22:42:20 -0400 Subject: [PATCH] extra space in functionreplacemodifier --- .../ofrak/core/patch_maker/modifiers.py | 2 +- .../ofrak_patch_maker/toolchain/llvm_12.py | 24 ++++++------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/ofrak_core/ofrak/core/patch_maker/modifiers.py b/ofrak_core/ofrak/core/patch_maker/modifiers.py index 6387f5cb9..7d0fcd2c7 100644 --- a/ofrak_core/ofrak/core/patch_maker/modifiers.py +++ b/ofrak_core/ofrak/core/patch_maker/modifiers.py @@ -331,7 +331,7 @@ def _make_text_segment(complex_block: ComplexBlock) -> Segment: vm_address=complex_block.virtual_address, offset=0, is_entry=False, - length=complex_block.size, + length=complex_block.size + 0x100, access_perms=MemoryPermissions.RX, ) diff --git a/ofrak_patch_maker/ofrak_patch_maker/toolchain/llvm_12.py b/ofrak_patch_maker/ofrak_patch_maker/toolchain/llvm_12.py index 19f0d75f8..aaca4d75d 100644 --- a/ofrak_patch_maker/ofrak_patch_maker/toolchain/llvm_12.py +++ b/ofrak_patch_maker/ofrak_patch_maker/toolchain/llvm_12.py @@ -43,27 +43,21 @@ def __init__( self._assembler_flags.append(f"-mcpu={self._config.assembler_cpu}") self._compiler_flags.extend( [ - "-c", - "-target", + "-cc1", + "-triple", self._compiler_target, # type: ignore - "-Xclang", "-emit-obj", + "-msoft-float", + "-mfloat-abi", + "soft", "-Wall", ] ) - if processor.isa is InstructionSet.ARM: - # Without this option, Clang will ignore target("arm"/"thumb") attributes - self._compiler_flags.append("-marm") - - if self._config.hard_float: - self._compiler_flags.append("-mno-soft-float") - else: - self._compiler_flags.append("-msoft-float") if self._config.separate_data_sections: self._compiler_flags.append("-fdata-sections") if self._config.compiler_cpu: - self._logger.warning("compiler_cpu option set, but has no meaning for LLVM toolchain") + self._compiler_flags.append(f"-mcpu={self._config.compiler_cpu}") llvm12_compiler_optimization_map = { CompilerOptimizationLevel.NONE: "-O0", @@ -82,10 +76,9 @@ def __init__( self._compiler_flags.append("-finline-hint-functions") if self._config.relocatable: - self._compiler_flags.extend(["-fno-direct-access-external-data", "-fPIE"]) + self._compiler_flags.extend(["-fno-direct-access-external-data", "-pic-is-pie"]) self._linker_flags.append("--pie") else: - self._compiler_flags.append("-fno-pic") self._linker_flags.append("--no-pie") if self._config.no_bss_section: @@ -98,11 +91,8 @@ def __init__( self._compiler_flags.extend( [ "-fno-split-dwarf-inlining", - "-Xclang", "-debug-info-kind=limited", - "-Xclang", "-dwarf-version=4", - "-Xclang", "-debugger-tuning=gdb", ] )