@@ -66,12 +66,12 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
66
66
case 5 :
67
67
break ;
68
68
default :
69
- System .out .println ("DEBUG RISCV: " +
70
- type + " " + relocationAddress + " " +
71
- String .format ("%x" , symbolValue ) + " " +
72
- String .format ("%x" , addend ) + " " +
73
- String .format ("%x" , offset ) + " " +
74
- String .format ("%x" , base ));// + " " +
69
+ // System.out.println("DEBUG RISCV: " +
70
+ // type + " " + relocationAddress + " " +
71
+ // String.format("%x", symbolValue) + " " +
72
+ // String.format("%x", addend) + " " +
73
+ // String.format("%x", offset) + " " +
74
+ // String.format("%x", base));// + " " +
75
75
//String.format("%x", memory.getInt(relocationAddress)));
76
76
break ;
77
77
}
@@ -146,43 +146,37 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
146
146
case RISCV_ElfRelocationConstants .R_RISCV_TLS_DTPMOD32 :
147
147
// TLS relocation word32 = S->TLSINDEX
148
148
markAsWarning (program , relocationAddress , "R_RISCV_TLS_DTPMOD32" , symbolName ,
149
- symbolIndex ,
150
- "TODO, needs support " , elfRelocationContext .getLog ());
149
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
151
150
return RelocationResult .UNSUPPORTED ;
152
151
153
152
case RISCV_ElfRelocationConstants .R_RISCV_TLS_DTPMOD64 :
154
153
// TLS relocation word64 = S->TLSINDEX
155
154
markAsWarning (program , relocationAddress , "R_RISCV_TLS_DTPMOD32" , symbolName ,
156
- symbolIndex ,
157
- "TODO, needs support " , elfRelocationContext .getLog ());
155
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
158
156
return RelocationResult .UNSUPPORTED ;
159
157
160
158
case RISCV_ElfRelocationConstants .R_RISCV_TLS_DTPREL32 :
161
159
// TLS relocation word32 = TLS + S + A - TLS_TP_OFFSET
162
160
markAsWarning (program , relocationAddress , "R_RISCV_TLS_DTPREL32" , symbolName ,
163
- symbolIndex ,
164
- "TODO, needs support " , elfRelocationContext .getLog ());
161
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
165
162
return RelocationResult .UNSUPPORTED ;
166
163
167
164
case RISCV_ElfRelocationConstants .R_RISCV_TLS_DTPREL64 :
168
165
// TLS relocation word64 = TLS + S + A - TLS_TP_OFFSET
169
166
markAsWarning (program , relocationAddress , "R_RISCV_TLS_DTPREL64" , symbolName ,
170
- symbolIndex ,
171
- "TODO, needs support " , elfRelocationContext .getLog ());
167
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
172
168
return RelocationResult .UNSUPPORTED ;
173
169
174
170
case RISCV_ElfRelocationConstants .R_RISCV_TLS_TPREL32 :
175
171
// TLS relocation word32 = TLS + S + A + S_TLS_OFFSET - TLS_DTV_OFFSET
176
172
markAsWarning (program , relocationAddress , "R_RISCV_TLS_DTREL32" , symbolName ,
177
- symbolIndex ,
178
- "TODO, needs support " , elfRelocationContext .getLog ());
173
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
179
174
return RelocationResult .UNSUPPORTED ;
180
175
181
176
case RISCV_ElfRelocationConstants .R_RISCV_TLS_TPREL64 :
182
177
// TLS relocation word64 = TLS + S + A + S_TLS_OFFSET - TLS_DTV_OFFSET
183
178
markAsWarning (program , relocationAddress , "R_RISCV_TLS_TPREL64" , symbolName ,
184
- symbolIndex ,
185
- "TODO, needs support " , elfRelocationContext .getLog ());
179
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
186
180
return RelocationResult .UNSUPPORTED ;
187
181
188
182
case RISCV_ElfRelocationConstants .R_RISCV_BRANCH :
@@ -217,50 +211,43 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
217
211
case RISCV_ElfRelocationConstants .R_RISCV_CALL_PLT :
218
212
// PC-relative call (PLT) MACRO call,tail (auipc+jalr pair) PIC
219
213
markAsWarning (program , relocationAddress , "R_RISCV_CALL_PLT" , symbolName ,
220
- symbolIndex ,
221
- "TODO, needs support " , elfRelocationContext .getLog ());
214
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
222
215
return RelocationResult .UNSUPPORTED ;
223
216
224
217
case RISCV_ElfRelocationConstants .R_RISCV_GOT_HI20 :
225
218
// PC-relative GOT reference MACRO la
226
219
markAsWarning (program , relocationAddress , "R_RISCV_GOT_HI20" , symbolName ,
227
- symbolIndex ,
228
- "TODO, needs support " , elfRelocationContext .getLog ());
220
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
229
221
return RelocationResult .UNSUPPORTED ;
230
222
231
223
case RISCV_ElfRelocationConstants .R_RISCV_TLS_GOT_HI20 :
232
224
// PC-relative TLS IE GOT offset MACRO la.tls.ie
233
225
markAsWarning (program , relocationAddress , "R_RISCV_TLS_GOT_HI20" , symbolName ,
234
- symbolIndex ,
235
- "TODO, needs support " , elfRelocationContext .getLog ());
226
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
236
227
return RelocationResult .UNSUPPORTED ;
237
228
238
229
case RISCV_ElfRelocationConstants .R_RISCV_TLS_GD_HI20 :
239
230
// PC-relative TLS GD reference MACRO la.tls.gd
240
231
markAsWarning (program , relocationAddress , "R_RISCV_TLS_GD_HI20" , symbolName ,
241
- symbolIndex ,
242
- "TODO, needs support " , elfRelocationContext .getLog ());
232
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
243
233
return RelocationResult .UNSUPPORTED ;
244
234
245
235
case RISCV_ElfRelocationConstants .R_RISCV_PCREL_HI20 :
246
236
// PC-relative reference %pcrel_hi(symbol) (U-Type)
247
237
markAsWarning (program , relocationAddress , "R_RISCV_PCREL_HI20" , symbolName ,
248
- symbolIndex ,
249
- "TODO, needs support " , elfRelocationContext .getLog ());
238
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
250
239
return RelocationResult .UNSUPPORTED ;
251
240
252
241
case RISCV_ElfRelocationConstants .R_RISCV_PCREL_LO12_I :
253
242
// PC-relative reference %pcrel_lo(symbol) (I-Type)
254
243
markAsWarning (program , relocationAddress , "R_RISCV_PCREL_LO12_I" , symbolName ,
255
- symbolIndex ,
256
- "TODO, needs support " , elfRelocationContext .getLog ());
244
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
257
245
return RelocationResult .UNSUPPORTED ;
258
246
259
247
case RISCV_ElfRelocationConstants .R_RISCV_PCREL_LO12_S :
260
248
// PC-relative reference %pcrel_lo(symbol) (S-Type)
261
249
markAsWarning (program , relocationAddress , "R_RISCV_PCREL_LO12_S" , symbolName ,
262
- symbolIndex ,
263
- "TODO, needs support " , elfRelocationContext .getLog ());
250
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
264
251
return RelocationResult .UNSUPPORTED ;
265
252
266
253
case RISCV_ElfRelocationConstants .R_RISCV_HI20 :
@@ -288,35 +275,29 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
288
275
case RISCV_ElfRelocationConstants .R_RISCV_TPREL_HI20 :
289
276
// TLS LE thread offset %tprel_hi(symbol) (U-Type)
290
277
markAsWarning (program , relocationAddress , "R_RISCV_TPREL_HI20" , symbolName ,
291
- symbolIndex ,
292
- "TODO, needs support " , elfRelocationContext .getLog ());
278
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
293
279
return RelocationResult .UNSUPPORTED ;
294
280
295
281
case RISCV_ElfRelocationConstants .R_RISCV_TPREL_LO12_I :
296
282
// TLS LE thread offset %tprel_lo(symbol) (I-Type)
297
283
markAsWarning (program , relocationAddress , "R_RISCV_TPREL_LO12_I" , symbolName ,
298
- symbolIndex ,
299
- "TODO, needs support " , elfRelocationContext .getLog ());
284
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
300
285
return RelocationResult .UNSUPPORTED ;
301
286
302
287
case RISCV_ElfRelocationConstants .R_RISCV_TPREL_LO12_S :
303
288
// TLS LE thread offset %tprel_lo(symbol) (S-Type)
304
289
markAsWarning (program , relocationAddress , "R_RISCV_TPREL_LO12_S" , symbolName ,
305
- symbolIndex ,
306
- "TODO, needs support " , elfRelocationContext .getLog ());
290
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
307
291
return RelocationResult .UNSUPPORTED ;
308
292
309
293
case RISCV_ElfRelocationConstants .R_RISCV_TPREL_ADD :
310
294
// TLS LE thread usage %tprel_add(symbol)
311
295
markAsWarning (program , relocationAddress , "R_RISCV_TPREL_ADD" , symbolName ,
312
- symbolIndex ,
313
- "TODO, needs support " , elfRelocationContext .getLog ());
296
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
314
297
return RelocationResult .UNSUPPORTED ;
315
298
316
299
case RISCV_ElfRelocationConstants .R_RISCV_ADD8 :
317
300
// 8-bit label addition word8 = old + S + A
318
- markAsWarning (program , relocationAddress , "R_RISCV_ADD8" , symbolName , symbolIndex ,
319
- "TODO, needs support " , elfRelocationContext .getLog ());
320
301
value8 = memory .getByte (relocationAddress );
321
302
value8 += (byte ) symbolValue ;
322
303
value8 += (byte ) addend ;
@@ -326,8 +307,6 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
326
307
327
308
case RISCV_ElfRelocationConstants .R_RISCV_ADD16 :
328
309
// 16-bit label addition word16 = old + S + A
329
- markAsWarning (program , relocationAddress , "R_RISCV_ADD16" , symbolName , symbolIndex ,
330
- "TODO, needs support " , elfRelocationContext .getLog ());
331
310
value16 = memory .getShort (relocationAddress );
332
311
value16 += (short ) symbolValue ;
333
312
value16 += (short ) addend ;
@@ -337,8 +316,6 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
337
316
338
317
case RISCV_ElfRelocationConstants .R_RISCV_ADD32 :
339
318
// 32-bit label addition word32 = old + S + A
340
- markAsWarning (program , relocationAddress , "R_RISCV_ADD32" , symbolName , symbolIndex ,
341
- "TODO, needs support " , elfRelocationContext .getLog ());
342
319
value32 = memory .getInt (relocationAddress );
343
320
value32 += (int ) symbolValue ;
344
321
value32 += (int ) addend ;
@@ -347,8 +324,6 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
347
324
348
325
case RISCV_ElfRelocationConstants .R_RISCV_ADD64 :
349
326
// 64-bit label addition word64 = old + S + A
350
- markAsWarning (program , relocationAddress , "R_RISCV_ADD64" , symbolName , symbolIndex ,
351
- "TODO, needs support " , elfRelocationContext .getLog ());
352
327
value64 = memory .getLong (relocationAddress );
353
328
value64 += symbolValue ;
354
329
value64 += addend ;
@@ -358,8 +333,6 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
358
333
359
334
case RISCV_ElfRelocationConstants .R_RISCV_SUB8 :
360
335
// 8-bit label subtraction word8 = old - S - A
361
- markAsWarning (program , relocationAddress , "R_RISCV_SUB8" , symbolName , symbolIndex ,
362
- "TODO, needs support " , elfRelocationContext .getLog ());
363
336
value8 = memory .getByte (relocationAddress );
364
337
value8 -= (byte ) symbolValue ;
365
338
value8 -= (byte ) addend ;
@@ -369,8 +342,6 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
369
342
370
343
case RISCV_ElfRelocationConstants .R_RISCV_SUB16 :
371
344
// 16-bit label subtraction word16 = old - S - A
372
- markAsWarning (program , relocationAddress , "R_RISCV_SUB16" , symbolName , symbolIndex ,
373
- "TODO, needs support " , elfRelocationContext .getLog ());
374
345
value16 = memory .getShort (relocationAddress );
375
346
value16 -= (short ) symbolValue ;
376
347
value16 -= (short ) addend ;
@@ -380,8 +351,6 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
380
351
381
352
case RISCV_ElfRelocationConstants .R_RISCV_SUB32 :
382
353
// 32-bit label subtraction word32 = old - S - A
383
- markAsWarning (program , relocationAddress , "R_RISCV_SUB32" , symbolName , symbolIndex ,
384
- "TODO, needs support " , elfRelocationContext .getLog ());
385
354
value32 = memory .getInt (relocationAddress );
386
355
value32 -= (int ) symbolValue ;
387
356
value32 -= (int ) addend ;
@@ -390,8 +359,6 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
390
359
391
360
case RISCV_ElfRelocationConstants .R_RISCV_SUB64 :
392
361
// 64-bit label subtraction word64 = old - S - A
393
- markAsWarning (program , relocationAddress , "R_RISCV_SUB64" , symbolName , symbolIndex ,
394
- "TODO, needs support " , elfRelocationContext .getLog ());
395
362
value64 = memory .getLong (relocationAddress );
396
363
value64 -= symbolValue ;
397
364
value64 -= addend ;
@@ -402,15 +369,13 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
402
369
case RISCV_ElfRelocationConstants .R_RISCV_GNU_VTINHERIT :
403
370
// GNU C++ vtable hierarchy
404
371
markAsWarning (program , relocationAddress , "R_RISCV_GNU_VTINHERIT" , symbolName ,
405
- symbolIndex ,
406
- "TODO, needs support " , elfRelocationContext .getLog ());
372
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
407
373
return RelocationResult .UNSUPPORTED ;
408
374
409
375
case RISCV_ElfRelocationConstants .R_RISCV_GNU_VTENTRY :
410
376
// GNU C++ vtable member usage
411
377
markAsWarning (program , relocationAddress , "R_RISCV_GNU_VTENTRY" , symbolName ,
412
- symbolIndex ,
413
- "TODO, needs support " , elfRelocationContext .getLog ());
378
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
414
379
return RelocationResult .UNSUPPORTED ;
415
380
416
381
case RISCV_ElfRelocationConstants .R_RISCV_ALIGN :
@@ -451,36 +416,31 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
451
416
case RISCV_ElfRelocationConstants .R_RISCV_RVC_LUI :
452
417
// Absolute address (CI-Type)
453
418
markAsWarning (program , relocationAddress , "R_RISCV_RVC_LUI" , symbolName ,
454
- symbolIndex ,
455
- "TODO, needs support " , elfRelocationContext .getLog ());
419
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
456
420
return RelocationResult .UNSUPPORTED ;
457
421
458
422
case RISCV_ElfRelocationConstants .R_RISCV_GPREL_I :
459
423
// GP-relative reference (I-Type)
460
424
markAsWarning (program , relocationAddress , "R_RISCV_GPREL_I" , symbolName ,
461
- symbolIndex ,
462
- "TODO, needs support " , elfRelocationContext .getLog ());
425
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
463
426
return RelocationResult .UNSUPPORTED ;
464
427
465
428
case RISCV_ElfRelocationConstants .R_RISCV_GPREL_S :
466
429
// GP-relative reference (S-Type)
467
430
markAsWarning (program , relocationAddress , "R_RISCV_GPREL_S" , symbolName ,
468
- symbolIndex ,
469
- "TODO, needs support " , elfRelocationContext .getLog ());
431
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
470
432
return RelocationResult .UNSUPPORTED ;
471
433
472
434
case RISCV_ElfRelocationConstants .R_RISCV_TPREL_I :
473
435
// TP-relative TLS LE load (I-Type)
474
436
markAsWarning (program , relocationAddress , "R_RISCV_TPREL_I" , symbolName ,
475
- symbolIndex ,
476
- "TODO, needs support " , elfRelocationContext .getLog ());
437
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
477
438
return RelocationResult .UNSUPPORTED ;
478
439
479
440
case RISCV_ElfRelocationConstants .R_RISCV_TPREL_S :
480
441
// TP-relative TLS LE store (S-Type)
481
442
markAsWarning (program , relocationAddress , "R_RISCV_TPREL_S" , symbolName ,
482
- symbolIndex ,
483
- "TODO, needs support " , elfRelocationContext .getLog ());
443
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
484
444
return RelocationResult .UNSUPPORTED ;
485
445
486
446
case RISCV_ElfRelocationConstants .R_RISCV_RELAX :
@@ -522,8 +482,7 @@ public RelocationResult relocate(ElfRelocationContext elfRelocationContext,
522
482
case RISCV_ElfRelocationConstants .R_RISCV_32_PCREL :
523
483
// 32-bit PC relative
524
484
markAsWarning (program , relocationAddress , "R_RISCV_32_PCREL" , symbolName ,
525
- symbolIndex ,
526
- "TODO, needs support " , elfRelocationContext .getLog ());
485
+ symbolIndex , "TODO, needs support " , elfRelocationContext .getLog ());
527
486
return RelocationResult .UNSUPPORTED ;
528
487
529
488
default :
0 commit comments