GP-6329 Corrected PowerPC-32 ELF Relocation processing for

R_PPC_ADDR16_LO and R_PPC_ADDR16_HA
This commit is contained in:
ghidra1
2026-01-13 17:15:52 -05:00
parent c38915ebd1
commit fe35e34add

View File

@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -138,7 +138,8 @@ public class PowerPC_ElfRelocationHandler extends
byteLength = 2;
break;
case R_PPC_ADDR16_LO:
if (Long.compareUnsigned(symbolValue, relocbase) > 0 &&
if (sym.isSection() && sym.getValue() != 0 &&
Long.compareUnsigned(symbolValue, relocbase) > 0 &&
Long.compareUnsigned(symbolValue, relocbase + addend) <= 0) {
/**
* (freebsd) Addend values are sometimes relative to sections in rela,
@@ -156,7 +157,8 @@ public class PowerPC_ElfRelocationHandler extends
byteLength = 2;
break;
case R_PPC_ADDR16_HA:
if (Long.compareUnsigned(symbolValue, relocbase) > 0 &&
if (sym.isSection() && sym.getValue() != 0 &&
Long.compareUnsigned(symbolValue, relocbase) > 0 &&
Long.compareUnsigned(symbolValue, relocbase + addend) <= 0) {
/**
* (freebsd) Addend values are sometimes relative to sections in rela,