Closed StarGazerM closed 2 years ago
I assume you mean foo@gottpoff
. gtirb-rewriting doesn't support it yet, but it should be really easy to add. Here's an untested diff that I can try to get in later this week.
diff --git a/gtirb_rewriting/assembler.py b/gtirb_rewriting/assembler.py
index 017797c..bd092e6 100644
--- a/gtirb_rewriting/assembler.py
+++ b/gtirb_rewriting/assembler.py
@@ -482,8 +482,29 @@ class Assembler:
if "variantKind" in expr:
if expr["variantKind"] == "PLT":
attributes.add(gtirb.SymbolicExpression.Attribute.PltRef)
+ elif expr["variantKind"] == "GOTNTPOFF":
+ attributes.add(gtirb.SymbolicExpression.Attribute.GotOff)
+ attributes.add(gtirb.SymbolicExpression.Attribute.NtpOff)
+ elif expr["variantKind"] == "GOT":
+ attributes.add(gtirb.SymbolicExpression.Attribute.GotOff)
+ attributes.add(gtirb.SymbolicExpression.Attribute.GotRef)
+ elif expr["variantKind"] == "GOTOFFF":
+ attributes.add(gtirb.SymbolicExpression.Attribute.GotOff)
+ elif expr["variantKind"] == "GOTTPOFF":
+ attributes.add(gtirb.SymbolicExpression.Attribute.GotRelPC)
+ attributes.add(gtirb.SymbolicExpression.Attribute.TpOff)
elif expr["variantKind"] == "GOTPCREL":
attributes.add(gtirb.SymbolicExpression.Attribute.GotRelPC)
+ elif expr["variantKind"] == "TPOFF":
+ attributes.add(gtirb.SymbolicExpression.Attribute.TpOff)
+ elif expr["variantKind"] == "NTPOFF":
+ attributes.add(gtirb.SymbolicExpression.Attribute.NtpOff)
+ elif expr["variantKind"] == "DTPOFF":
+ attributes.add(gtirb.SymbolicExpression.Attribute.DtpOff)
+ elif expr["variantKind"] == "TLSGD":
+ attributes.add(gtirb.SymbolicExpression.Attribute.TlsGd)
+ elif expr["variantKind"] == "TLSLD":
+ attributes.add(gtirb.SymbolicExpression.Attribute.TlsLd)
else:
assert False, f"Unsupported variantKind: {expr['variantKind']}"
elif (
okk, I had thought it is something like
gtirb.SymbolicExpression.Attribute.GOTTPOFF
(TvT)./
Thank you so much!
This has landed in gtirb-rewriting 0.1.0, which was just released.
Hi! I meet a problem when I try to insert code contain TLS gobal variable in other module(for example during reassemble to binary phase I want to link and compile with another object file
foo.o
). For example:seems current rewriter can't support tls attribute now? Is it possible to do this kind of rewriting, if I directly modify the GTIRB IR?