diff options
author | Mystery Man <unknown@mandriva.org> | 2003-10-29 16:07:11 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2003-10-29 16:07:11 +0000 |
commit | fa40f30b4253b1e05c46cc5e0c111176825b7623 (patch) | |
tree | 76cf2d26c0ce0ee7c6a2c1a1a2b65bc4d8e33029 /mdk-stage1/insmod-modutils/obj/obj_common.c | |
parent | 327bd24f8e4291bd1882de1990dd7339f781a9cb (diff) | |
download | drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.tar drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.tar.gz drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.tar.bz2 drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.tar.xz drakx-fa40f30b4253b1e05c46cc5e0c111176825b7623.zip |
This commit was manufactured by cvs2svn to create tag 'Corpo_2_1_1'.Corpo_2_1_1
Diffstat (limited to 'mdk-stage1/insmod-modutils/obj/obj_common.c')
-rw-r--r-- | mdk-stage1/insmod-modutils/obj/obj_common.c | 41 |
1 files changed, 29 insertions, 12 deletions
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 <stdlib.h> #include <string.h> #include <assert.h> +#include <alloca.h> #include <obj.h> #include <util.h> @@ -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; |