summaryrefslogtreecommitdiffstats
path: root/courgette/patcher_x86_32.h
diff options
context:
space:
mode:
authorpaulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-06 00:11:54 +0000
committerpaulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-06 00:11:54 +0000
commit9dc8e30aa56830051d4c3a940aa3c5a59bc59f94 (patch)
tree0294f5f07f19d9976d04cc9f1a09bac580e9053b /courgette/patcher_x86_32.h
parent3ecbf2da233bfef0b92eadbbeac11ff1af6a1ce1 (diff)
downloadchromium_src-9dc8e30aa56830051d4c3a940aa3c5a59bc59f94.zip
chromium_src-9dc8e30aa56830051d4c3a940aa3c5a59bc59f94.tar.gz
chromium_src-9dc8e30aa56830051d4c3a940aa3c5a59bc59f94.tar.bz2
ARM binaries seen by Courgette have three ISAs, ARM, thumb, and thumb-2. Courgette currently identified branch instructions from these ISAs heuristically, which leads to false positives. This patch improves on the heuristic by ignoring branches to addresses that aren't used very much in the binary.
Currently, the lower threshold for the number of times an address is used is 5, which was found empirically. ARM versions of chrome OS from daisy_3701.98.0 to daisy_4206.0.0 double the bytes saved by Courgette. BUG=266019 Review URL: https://chromiumcodereview.appspot.com/21428006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/patcher_x86_32.h')
-rw-r--r--courgette/patcher_x86_32.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/courgette/patcher_x86_32.h b/courgette/patcher_x86_32.h
index cf8ac00..9488270 100644
--- a/courgette/patcher_x86_32.h
+++ b/courgette/patcher_x86_32.h
@@ -54,6 +54,13 @@ class PatcherX86_32 : public TransformationPatcher {
if (status != C_OK)
return status;
+ // Trim labels below a certain threshold
+ Status trim_status = TrimLabels(program);
+ if (trim_status != C_OK) {
+ DeleteAssemblyProgram(program);
+ return trim_status;
+ }
+
EncodedProgram* encoded = NULL;
status = Encode(program, &encoded);
DeleteAssemblyProgram(program);