@@ -91,11 +91,6 @@ class ConstantAggregateBuilderBase
9191
9292 void addRelativeAddress (llvm::Constant *target) {
9393 assert (!isa<llvm::ConstantPointerNull>(target));
94- if (IGM ().TargetInfo .OutputObjectFormat == llvm::Triple::Wasm) {
95- // WebAssembly: hack: doesn't support PCrel data relocations
96- add (llvm::ConstantExpr::getPtrToInt (target, IGM ().RelativeAddressTy , false ));
97- return ;
98- }
9994 addRelativeOffset (IGM ().RelativeAddressTy , target);
10095 }
10196
@@ -104,21 +99,6 @@ class ConstantAggregateBuilderBase
10499 // / a "GOT-equivalent", i.e. a pointer to an external object; if so,
105100 // / set the low bit of the offset to indicate that this is true.
106101 void addRelativeAddress (ConstantReference reference) {
107- if (IGM ().TargetInfo .OutputObjectFormat == llvm::Triple::Wasm) {
108- // WebAssembly: hack: doesn't support PCrel data relocations
109- // also, we should set the lowest bit, but I don't know how to do that
110- // there's no GOT on WebAssembly anyways though
111-
112-
113- llvm::Constant *offset = llvm::ConstantExpr::getPtrToInt (reference.getValue (), IGM ().RelativeAddressTy , false );
114- // borrowed from addTaggedRelativeOffset
115- unsigned tag = unsigned (reference.isIndirect ());
116- if (tag) {
117- offset = llvm::ConstantExpr::getAdd (offset, llvm::ConstantInt::get (IGM ().RelativeAddressTy , tag));
118- }
119- add (offset);
120- return ;
121- }
122102 addTaggedRelativeOffset (IGM ().RelativeAddressTy ,
123103 reference.getValue (),
124104 unsigned (reference.isIndirect ()));
@@ -128,11 +108,6 @@ class ConstantAggregateBuilderBase
128108 // / The target must be a "GOT-equivalent", i.e. a pointer to an
129109 // / external object.
130110 void addIndirectRelativeAddress (ConstantReference reference) {
131- if (IGM ().TargetInfo .OutputObjectFormat == llvm::Triple::Wasm) {
132- // WebAssembly: hack: doesn't support PCrel data relocations
133- add (llvm::ConstantExpr::getPtrToInt (reference.getValue (), IGM ().RelativeAddressTy , false ));
134- return ;
135- }
136111 assert (reference.isIndirect ());
137112 addRelativeOffset (IGM ().RelativeAddressTy ,
138113 reference.getValue ());
0 commit comments