From 965b795b87c59ed45cc7f16a62301dbae65b1627 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 30 Nov 2020 13:03:03 +0100 Subject: decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly text data bss dec hex filename 1021988 559 5052 1027599 fae0f busybox_old 1021236 559 5052 1026847 fab1f busybox_unstripped Signed-off-by: Denys Vlasenko --- archival/dpkg.c | 2 +- archival/libarchive/bz/blocksort.c | 2 +- archival/libarchive/data_extract_to_command.c | 2 +- coreutils/od_bloaty.c | 4 ++-- coreutils/split.c | 2 +- coreutils/stat.c | 2 +- coreutils/stty.c | 4 ++-- coreutils/test.c | 2 +- e2fsprogs/e2fs_lib.c | 2 +- editors/awk.c | 2 +- findutils/find.c | 2 +- include/libbb.h | 3 ++- include/platform.h | 2 ++ libbb/capability.c | 2 +- libbb/duration.c | 2 +- libbb/hash_md5_sha.c | 22 +++++++++++----------- libbb/mode_string.c | 2 +- libbb/pw_encrypt_des.c | 15 +++++++-------- libbb/speed_table.c | 2 +- libbb/xatonum.c | 6 +++--- miscutils/crond.c | 2 +- miscutils/dc.c | 2 +- miscutils/hdparm.c | 2 +- miscutils/i2c_tools.c | 15 +++++---------- miscutils/mt.c | 2 +- miscutils/setserial.c | 3 +-- miscutils/ubi_tools.c | 2 +- miscutils/watchdog.c | 2 +- modutils/modinfo.c | 2 +- networking/ifplugd.c | 2 +- networking/interface.c | 2 +- networking/ip.c | 2 +- networking/libiproute/rt_names.c | 2 +- networking/route.c | 6 +++--- networking/tls.c | 2 +- networking/udhcp/dhcpd.c | 2 +- procps/nmeter.c | 2 +- procps/ps.c | 2 +- runit/svlogd.c | 2 +- shell/ash.c | 6 +++--- shell/hush.c | 12 ++++++------ shell/shell_common.c | 2 +- util-linux/acpid.c | 4 ++-- util-linux/fbset.c | 2 +- util-linux/fdisk.c | 2 +- util-linux/fdisk_osf.c | 4 ++-- util-linux/fdisk_sgi.c | 2 +- util-linux/fdisk_sun.c | 4 ++-- util-linux/mkfs_ext2.c | 2 +- util-linux/mount.c | 2 +- util-linux/volume_id/volume_id.c | 8 ++++---- 51 files changed, 92 insertions(+), 96 deletions(-) diff --git a/archival/dpkg.c b/archival/dpkg.c index 68a40bf..bf070a0 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -1304,7 +1304,7 @@ postrm abort-install postrm abort-upgrade postrm disappear */ -static const char *const all_control_files[] = { +static const char *const all_control_files[] ALIGN_PTR = { "preinst", "postinst", "prerm", "postrm", "list", "md5sums", "shlibs", "conffiles", "config", "templates" diff --git a/archival/libarchive/bz/blocksort.c b/archival/libarchive/bz/blocksort.c index 92d6d82..062fd0f 100644 --- a/archival/libarchive/bz/blocksort.c +++ b/archival/libarchive/bz/blocksort.c @@ -459,7 +459,7 @@ int mainGtU(EState* state, * usually small, typically <= 20. */ static -const uint32_t incs[14] = { +const uint32_t incs[14] ALIGN4 = { 1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, 797161, 2391484 diff --git a/archival/libarchive/data_extract_to_command.c b/archival/libarchive/data_extract_to_command.c index 0fcabb4..f8b2ff8 100644 --- a/archival/libarchive/data_extract_to_command.c +++ b/archival/libarchive/data_extract_to_command.c @@ -20,7 +20,7 @@ enum { TAR_MAX, }; -static const char *const tar_var[] = { +static const char *const tar_var[] ALIGN_PTR = { // "FILETYPE", "MODE", "FILENAME", diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index e9c071f..d5bd7bf 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c @@ -627,7 +627,7 @@ decode_one_format(const char *s_orig, const char *s, struct tspec *tspec) bytes_to_unsigned_dec_digits, bytes_to_hex_digits, }; - static const char doux_fmtstring[][sizeof(" %%0%u%s")] = { + static const char doux_fmtstring[][sizeof(" %%0%u%s")] ALIGN1 = { " %%%u%s", " %%0%u%s", " %%%u%s", @@ -1148,7 +1148,7 @@ dump_strings(off_t address, off_t end_offset) static int parse_old_offset(const char *s, off_t *offset) { - static const struct suffix_mult Bb[] = { + static const struct suffix_mult Bb[] ALIGN_SUFFIX = { { "B", 1024 }, { "b", 512 }, { "", 0 } diff --git a/coreutils/split.c b/coreutils/split.c index ecbc9d2..3fcfd95 100644 --- a/coreutils/split.c +++ b/coreutils/split.c @@ -44,7 +44,7 @@ #include "common_bufsiz.h" #if ENABLE_FEATURE_SPLIT_FANCY -static const struct suffix_mult split_suffixes[] = { +static const struct suffix_mult split_suffixes[] ALIGN_SUFFIX = { { "b", 512 }, { "k", 1024 }, { "m", 1024*1024 }, diff --git a/coreutils/stat.c b/coreutils/stat.c index 8a23d68..ee5e03e 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c @@ -208,7 +208,7 @@ FS_TYPE(0x62656572, "sysfs") static const char *human_fstype(uint32_t f_type) { # define FS_TYPE(type, name) type, - static const uint32_t fstype[] = { + static const uint32_t fstype[] ALIGN4 = { FS_TYPE_LIST }; # undef FS_TYPE diff --git a/coreutils/stty.c b/coreutils/stty.c index 40e8127..1925396 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c @@ -487,7 +487,7 @@ static const char mode_name[] ALIGN1 = #undef MI_ENTRY #define MI_ENTRY(N,T,F,B,M) { T, F, M, B }, -static const struct mode_info mode_info[] = { +static const struct mode_info mode_info[] ALIGN4 = { /* This should be verbatim cut-n-paste copy of the above MI_ENTRYs */ MI_ENTRY("evenp", combination, REV | OMIT, 0, 0 ) MI_ENTRY("parity", combination, REV | OMIT, 0, 0 ) @@ -905,7 +905,7 @@ static void display_window_size(int fancy) } } -static const struct suffix_mult stty_suffixes[] = { +static const struct suffix_mult stty_suffixes[] ALIGN_SUFFIX = { { "b", 512 }, { "k", 1024 }, { "B", 1024 }, diff --git a/coreutils/test.c b/coreutils/test.c index ac7b546..7c65743 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -306,7 +306,7 @@ struct operator_t { unsigned char op_num, op_type; }; -static const struct operator_t ops_table[] = { +static const struct operator_t ops_table[] ALIGN2 = { { /* "-r" */ FILRD , UNOP }, { /* "-w" */ FILWR , UNOP }, { /* "-x" */ FILEX , UNOP }, diff --git a/e2fsprogs/e2fs_lib.c b/e2fsprogs/e2fs_lib.c index 6ce655b..8bd4da6 100644 --- a/e2fsprogs/e2fs_lib.c +++ b/e2fsprogs/e2fs_lib.c @@ -127,7 +127,7 @@ int fgetsetflags(const char *name, unsigned long *get_flags, unsigned long set_f /* Print file attributes on an ext2 file system */ -const uint32_t e2attr_flags_value[] = { +const uint32_t e2attr_flags_value[] ALIGN4 = { #ifdef ENABLE_COMPRESSION EXT2_COMPRBLK_FL, EXT2_DIRTY_FL, diff --git a/editors/awk.c b/editors/awk.c index 59dae47..d56d633 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -405,7 +405,7 @@ static const char tokenlist[] ALIGN1 = #define OC_B OC_BUILTIN -static const uint32_t tokeninfo[] = { +static const uint32_t tokeninfo[] ALIGN4 = { 0, 0, OC_REGEXP, diff --git a/findutils/find.c b/findutils/find.c index e2947af..a8c3fa3 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -1441,7 +1441,7 @@ static action*** parse_params(char **argv) #else #define XATOU_SFX xatoul_sfx #endif - static const struct suffix_mult find_suffixes[] = { + static const struct suffix_mult find_suffixes[] ALIGN_SUFFIX = { { "c", 1 }, { "w", 2 }, { "", 512 }, diff --git a/include/libbb.h b/include/libbb.h index 18dc9f9..9872dc1 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1026,8 +1026,9 @@ void generate_uuid(uint8_t *buf) FAST_FUNC; /* Last element is marked by mult == 0 */ struct suffix_mult { char suffix[4]; - unsigned mult; + uint32_t mult; }; +#define ALIGN_SUFFIX ALIGN4 extern const struct suffix_mult bkm_suffixes[]; #define km_suffixes (bkm_suffixes + 1) extern const struct suffix_mult cwbkMG_suffixes[]; diff --git a/include/platform.h b/include/platform.h index 43bb391..085387f 100644 --- a/include/platform.h +++ b/include/platform.h @@ -342,6 +342,8 @@ typedef unsigned smalluint; # define ALIGN2 # define ALIGN4 #endif +#define ALIGN8 __attribute__((aligned(8))) +#define ALIGN_PTR __attribute__((aligned(sizeof(void*)))) /* * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably. diff --git a/libbb/capability.c b/libbb/capability.c index 23afd8e..e3c252a 100644 --- a/libbb/capability.c +++ b/libbb/capability.c @@ -17,7 +17,7 @@ extern int capget(cap_user_header_t header, const cap_user_data_t data); // This way, libcap needs not be installed in build environment. #include "libbb.h" -static const char *const capabilities[] = { +static const char *const capabilities[] ALIGN_PTR = { "chown", "dac_override", "dac_read_search", diff --git a/libbb/duration.c b/libbb/duration.c index 22b209f..086da15 100644 --- a/libbb/duration.c +++ b/libbb/duration.c @@ -21,7 +21,7 @@ #include "libbb.h" -static const struct suffix_mult duration_suffixes[] = { +static const struct suffix_mult duration_suffixes[] ALIGN_SUFFIX = { { "s", 1 }, { "m", 60 }, { "h", 60*60 }, diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c index d8f2101..e0db8ce 100644 --- a/libbb/hash_md5_sha.c +++ b/libbb/hash_md5_sha.c @@ -111,7 +111,7 @@ static void FAST_FUNC md5_process_block64(md5_ctx_t *ctx) They are defined in RFC 1321 as T[i] = (int)(2^32 * fabs(sin(i))), i=1..64 */ - static const uint32_t C_array[] = { + static const uint32_t C_array[] ALIGN4 = { /* round 1 */ 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, @@ -492,7 +492,7 @@ unsigned FAST_FUNC md5_end(md5_ctx_t *ctx, void *resbuf) static void FAST_FUNC sha1_process_block64(sha1_ctx_t *ctx) { - static const uint32_t rconsts[] = { + static const uint32_t rconsts[] ALIGN4 = { 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 }; int i, j; @@ -567,7 +567,7 @@ typedef uint64_t sha_K_int; typedef uint32_t sha_K_int; # define K(v) (uint32_t)(v >> 32) #endif -static const sha_K_int sha_K[] = { +static const sha_K_int sha_K[] ALIGN8 = { K(0x428a2f98d728ae22ULL), K(0x7137449123ef65cdULL), K(0xb5c0fbcfec4d3b2fULL), K(0xe9b5dba58189dbbcULL), K(0x3956c25bf348b538ULL), K(0x59f111f1b605d019ULL), @@ -760,7 +760,7 @@ void FAST_FUNC sha1_begin(sha1_ctx_t *ctx) ctx->process_block = sha1_process_block64; } -static const uint32_t init256[] = { +static const uint32_t init256[] ALIGN4 = { 0, 0, 0x6a09e667, @@ -773,7 +773,7 @@ static const uint32_t init256[] = { 0x5be0cd19, }; #if NEED_SHA512 -static const uint32_t init512_lo[] = { +static const uint32_t init512_lo[] ALIGN4 = { 0, 0, 0xf3bcc908, @@ -1009,7 +1009,7 @@ static void sha3_process_block72(uint64_t *state) #if OPTIMIZE_SHA3_FOR_32 /* - static const uint32_t IOTA_CONST_0[NROUNDS] = { + static const uint32_t IOTA_CONST_0[NROUNDS] ALIGN4 = { 0x00000001UL, 0x00000000UL, 0x00000000UL, @@ -1038,7 +1038,7 @@ static void sha3_process_block72(uint64_t *state) ** bits are in lsb: 0101 0000 1111 0100 1111 0001 */ uint32_t IOTA_CONST_0bits = (uint32_t)(0x0050f4f1); - static const uint32_t IOTA_CONST_1[NROUNDS] = { + static const uint32_t IOTA_CONST_1[NROUNDS] ALIGN4 = { 0x00000000UL, 0x00000089UL, 0x8000008bUL, @@ -1174,7 +1174,7 @@ static void sha3_process_block72(uint64_t *state) combine_halves(state); #else /* Native 64-bit algorithm */ - static const uint16_t IOTA_CONST[NROUNDS] = { + static const uint16_t IOTA_CONST[NROUNDS] ALIGN2 = { /* Elements should be 64-bit, but top half is always zero * or 0x80000000. We encode 63rd bits in a separate word below. * Same is true for 31th bits, which lets us use 16-bit table @@ -1210,15 +1210,15 @@ static void sha3_process_block72(uint64_t *state) /* bit for CONST[0] is in msb: 0001 0110 0011 1000 0001 1011 */ const uint32_t IOTA_CONST_bit31 = (uint32_t)(0x16381b00); - static const uint8_t ROT_CONST[24] = { + static const uint8_t ROT_CONST[24] ALIGN1 = { 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44, }; - static const uint8_t PI_LANE[24] = { + static const uint8_t PI_LANE[24] ALIGN1 = { 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1, }; - /*static const uint8_t MOD5[10] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, };*/ + /*static const uint8_t MOD5[10] ALIGN1 = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, };*/ unsigned x; unsigned round; diff --git a/libbb/mode_string.c b/libbb/mode_string.c index 5ffd568..9a286f3 100644 --- a/libbb/mode_string.c +++ b/libbb/mode_string.c @@ -27,7 +27,7 @@ #define mode_t unsigned short #endif -static const mode_t mode_flags[] = { +static const mode_t mode_flags[] ALIGN4 = { S_IRUSR, S_IWUSR, S_IXUSR, S_ISUID, S_IRGRP, S_IWGRP, S_IXGRP, S_ISGID, S_IROTH, S_IWOTH, S_IXOTH, S_ISVTX diff --git a/libbb/pw_encrypt_des.c b/libbb/pw_encrypt_des.c index 19a9ab1..c6fc328 100644 --- a/libbb/pw_encrypt_des.c +++ b/libbb/pw_encrypt_des.c @@ -65,25 +65,25 @@ /* A pile of data */ -static const uint8_t IP[64] = { +static const uint8_t IP[64] ALIGN1 = { 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7 }; -static const uint8_t key_perm[56] = { +static const uint8_t key_perm[56] ALIGN1 = { 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 }; -static const uint8_t key_shifts[16] = { +static const uint8_t key_shifts[16] ALIGN1 = { 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 }; -static const uint8_t comp_perm[48] = { +static const uint8_t comp_perm[48] ALIGN1 = { 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, @@ -181,13 +181,12 @@ static const uint8_t u_sbox[8][32] = { }; #endif -static const uint8_t pbox[32] = { +static const uint8_t pbox[32] ALIGN1 = { 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 }; -static const uint32_t bits32[32] = -{ +static const uint32_t bits32[32] ALIGN4 = { 0x80000000, 0x40000000, 0x20000000, 0x10000000, 0x08000000, 0x04000000, 0x02000000, 0x01000000, 0x00800000, 0x00400000, 0x00200000, 0x00100000, @@ -198,7 +197,7 @@ static const uint32_t bits32[32] = 0x00000008, 0x00000004, 0x00000002, 0x00000001 }; -static const uint8_t bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; +static const uint8_t bits8[8] ALIGN1 = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; static int diff --git a/libbb/speed_table.c b/libbb/speed_table.c index 967cf8d..cf7101e 100644 --- a/libbb/speed_table.c +++ b/libbb/speed_table.c @@ -28,7 +28,7 @@ struct speed_map { }; /* On Linux, Bxx constants are 0..15 (up to B38400) and 0x1001..0x100f */ -static const struct speed_map speeds[] = { +static const struct speed_map speeds[] ALIGN4 = { {B0, 0}, {B50, 50}, {B75, 75}, diff --git a/libbb/xatonum.c b/libbb/xatonum.c index 7639a62..36b06c8 100644 --- a/libbb/xatonum.c +++ b/libbb/xatonum.c @@ -68,14 +68,14 @@ uint16_t FAST_FUNC xatou16(const char *numstr) return xatou_range(numstr, 0, 0xffff); } -const struct suffix_mult bkm_suffixes[] = { +const struct suffix_mult bkm_suffixes[] ALIGN_SUFFIX = { { "b", 512 }, { "k", 1024 }, { "m", 1024*1024 }, { "", 0 } }; -const struct suffix_mult cwbkMG_suffixes[] = { +const struct suffix_mult cwbkMG_suffixes[] ALIGN_SUFFIX = { { "c", 1 }, { "w", 2 }, { "b", 512 }, @@ -96,7 +96,7 @@ const struct suffix_mult cwbkMG_suffixes[] = { { "", 0 } }; -const struct suffix_mult kmg_i_suffixes[] = { +const struct suffix_mult kmg_i_suffixes[] ALIGN_SUFFIX = { { "KiB", 1024 }, { "kiB", 1024 }, { "K", 1024 }, diff --git a/miscutils/crond.c b/miscutils/crond.c index 2e8ca8b..fb3adc1 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c @@ -492,7 +492,7 @@ static void load_crontab(const char *fileName) const char *name; const char tokens[8]; } SpecialEntry; - static const SpecialEntry SpecAry[] = { + static const SpecialEntry SpecAry[] ALIGN8 = { /* hour day month weekday */ { "yearly", "0\0" "1\0" "1\0" "*" }, { "annually", "0\0" "1\0" "1\0" "*" }, diff --git a/miscutils/dc.c b/miscutils/dc.c index ef93c20..51376dd 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c @@ -195,7 +195,7 @@ struct op { void (*function) (void); }; -static const struct op operators[] = { +static const struct op operators[] ALIGN_PTR = { #if ENABLE_FEATURE_DC_LIBM {"^", power}, // {"exp", power}, diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 431a0ad..01b4e8e 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -1366,7 +1366,7 @@ static NOINLINE void dump_identity(const struct hd_driveid *id) } if (id->capability & 1) { if (id->dma_1word | id->dma_mword) { - static const int dma_wmode_masks[] = { 0x100, 1, 0x200, 2, 0x400, 4, 0xf800, 0xf8 }; + static const int dma_wmode_masks[] ALIGN4 = { 0x100, 1, 0x200, 2, 0x400, 4, 0xf800, 0xf8 }; printf("\n DMA modes: "); print_flags_separated(dma_wmode_masks, "*\0""sdma0 \0""*\0""sdma1 \0""*\0""sdma2 \0""*\0""sdma? \0", diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index cc8b99a..09364e3 100644 --- a/miscutils/i2c_tools.c +++ b/miscutils/i2c_tools.c @@ -1053,18 +1053,13 @@ struct adap_desc { }; static const struct adap_desc adap_descs[] = { - { .funcs = "dummy", - .algo = "Dummy bus", }, - { .funcs = "isa", - .algo = "ISA bus", }, - { .funcs = "i2c", - .algo = "I2C adapter", }, - { .funcs = "smbus", - .algo = "SMBus adapter", }, + { .funcs = "dummy", .algo = "Dummy bus", }, + { .funcs = "isa", .algo = "ISA bus", }, + { .funcs = "i2c", .algo = "I2C adapter", }, + { .funcs = "smbus", .algo = "SMBus adapter", }, }; -struct i2c_func -{ +struct i2c_func { long value; const char* name; }; diff --git a/miscutils/mt.c b/miscutils/mt.c index 9f1aecf..dbb8c13 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c @@ -30,7 +30,7 @@ #include /* missing: eod/seod, stoptions, stwrthreshold, densities */ -static const short opcode_value[] = { +static const short opcode_value[] ALIGN2 = { MTBSF, MTBSFM, MTBSR, diff --git a/miscutils/setserial.c b/miscutils/setserial.c index 1e75bf4..2006861 100644 --- a/miscutils/setserial.c +++ b/miscutils/setserial.c @@ -381,8 +381,7 @@ static bool cmd_needs_arg(int cmd) # error "Unexpected flags size" #endif -static const uint16_t setbits[CMD_FLAG_LAST + 1] = -{ +static const uint16_t setbits[CMD_FLAG_LAST + 1] ALIGN2 = { 0, ASYNC_SPD_HI, ASYNC_SPD_VHI, diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index 94a637e..69ead7a 100644 --- a/miscutils/ubi_tools.c +++ b/miscutils/ubi_tools.c @@ -97,7 +97,7 @@ static unsigned get_num_from_file(const char *path, unsigned max) int ubi_tools_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ubi_tools_main(int argc UNUSED_PARAM, char **argv) { - static const struct suffix_mult size_suffixes[] = { + static const struct suffix_mult size_suffixes[] ALIGN_SUFFIX = { { "KiB", 1024 }, { "MiB", 1024*1024 }, { "GiB", 1024*1024*1024 }, diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index 971b777..0ed10bc 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c @@ -88,7 +88,7 @@ int watchdog_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int watchdog_main(int argc UNUSED_PARAM, char **argv) { static const int enable = WDIOS_ENABLECARD; - static const struct suffix_mult suffixes[] = { + static const struct suffix_mult suffixes[] ALIGN_SUFFIX = { { "ms", 1 }, { "", 1000 }, { "", 0 } diff --git a/modutils/modinfo.c b/modutils/modinfo.c index c5cdc79..d15772f 100644 --- a/modutils/modinfo.c +++ b/modutils/modinfo.c @@ -20,7 +20,7 @@ #include "libbb.h" #include "modutils.h" -static const char *const shortcuts[] = { +static const char *const shortcuts[] ALIGN_PTR = { "filename", // -n "author", // -a "description", // -d diff --git a/networking/ifplugd.c b/networking/ifplugd.c index 60916ea..18dcaff 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c @@ -304,7 +304,7 @@ static const char api_modes[] ALIGN1 = "empwia"; static const struct { const char *name; smallint (*func)(void); -} method_table[] = { +} method_table[] ALIGN_PTR = { { "SIOCETHTOOL" , &detect_link_ethtool }, { "SIOCGMIIPHY" , &detect_link_mii }, { "SIOCDEVPRIVATE" , &detect_link_priv }, diff --git a/networking/interface.c b/networking/interface.c index e5e55d8..ea6a2c8 100644 --- a/networking/interface.c +++ b/networking/interface.c @@ -746,7 +746,7 @@ static const struct hwtype *const hwtypes[] = { }; #ifdef IFF_PORTSEL -static const char *const if_port_text[] = { +static const char *const if_port_text[] ALIGN_PTR = { /* Keep in step with */ "unknown", "10base2", diff --git a/networking/ip.c b/networking/ip.c index 33bea5f..85b1ba0 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -400,7 +400,7 @@ int ip_main(int argc UNUSED_PARAM, char **argv) IF_FEATURE_IP_RULE("rule\0") IF_FEATURE_IP_NEIGH("neigh\0") ; - static const ip_func_ptr_t ip_func_ptrs[] = { + static const ip_func_ptr_t ip_func_ptrs[] ALIGN_PTR = { ip_print_help, IF_FEATURE_IP_ADDRESS(do_ipaddr,) IF_FEATURE_IP_ROUTE(do_iproute,) diff --git a/networking/libiproute/rt_names.c b/networking/libiproute/rt_names.c index 51f2e9b..3c2fad9 100644 --- a/networking/libiproute/rt_names.c +++ b/networking/libiproute/rt_names.c @@ -77,7 +77,7 @@ static rtnl_tab_t *rtnl_rtprot_tab; static void rtnl_rtprot_initialize(void) { - static const char *const init_tab[] = { + static const char *const init_tab[] ALIGN_PTR = { "none", "redirect", "kernel", diff --git a/networking/route.c b/networking/route.c index 4d9aad6..4901109 100644 --- a/networking/route.c +++ b/networking/route.c @@ -460,9 +460,9 @@ static NOINLINE void INET6_setroute(int action, char **args) #endif static const -IF_NOT_FEATURE_IPV6(uint16_t) -IF_FEATURE_IPV6(unsigned) -flagvals[] = { /* Must agree with flagchars[]. */ +IF_NOT_FEATURE_IPV6(uint16_t flagvals[] ALIGN2 = ) +IF_FEATURE_IPV6(uint32_t flagvals[] ALIGN4 = ) +{ /* Must agree with flagchars[]. */ RTF_UP, RTF_GATEWAY, RTF_HOST, diff --git a/networking/tls.c b/networking/tls.c index 3412252..e34acd6 100644 --- a/networking/tls.c +++ b/networking/tls.c @@ -1953,7 +1953,7 @@ static void send_client_key_exchange(tls_state_t *tls) premaster_size = sizeof(rsa_premaster); } else { /* ECDHE */ - static const uint8_t basepoint9[CURVE25519_KEYSIZE] = {9}; + static const uint8_t basepoint9[CURVE25519_KEYSIZE] ALIGN1 = {9}; uint8_t privkey[CURVE25519_KEYSIZE]; //[32] if (!(tls->flags & GOT_EC_KEY)) diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index acfdaa8..de16cf9 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c @@ -398,7 +398,7 @@ struct config_keyword { #define OFS(field) offsetof(struct server_data_t, field) -static const struct config_keyword keywords[] = { +static const struct config_keyword keywords[] ALIGN_PTR = { /* keyword handler variable address default */ {"start" , udhcp_str2nip , OFS(start_ip ), "192.168.0.20"}, {"end" , udhcp_str2nip , OFS(end_ip ), "192.168.0.254"}, diff --git a/procps/nmeter.c b/procps/nmeter.c index 856ce02..07b7abe 100644 --- a/procps/nmeter.c +++ b/procps/nmeter.c @@ -838,7 +838,7 @@ static void FAST_FUNC collect_info(s_stat *s) typedef s_stat* init_func(const char *param); static const char options[] ALIGN1 = "ncmsfixptTbr"; -static init_func *const init_functions[] = { +static init_func *const init_functions[] ALIGN_PTR = { init_if, init_cpu, init_mem, diff --git a/procps/ps.c b/procps/ps.c index 48f9620..711b180 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -375,7 +375,7 @@ static void func_pcpu(char *buf, int size, const procps_status_t *ps) } */ -static const ps_out_t out_spec[] = { +static const ps_out_t out_spec[] ALIGN_PTR = { /* Mandated by http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html: */ { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID }, { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID }, diff --git a/runit/svlogd.c b/runit/svlogd.c index a250058..040e711 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c @@ -775,7 +775,7 @@ static NOINLINE unsigned logdir_open(struct logdir *ld, const char *fn) ld->nmin = xatoi_positive(&s[1]); break; case 't': { - static const struct suffix_mult mh_suffixes[] = { + static const struct suffix_mult mh_suffixes[] ALIGN_SUFFIX = { { "m", 60 }, { "h", 60*60 }, /*{ "d", 24*60*60 },*/ diff --git a/shell/ash.c b/shell/ash.c index 8c9a590..40695de 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2091,7 +2091,7 @@ static const struct { int flags; const char *var_text; void (*var_func)(const char *) FAST_FUNC; -} varinit_data[] = { +} varinit_data[] ALIGN_PTR = { /* * Note: VEXPORT would not work correctly here for NOFORK applets: * some environment strings may be constant. @@ -4811,7 +4811,7 @@ static char *cmdnextc; static void cmdputs(const char *s) { - static const char vstype[VSTYPE + 1][3] = { + static const char vstype[VSTYPE + 1][3] ALIGN1 = { "", "}", "-", "+", "?", "=", "%", "%%", "#", "##" IF_BASH_SUBSTR(, ":") @@ -8510,7 +8510,7 @@ enum { , /* thus far 29 bits used */ }; -static const char *const tokname_array[] = { +static const char *const tokname_array[] ALIGN_PTR = { "end of file", "newline", "redirection", diff --git a/shell/hush.c b/shell/hush.c index f1a7e07..b6d9d7a 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -596,10 +596,10 @@ typedef struct in_str { /* The descrip member of this structure is only used to make * debugging output pretty */ static const struct { - int mode; + int32_t mode; signed char default_fd; char descrip[3]; -} redir_table[] = { +} redir_table[] ALIGN4 = { { O_RDONLY, 0, "<" }, { O_CREAT|O_TRUNC|O_WRONLY, 1, ">" }, { O_CREAT|O_APPEND|O_WRONLY, 1, ">>" }, @@ -1143,7 +1143,7 @@ struct built_in_command { #endif }; -static const struct built_in_command bltins1[] = { +static const struct built_in_command bltins1[] ALIGN_PTR = { BLTIN("." , builtin_source , "Run commands in file"), BLTIN(":" , builtin_true , NULL), #if ENABLE_HUSH_JOB @@ -1228,7 +1228,7 @@ static const struct built_in_command bltins1[] = { /* These builtins won't be used if we are on NOMMU and need to re-exec * (it's cheaper to run an external program in this case): */ -static const struct built_in_command bltins2[] = { +static const struct built_in_command bltins2[] ALIGN_PTR = { #if ENABLE_HUSH_TEST BLTIN("[" , builtin_test , NULL), #endif @@ -3895,7 +3895,7 @@ struct reserved_combo { char literal[6]; unsigned char res; unsigned char assignment_flag; - int flag; + uint32_t flag; }; enum { FLAG_END = (1 << RES_NONE ), @@ -3928,7 +3928,7 @@ static const struct reserved_combo* match_reserved_word(o_string *word) * to turn the compound list into a command. * FLAG_START means the word must start a new compound list. */ - static const struct reserved_combo reserved_list[] = { + static const struct reserved_combo reserved_list[] ALIGN4 = { # if ENABLE_HUSH_IF { "!", RES_NONE, NOT_ASSIGNMENT , 0 }, { "if", RES_IF, MAYBE_ASSIGNMENT, FLAG_THEN | FLAG_START }, diff --git a/shell/shell_common.c b/shell/shell_common.c index 42c4c9c..dcbe0d1 100644 --- a/shell/shell_common.c +++ b/shell/shell_common.c @@ -324,7 +324,7 @@ struct limits { uint8_t factor_shift; /* shift by to get rlim_{cur,max} values */ }; -static const struct limits limits_tbl[] = { +static const struct limits limits_tbl[] ALIGN2 = { { RLIMIT_CORE, 9, }, // -c { RLIMIT_DATA, 10, }, // -d { RLIMIT_NICE, 0, }, // -e diff --git a/util-linux/acpid.c b/util-linux/acpid.c index d473e24..00613f8 100644 --- a/util-linux/acpid.c +++ b/util-linux/acpid.c @@ -99,7 +99,7 @@ struct acpi_event { const char *desc; }; -static const struct acpi_event f_evt_tab[] = { +static const struct acpi_event f_evt_tab[] ALIGN_PTR = { { "EV_KEY", 0x01, "KEY_POWER", 116, 1, "button/power PWRF 00000080" }, { "EV_KEY", 0x01, "KEY_POWER", 116, 1, "button/power PWRB 00000080" }, { "EV_SW", 0x05, "SW_LID", 0x00, 1, "button/lid LID0 00000080" }, @@ -110,7 +110,7 @@ struct acpi_action { const char *action; }; -static const struct acpi_action f_act_tab[] = { +static const struct acpi_action f_act_tab[] ALIGN_PTR = { { "PWRF", "PWRF/00000080" }, { "LID0", "LID/00000080" }, }; diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 0b9a9a6..cc5413b 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -193,7 +193,7 @@ static const struct cmdoptions_t { const char name[9]; const unsigned char param_count; const unsigned char code; -} g_cmdoptions[] = { +} g_cmdoptions[] ALIGN1 = { /*"12345678" + NUL */ //TODO: convert to index_in_strings() { "fb" , 1, CMD_FB }, diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 0df3ebf..6454baa 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -303,7 +303,7 @@ static sector_t get_nr_sects(const struct partition *p); /* DOS partition types */ -static const char *const i386_sys_types[] = { +static const char *const i386_sys_types[] ALIGN_PTR = { "\x00" "Empty", "\x01" "FAT12", "\x04" "FAT16 <32M", diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c index 92180b2..765740f 100644 --- a/util-linux/fdisk_osf.c +++ b/util-linux/fdisk_osf.c @@ -144,7 +144,7 @@ struct xbsd_disklabel { #define BSD_DSTYPE_DOSPART(s) ((s) & 3) /* dos partition number */ #define BSD_DSTYPE_GEOMETRY 0x10 /* drive params in label */ -static const char *const xbsd_dktypenames[] = { +static const char *const xbsd_dktypenames[] ALIGN_PTR = { "unknown", "SMD", "MSCP", @@ -190,7 +190,7 @@ static const char *const xbsd_dktypenames[] = { #define BSD_FS_MSDOS 8 /* MS-DOS file system */ #endif -static const char *const xbsd_fstypes[] = { +static const char *const xbsd_fstypes[] ALIGN_PTR = { "\x00" "unused", /* BSD_FS_UNUSED */ "\x01" "swap", /* BSD_FS_SWAP */ "\x02" "Version 6", /* BSD_FS_V6 */ diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c index c90c801..acb438a 100644 --- a/util-linux/fdisk_sgi.c +++ b/util-linux/fdisk_sgi.c @@ -174,7 +174,7 @@ isinfreelist(unsigned int b) * end of free blocks section */ -static const char *const sgi_sys_types[] = { +static const char *const sgi_sys_types[] ALIGN_PTR = { /* SGI_VOLHDR */ "\x00" "SGI volhdr" , /* 0x01 */ "\x01" "SGI trkrepl" , /* 0x02 */ "\x02" "SGI secrepl" , diff --git a/util-linux/fdisk_sun.c b/util-linux/fdisk_sun.c index 29d7c28..427b948 100644 --- a/util-linux/fdisk_sun.c +++ b/util-linux/fdisk_sun.c @@ -61,7 +61,7 @@ guess_device_type(void) } } -static const char *const sun_sys_types[] = { +static const char *const sun_sys_types[] ALIGN_PTR = { "\x00" "Empty" , /* 0 */ "\x01" "Boot" , /* 1 */ "\x02" "SunOS root" , /* 2 */ @@ -133,7 +133,7 @@ static const struct sun_predefined_drives { unsigned short ntrks; unsigned short nsect; unsigned short rspeed; -} sun_drives[] = { +} sun_drives[] ALIGN_PTR = { { "Quantum","ProDrive 80S",1,832,2,834,6,34,3662}, { "Quantum","ProDrive 105S",1,974,2,1019,6,35,3662}, { "CDC","Wren IV 94171-344",3,1545,2,1549,9,46,3600}, diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c index 1f525d7..fcf374b 100644 --- a/util-linux/mkfs_ext2.c +++ b/util-linux/mkfs_ext2.c @@ -131,7 +131,7 @@ static void allocate(uint8_t *bitmap, uint32_t blocksize, uint32_t start, uint32 static uint32_t has_super(uint32_t x) { // 0, 1 and powers of 3, 5, 7 up to 2^32 limit - static const uint32_t supers[] = { + static const uint32_t supers[] ALIGN4 = { 0, 1, 3, 5, 7, 9, 25, 27, 49, 81, 125, 243, 343, 625, 729, 2187, 2401, 3125, 6561, 15625, 16807, 19683, 59049, 78125, 117649, 177147, 390625, 531441, 823543, 1594323, 1953125, diff --git a/util-linux/mount.c b/util-linux/mount.c index fc5161d..aa38847 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -323,7 +323,7 @@ enum { // Standard mount options (from -o options or --options), // with corresponding flags -static const int32_t mount_options[] = { +static const int32_t mount_options[] ALIGN4 = { // MS_FLAGS set a bit. ~MS_FLAGS disable that bit. 0 flags are NOPs. IF_FEATURE_MOUNT_LOOP( diff --git a/util-linux/volume_id/volume_id.c b/util-linux/volume_id/volume_id.c index 99150a5..8ceb61b 100644 --- a/util-linux/volume_id/volume_id.c +++ b/util-linux/volume_id/volume_id.c @@ -49,7 +49,7 @@ typedef int FAST_FUNC (*raid_probe_fptr)(struct volume_id *id, /*uint64_t off,*/ uint64_t size); typedef int FAST_FUNC (*probe_fptr)(struct volume_id *id /*, uint64_t off*/); -static const raid_probe_fptr raid1[] = { +static const raid_probe_fptr raid1[] ALIGN_PTR = { #if ENABLE_FEATURE_VOLUMEID_LINUXRAID volume_id_probe_linux_raid, #endif @@ -76,7 +76,7 @@ static const raid_probe_fptr raid1[] = { #endif }; -static const probe_fptr raid2[] = { +static const probe_fptr raid2[] ALIGN_PTR = { #if ENABLE_FEATURE_VOLUMEID_LVM volume_id_probe_lvm1, volume_id_probe_lvm2, @@ -90,7 +90,7 @@ static const probe_fptr raid2[] = { }; /* signature in the first block, only small buffer needed */ -static const probe_fptr fs1[] = { +static const probe_fptr fs1[] ALIGN_PTR = { #if ENABLE_FEATURE_VOLUMEID_FAT volume_id_probe_vfat, #endif @@ -118,7 +118,7 @@ static const probe_fptr fs1[] = { }; /* fill buffer with maximum */ -static const probe_fptr fs2[] = { +static const probe_fptr fs2[] ALIGN_PTR = { #if ENABLE_FEATURE_VOLUMEID_LINUXSWAP volume_id_probe_linux_swap, #endif -- cgit v1.1