From e0b8d19f3159edbeecb7eea4b3d18ffeca3dd33d Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Thu, 26 Feb 2015 17:57:55 +0000 Subject: [PATCH] Fix zipalign README file and usage strings. Addresses comments from change 13e5965306. Change-Id: I0a2c0048781858d3aa06347a77220547cfcdcebe --- tools/zipalign/README.txt | 5 +++++ tools/zipalign/ZipAlign.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/zipalign/README.txt b/tools/zipalign/README.txt index 9c7d07e538..0b80b3535e 100644 --- a/tools/zipalign/README.txt +++ b/tools/zipalign/README.txt @@ -5,6 +5,7 @@ usage: zipalign [-f] [-v] infile.zip outfile.zip -c : check alignment only (does not modify file) -f : overwrite existing outfile.zip + -p : page align stored shared object files -v : verbose output is in bytes, e.g. "4" provides 32-bit alignment infile.zip is an existing Zip archive @@ -33,3 +34,7 @@ By default, zipalign will not overwrite an existing output file. With the You can use the "-c" flag to test whether a zip archive is properly aligned. +The "-p" flag aligns any file with a ".so" extension, and which is stored +uncompressed in the zip archive, to a 4096-byte page boundary. This +facilitates directly loading shared libraries from inside a zip archive. + diff --git a/tools/zipalign/ZipAlign.cpp b/tools/zipalign/ZipAlign.cpp index 191dd41125..a2dfd02891 100644 --- a/tools/zipalign/ZipAlign.cpp +++ b/tools/zipalign/ZipAlign.cpp @@ -33,21 +33,21 @@ void usage(void) fprintf(stderr, "Copyright (C) 2009 The Android Open Source Project\n\n"); fprintf(stderr, "Usage: zipalign [-f] [-p] [-v] [-z] infile.zip outfile.zip\n" - " zipalign -c [-v] infile.zip [list of files]\n\n" ); + " zipalign -c [-v] infile.zip\n\n" ); fprintf(stderr, " : alignment in bytes, e.g. '4' provides 32-bit alignment\n"); fprintf(stderr, " -c: check alignment only (does not modify file)\n"); fprintf(stderr, " -f: overwrite existing outfile.zip\n"); - fprintf(stderr, " -p: page align stored shared object: files\n"); + fprintf(stderr, " -p: page align stored shared object files\n"); fprintf(stderr, " -v: verbose output\n"); fprintf(stderr, " -z: recompress using Zopfli\n"); } -static const int kPageAlignment = 4096; - static int getAlignment(bool pageAlignSharedLibs, int defaultAlignment, ZipEntry* pEntry) { + static const int kPageAlignment = 4096; + if (!pageAlignSharedLibs) { return defaultAlignment; }