From caa1ef6318a88e7da95c9909619a94f812cda9e5 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Sun, 23 Oct 2016 22:42:25 +0300 Subject: [PATCH] Fix depfixer on MIPS. --- authors.txt | 1 + mesonbuild/scripts/depfixer.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/authors.txt b/authors.txt index 0222ff662..5931481af 100644 --- a/authors.txt +++ b/authors.txt @@ -52,3 +52,4 @@ Scott D Phillips Gautier Pelloux-Prayer Alexandre Foley Jouni Kosonen +Aurelien Jarno diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py index 7124c6f70..34fb2f75b 100755 --- a/mesonbuild/scripts/depfixer.py +++ b/mesonbuild/scripts/depfixer.py @@ -23,6 +23,7 @@ DT_RPATH = 15 DT_RUNPATH = 29 DT_STRTAB = 5 DT_SONAME = 14 +DT_MIPS_RLD_MAP_REL = 1879048245 class DataSizes(): def __init__(self, ptrsize, is_le): @@ -307,6 +308,11 @@ class Elf(DataSizes): rpentry.d_tag = 0 self.dynamic = self.dynamic[:i] + self.dynamic[i+1:] + [rpentry] break; + # DT_MIPS_RLD_MAP_REL is relative to the offset of the tag. Adjust it consequently. + for entry in self.dynamic[i:]: + if entry.d_tag == DT_MIPS_RLD_MAP_REL: + entry.val += 2 * (self.ptrsize // 8) + break self.bf.seek(sec.sh_offset) for entry in self.dynamic: entry.write(self.bf)