diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2018-10-25 16:41:39 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2018-10-25 16:41:39 +0000 |
commit | fa62b0aefb2b5fe105e25eb8cdf1b39306df5212 (patch) | |
tree | cf1cbb924a469f8895581c2a532a56ff3d1fef67 /libexec/ld.so | |
parent | 216fbb53067c8e910c8fb04d387ca5b45600039a (diff) |
The compilers already put static arrays in .rodata when not written to;
marking them const will keep a source change from silently moving them
back to .data
ok deraadt@ kettenis@
Diffstat (limited to 'libexec/ld.so')
-rw-r--r-- | libexec/ld.so/aarch64/rtld_machine.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/amd64/rtld_machine.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/arm/rtld_machine.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/i386/rtld_machine.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/sh/rtld_machine.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/sparc64/rtld_machine.c | 6 |
6 files changed, 18 insertions, 18 deletions
diff --git a/libexec/ld.so/aarch64/rtld_machine.c b/libexec/ld.so/aarch64/rtld_machine.c index c7c666381c7..cfd3f474d7f 100644 --- a/libexec/ld.so/aarch64/rtld_machine.c +++ b/libexec/ld.so/aarch64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.5 2017/12/21 00:32:55 kettenis Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.6 2018/10/25 16:41:38 guenther Exp $ */ /* * Copyright (c) 2004 Dale Rahn @@ -53,7 +53,7 @@ Elf_Addr _dl_bind(elf_object_t *object, int index); #define _RF_V 0x02000000 /* ERROR */ #define _RF_SZ(s) (((s) & 0xff) << 8) /* memory target size */ #define _RF_RS(s) ((s) & 0xff) /* right shift */ -static int reloc_target_flags[] = { +static const int reloc_target_flags[] = { [ R_AARCH64_NONE ] = 0, [ R_AARCH64_ABS64 ] = _RF_V|_RF_S|_RF_A| _RF_SZ(64) | _RF_RS(0), /* ABS64 */ @@ -79,7 +79,7 @@ static int reloc_target_flags[] = { #define RELOC_USE_ADDEND(t) ((reloc_target_flags[t] & _RF_A) != 0) #define RELOC_TARGET_SIZE(t) ((reloc_target_flags[t] >> 8) & 0xff) #define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] & 0xff) -static Elf_Addr reloc_target_bitmask[] = { +static const Elf_Addr reloc_target_bitmask[] = { #define _BM(x) (~(Elf_Addr)0 >> ((8*sizeof(reloc_target_bitmask[0])) - (x))) [ R_AARCH64_NONE ] = 0, [ R_AARCH64_ABS64 ] = _BM(64), diff --git a/libexec/ld.so/amd64/rtld_machine.c b/libexec/ld.so/amd64/rtld_machine.c index 7e6c65ed80b..dd14f4b6b66 100644 --- a/libexec/ld.so/amd64/rtld_machine.c +++ b/libexec/ld.so/amd64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.28 2017/01/24 07:48:37 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.29 2018/10/25 16:41:38 guenther Exp $ */ /* * Copyright (c) 2002,2004 Dale Rahn @@ -101,7 +101,7 @@ int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; #define _RF_E 0x02000000 /* ERROR */ #define _RF_SZ(s) (((s) & 0xff) << 8) /* memory target size */ #define _RF_RS(s) ((s) & 0xff) /* right shift */ -static int reloc_target_flags[] = { +static const int reloc_target_flags[] = { 0, /* 0 NONE */ _RF_S|_RF_A| _RF_SZ(64) | _RF_RS(0), /* 1 _64*/ _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(0), /* 2 PC32 */ @@ -136,7 +136,7 @@ static int reloc_target_flags[] = { #define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] & 0xff) #define RELOC_ERROR(t) (reloc_target_flags[t] & _RF_E) -static Elf_Addr reloc_target_bitmask[] = { +static const Elf_Addr reloc_target_bitmask[] = { #define _BM(x) (~(Elf_Addr)0 >> ((8*sizeof(reloc_target_bitmask[0])) - (x))) 0, /* 0 NONE */ _BM(64), /* 1 _64*/ diff --git a/libexec/ld.so/arm/rtld_machine.c b/libexec/ld.so/arm/rtld_machine.c index 11996b15211..e4fbea70ebc 100644 --- a/libexec/ld.so/arm/rtld_machine.c +++ b/libexec/ld.so/arm/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.26 2017/11/15 22:08:04 kettenis Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.27 2018/10/25 16:41:38 guenther Exp $ */ /* * Copyright (c) 2004 Dale Rahn @@ -53,7 +53,7 @@ Elf_Addr _dl_bind(elf_object_t *object, int reloff); #define _RF_E 0x02000000 /* ERROR */ #define _RF_SZ(s) (((s) & 0xff) << 8) /* memory target size */ #define _RF_RS(s) ((s) & 0xff) /* right shift */ -static int reloc_target_flags[] = { +static const int reloc_target_flags[] = { 0, /* 0 NONE */ _RF_S|_RF_P|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 1 PC24 */ _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 2 ABS32 */ @@ -107,7 +107,7 @@ static int reloc_target_flags[] = { #define RELOC_TARGET_SIZE(t) ((reloc_target_flags[t] >> 8) & 0xff) #define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] & 0xff) -static long reloc_target_bitmask[] = { +static const long reloc_target_bitmask[] = { #define _BM(x) (~(-(1ULL << (x)))) _BM(0), /* 0 NONE */ _BM(24), /* 1 PC24 */ diff --git a/libexec/ld.so/i386/rtld_machine.c b/libexec/ld.so/i386/rtld_machine.c index 4390b0d7ce9..a420f670114 100644 --- a/libexec/ld.so/i386/rtld_machine.c +++ b/libexec/ld.so/i386/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.37 2017/06/04 14:20:12 naddy Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.38 2018/10/25 16:41:38 guenther Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -101,7 +101,7 @@ int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; #define _RF_U 0x04000000 /* Unaligned */ #define _RF_SZ(s) (((s) & 0xff) << 8) /* memory target size */ #define _RF_RS(s) ((s) & 0xff) /* right shift */ -static int reloc_target_flags[] = { +static const int reloc_target_flags[] = { 0, /* NONE */ _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* RELOC_32*/ _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(0), /* PC32 */ @@ -136,7 +136,7 @@ static int reloc_target_flags[] = { #define RELOC_TARGET_SIZE(t) ((reloc_target_flags[t] >> 8) & 0xff) #define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] & 0xff) -static long reloc_target_bitmask[] = { +static const long reloc_target_bitmask[] = { #define _BM(x) (~(-(1ULL << (x)))) 0, /* NONE */ _BM(32), /* RELOC_32*/ diff --git a/libexec/ld.so/sh/rtld_machine.c b/libexec/ld.so/sh/rtld_machine.c index 73e1c318631..bf13720dffb 100644 --- a/libexec/ld.so/sh/rtld_machine.c +++ b/libexec/ld.so/sh/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.25 2017/01/24 07:48:37 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.26 2018/10/25 16:41:38 guenther Exp $ */ /* * Copyright (c) 2004 Dale Rahn @@ -54,7 +54,7 @@ Elf_Addr _dl_bind(elf_object_t *object, int reloff); #define _RF_E 0x02000000 /* ERROR */ #define _RF_SZ(s) (((s) & 0xff) << 8) /* memory target size */ #define _RF_RS(s) ((s) & 0xff) /* right shift */ -static int reloc_target_flags[] = { +static const int reloc_target_flags[] = { 0, /* 0 R_SH_NONE */ _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 1 R_SH_DIR32 */ _RF_S|_RF_P|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 2 REL32 */ @@ -323,7 +323,7 @@ static int reloc_target_flags[] = { #define RELOC_USE_ADDEND(t) ((reloc_target_flags[t] & _RF_A) != 0) #define RELOC_TARGET_SIZE(t) ((reloc_target_flags[t] >> 8) & 0xff) #define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] & 0xff) -static int reloc_target_bitmask[] = { +static const int reloc_target_bitmask[] = { #define _BM(x) (x == 32? ~0 : ~(-(1UL << (x)))) _BM(0), /* 0 R_SH_NONE */ _BM(32), /* 1 R_SH_DIR32 */ diff --git a/libexec/ld.so/sparc64/rtld_machine.c b/libexec/ld.so/sparc64/rtld_machine.c index 641f2f6f305..02a4ba2c9c3 100644 --- a/libexec/ld.so/sparc64/rtld_machine.c +++ b/libexec/ld.so/sparc64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.61 2017/10/10 04:49:10 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.62 2018/10/25 16:41:38 guenther Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -102,7 +102,7 @@ int64_t pcookie __attribute__((section(".openbsd.randomdata"))) __dso_hidden; #define _RF_U 0x04000000 /* Unaligned */ #define _RF_SZ(s) (((s) & 0xff) << 8) /* memory target size */ #define _RF_RS(s) ((s) & 0xff) /* right shift */ -static int reloc_target_flags[] = { +static const int reloc_target_flags[] = { 0, /* NONE */ _RF_S|_RF_A| _RF_SZ(8) | _RF_RS(0), /* RELOC_8 */ _RF_S|_RF_A| _RF_SZ(16) | _RF_RS(0), /* RELOC_16 */ @@ -170,7 +170,7 @@ static int reloc_target_flags[] = { #define RELOC_TARGET_SIZE(t) ((reloc_target_flags[t] >> 8) & 0xff) #define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] & 0xff) -static long reloc_target_bitmask[] = { +static const long reloc_target_bitmask[] = { #define _BM(x) (~(-(1ULL << (x)))) 0, /* NONE */ _BM(8), _BM(16), _BM(32), /* RELOC_8, _16, _32 */ |