From 09e967c2d732783b2579e4e120cd9b608404cb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 4 Jun 2003 18:31:57 +0000 Subject: Merge from R9_0-AMD64, most notably: - AMD64 support to insmod-busybox, minilibc, et al. - Sync with insmod-modutils 2.4.19 something but everyone should use dietlibc nowadays - Factor out compilation and prefix with $(DIET) for dietlibc builds - 64-bit & varargs fixes --- mdk-stage1/insmod-modutils/obj/obj_common.c | 41 ++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'mdk-stage1/insmod-modutils/obj/obj_common.c') diff --git a/mdk-stage1/insmod-modutils/obj/obj_common.c b/mdk-stage1/insmod-modutils/obj/obj_common.c index 2a6606c94..a957ff1be 100644 --- a/mdk-stage1/insmod-modutils/obj/obj_common.c +++ b/mdk-stage1/insmod-modutils/obj/obj_common.c @@ -19,11 +19,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ident "$Id$" - #include #include #include +#include #include #include @@ -229,6 +228,14 @@ obj_find_section (struct obj_file *f, const char *name) return NULL; } +#if defined (ARCH_alpha) +#define ARCH_SHF_SHORT SHF_ALPHA_GPREL +#elif defined (ARCH_ia64) +#define ARCH_SHF_SHORT SHF_IA_64_SHORT +#else +#define ARCH_SHF_SHORT 0 +#endif + static int obj_load_order_prio(struct obj_section *a) { @@ -237,15 +244,24 @@ obj_load_order_prio(struct obj_section *a) af = a->header.sh_flags; ac = 0; - if (a->name[0] != '.' || strlen(a->name) != 10 || - strcmp(a->name + 5, ".init")) ac |= 32; - if (af & SHF_ALLOC) ac |= 16; + if (a->name[0] != '.' + || strlen(a->name) != 10 + || strcmp(a->name + 5, ".init")) + ac |= 64; + if (af & SHF_ALLOC) ac |= 32; + if (af & SHF_EXECINSTR) ac |= 16; if (!(af & SHF_WRITE)) ac |= 8; - if (af & SHF_EXECINSTR) ac |= 4; - if (a->header.sh_type != SHT_NOBITS) ac |= 2; -#if defined(ARCH_ia64) - if (af & SHF_IA_64_SHORT) ac -= 1; -#endif + if (a->header.sh_type != SHT_NOBITS) ac |= 4; + /* Desired order is + P S AC & 7 + .data 1 0 4 + .got 1 1 3 + .sdata 1 1 1 + .sbss 0 1 1 + .bss 0 0 0 */ + if (strcmp (a->name, ".got") == 0) ac |= 2; + if (af & ARCH_SHF_SHORT) + ac = (ac & ~4) | 1; return ac; } @@ -264,7 +280,8 @@ obj_insert_section_load_order (struct obj_file *f, struct obj_section *sec) struct obj_section * obj_create_alloced_section (struct obj_file *f, const char *name, - unsigned long align, unsigned long size) + unsigned long align, unsigned long size, + unsigned long flags) { int newidx = f->header.e_shnum++; struct obj_section *sec; @@ -274,7 +291,7 @@ obj_create_alloced_section (struct obj_file *f, const char *name, memset(sec, 0, sizeof(*sec)); sec->header.sh_type = SHT_PROGBITS; - sec->header.sh_flags = SHF_WRITE|SHF_ALLOC; + sec->header.sh_flags = flags | SHF_ALLOC; sec->header.sh_size = size; sec->header.sh_addralign = align; sec->name = name; -- cgit v1.2.1