Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes #534

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bindings/python/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def test_ks(arch, mode, code, syntax=0):
def test_sym_resolver():
def sym_resolver(symbol, value):
# is this the missing symbol we want to handle?
if symbol == "_l1":
if symbol == b"_l2":
# put value of this symbol in @value
value = 0x1002
value.contents.value = 0x1002
# we handled this symbol, so return true
return True

Expand All @@ -38,7 +38,7 @@ def sym_resolver(symbol, value):
# register callback for symbol resolver
ks.sym_resolver = sym_resolver

CODE = b"jmp _l1; nop; _l1:"
CODE = b"jmp _l2; nop; _l1:"
encoding, count = ks.asm(CODE, 0x1000)

print("%s = [ " % CODE, end='')
Expand Down
1 change: 0 additions & 1 deletion llvm/keystone/ks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ ks_err ks_close(ks_engine *ks)
KEYSTONE_EXPORT
ks_err ks_option(ks_engine *ks, ks_opt_type type, size_t value)
{
ks->MAI->setRadix(16);
switch(type) {
case KS_OPT_SYNTAX:
if (ks->arch != KS_ARCH_X86)
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/MC/MCAsmInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ MCAsmInfo::MCAsmInfo() {
CalleeSaveStackSlotSize = 4;

IsLittleEndian = true;
Radix = 10;
StackGrowsUp = false;
HasSubsectionsViaSymbols = false;
HasMachoZeroFillDirective = false;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/MC/MCAssembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ bool MCAssembler::evaluateFixup(const MCAsmLayout &Layout,
ks_sym_resolver resolver = (ks_sym_resolver)KsSymResolver;
if (resolver(Sym.getName().str().c_str(), &imm)) {
// resolver handled this symbol
Value = imm;
Value += imm;
IsResolved = true;
} else {
// resolver did not handle this symbol
Expand Down
4 changes: 2 additions & 2 deletions suite/regress/arm_sym_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
class TestARM(regress.RegressTest):
def runTest(self):
def sym_resolver(symbol, value):
if symbol == "symBackward":
if symbol == b"symBackward":
value[0] = 0x0
return True

if symbol == "symForward":
if symbol == b"symForward":
value[0] = 0x20
return True

Expand Down
4 changes: 2 additions & 2 deletions suite/regress/arm_sym_resolver_thumb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
class TestARM(regress.RegressTest):
def runTest(self):
def sym_resolver(symbol, value):
if symbol == "symBackward":
if symbol == b"symBackward":
value[0] = 0x0
return True

if symbol == "symForward":
if symbol == b"symForward":
value[0] = 0x20
return True

Expand Down
6 changes: 3 additions & 3 deletions suite/regress/x64_sym_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class TestX86(regress.RegressTest):
def runTest(self):
def sym_resolver(symbol, value):
# is this the missing symbol we want to handle?
if symbol == "ZwQueryInformationProcess":
if symbol == b"ZwQueryInformationProcess":
# put value of this symbol in @value
value = 0x7FF98A050840
value.contents.value = 0x7FF98A050840
# we handled this symbol, so return true
print 'sym_resolver called!'
print('sym_resolver called!')
return True

# we did not handle this symbol, so return false
Expand Down
2 changes: 1 addition & 1 deletion suite/regress/x86_call_ptr_sym.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def sym_resolver(symbol, value):
if symbol == b'GetPhoneBuildString':
value = 0x41b000
value.contents.value = 0x41b000
return True
return False

Expand Down
2 changes: 1 addition & 1 deletion suite/regress/x86_issue293.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def runTest(self):
try:
# An exception should be raised from the jnz exit:; being bad
encoding, count = ks.asm(b"jnz exit:; add eax, ebx; exit: ret")
except Exception, e:
except Exception as e:
return
raise Exception

Expand Down