aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffcode.h
diff options
context:
space:
mode:
authorKim Knuttila <krk@cygnus>1995-11-07 21:33:33 +0000
committerKim Knuttila <krk@cygnus>1995-11-07 21:33:33 +0000
commitd6f41a7d3e56c2b8467f39cd05283649050c09cc (patch)
tree68c2ee8680919e672e72ac7a80fbcc83b107abb7 /bfd/coffcode.h
parentccb98a5afde747f75e0bb24f735be0309f770aff (diff)
downloadgdb-d6f41a7d3e56c2b8467f39cd05283649050c09cc.zip
gdb-d6f41a7d3e56c2b8467f39cd05283649050c09cc.tar.gz
gdb-d6f41a7d3e56c2b8467f39cd05283649050c09cc.tar.bz2
First round ld support for PPC PE
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r--bfd/coffcode.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 2cc3980..6c3eab4 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -928,6 +928,40 @@ coff_set_alignment_hook (abfd, section, scnhdr)
section->alignment_power = i;
}
+#elif defined(COFF_WITH_PE)
+
+/* a couple of macros to help setting the alignment power field */
+#define ALIGN_SET(field,x,y) \
+ if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x )\
+ {\
+ section->alignment_power = y;\
+ }
+
+#define ELIFALIGN_SET(field,x,y) \
+ else if (( (field) & IMAGE_SCN_ALIGN_64BYTES) == x ) \
+ {\
+ section->alignment_power = y;\
+ }
+
+static void
+coff_set_alignment_hook (abfd, section, scnhdr)
+ bfd * abfd;
+ asection * section;
+ PTR scnhdr;
+{
+ struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
+
+ ALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_64BYTES, 6)
+ ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_32BYTES, 5)
+ ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_16BYTES, 4)
+ ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_8BYTES, 3)
+ ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_4BYTES, 2)
+ ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_2BYTES, 1)
+ ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_1BYTES, 0)
+}
+#undef ALIGN_SET
+#undef ELIFALIGN_SET
+
#else /* ! I960 */
#define coff_set_alignment_hook \
@@ -953,6 +987,8 @@ coff_mkobject (abfd)
coff->conversion_table = (unsigned int *) NULL;
coff->raw_syments = (struct coff_ptr_struct *) NULL;
coff->relocbase = 0;
+ coff->local_toc_sym_map = 0;
+
/* make_abs_section(abfd);*/
return true;
@@ -2176,6 +2212,7 @@ coff_write_object_contents (abfd)
if (abfd->flags & EXEC_P)
internal_f.f_flags |= F_EXEC;
+ /* FIXME: this is wrong for PPC_PE! */
if (!abfd->xvec->byteorder_big_p)
internal_f.f_flags |= F_AR32WR;
else
@@ -2254,7 +2291,7 @@ coff_write_object_contents (abfd)
#endif
#if defined(PPC)
#define __A_MAGIC_SET__
- internal_a.magic = PPCMAGIC;
+ internal_a.magic = IMAGE_NT_OPTIONAL_HDR_MAGIC;
#endif
#if defined(I386)
#define __A_MAGIC_SET__