Explorar el Código

Handle ET_DYN binaries with nonzero offset

This enables symbolization of some ChromeOS binaries.
Raul Silvera hace 8 años
padre
commit
af9754ae2a
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4
    1
      internal/elfexec/elfexec.go

+ 4
- 1
internal/elfexec/elfexec.go Ver fichero

@@ -237,7 +237,10 @@ func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint6
237 237
 		return start, nil
238 238
 	case elf.ET_DYN:
239 239
 		if offset != 0 {
240
-			return 0, fmt.Errorf("Don't know how to handle mapping.Offset")
240
+			if loadSegment == nil || loadSegment.Vaddr == 0 {
241
+				return start - offset, nil
242
+			}
243
+			return 0, fmt.Errorf("Don't know how to handle mapping.Offset %x, vaddr=%x", offset, loadSegment.Vaddr)
241 244
 		}
242 245
 		if loadSegment == nil {
243 246
 			return start, nil