This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Remove force_minimum_alignment and force_minimum_alignment
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sources dot redhat dot com
- Date: Fri, 17 Apr 2009 15:19:20 -0700
- Subject: PATCH: Remove force_minimum_alignment and force_minimum_alignment
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Since EFI targets are removed, we don't need force_minimum_alignment nor
force_minimum_alignment anymore. This patch removes them. Also page size
on Windows ia64 is 8K, not 4K:
http://blogs.msdn.com/oldnewthing/archive/2004/09/08/226797.aspx
Also we can't set D_PAGED, which is set by
/* FIXME: How can we set D_PAGED correctly? */
if ((internal_f->f_flags & F_EXEC) != 0)
abfd->flags |= D_PAGED;
in coff_real_object_p, on a PEI target if PE section alignment is
smaller than COFF_PAGE_SIZE. This patch also fixes it so that the
section is layout correctly when
--file-alignment=0x20 --section-alignment=0x20
is used with objcopy. OK to install?
Thanks.
H.J.
---
2009-04-17 H.J. Lu <hongjiu.lu@intel.com>
* coff-ia64.c (COFF_PAGE_SIZE): Changed to 8K.
* coffcode.h (coff_compute_section_file_positions): Clear
D_PAGED if PE section alignment is smaller than COFF_PAGE_SIZE.
* libcoff-in.h (pe_tdata): Remove force_minimum_alignment and
force_minimum_alignment.
* libcoff.h: Regenerated.
* peicode.h (pe_mkobject): Don't set force_minimum_alignment
nor target_subsystem.
* peXXigen.c (_bfd_XXi_swap_aouthdr_out): Don't check
force_minimum_alignment nor target_subsystem.
Index: coff-ia64.c
===================================================================
--- coff-ia64.c (revision 5732)
+++ coff-ia64.c (working copy)
@@ -29,9 +29,9 @@
#include "libcoff.h"
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
-/* The page size is a guess based on ELF. */
-#define COFF_PAGE_SIZE 0x1000
+/* Windows ia64 uses 8K page size. */
+#define COFF_PAGE_SIZE 0x2000
static reloc_howto_type howto_table[] =
{
Index: peicode.h
===================================================================
--- peicode.h (revision 5732)
+++ peicode.h (working copy)
@@ -264,13 +264,6 @@ pe_mkobject (bfd * abfd)
/* in_reloc_p is architecture dependent. */
pe->in_reloc_p = in_reloc_p;
-#ifdef PEI_FORCE_MINIMUM_ALIGNMENT
- pe->force_minimum_alignment = 1;
-#endif
-#ifdef PEI_TARGET_SUBSYSTEM
- pe->target_subsystem = PEI_TARGET_SUBSYSTEM;
-#endif
-
return TRUE;
}
Index: libcoff.h
===================================================================
--- libcoff.h (revision 5732)
+++ libcoff.h (working copy)
@@ -121,8 +121,6 @@ typedef struct pe_tdata
int has_reloc_section;
bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
flagword real_flags;
- int target_subsystem;
- bfd_boolean force_minimum_alignment;
} pe_data_type;
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
Index: coffcode.h
===================================================================
--- coffcode.h (revision 5732)
+++ coffcode.h (working copy)
@@ -3186,6 +3186,13 @@ coff_compute_section_file_positions (bfd
int target_index;
bfd_size_type amt;
+#ifdef COFF_PAGE_SIZE
+ /* Clear D_PAGED if section alignment is smaller than
+ COFF_PAGE_SIZE. */
+ if (pe_data (abfd)->pe_opthdr.SectionAlignment < COFF_PAGE_SIZE)
+ abfd->flags &= ~D_PAGED;
+#endif
+
count = 0;
for (current = abfd->sections; current != NULL; current = current->next)
++count;
Index: libcoff-in.h
===================================================================
--- libcoff-in.h (revision 5732)
+++ libcoff-in.h (working copy)
@@ -117,8 +117,6 @@ typedef struct pe_tdata
int has_reloc_section;
bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
flagword real_flags;
- int target_subsystem;
- bfd_boolean force_minimum_alignment;
} pe_data_type;
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
Index: peXXigen.c
===================================================================
--- peXXigen.c (revision 5733)
+++ peXXigen.c (working copy)
@@ -540,17 +540,6 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, v
bfd_vma sa, fa, ib;
IMAGE_DATA_DIRECTORY idata2, idata5, tls;
- if (pe->force_minimum_alignment)
- {
- if (!extra->FileAlignment)
- extra->FileAlignment = PE_DEF_FILE_ALIGNMENT;
- if (!extra->SectionAlignment)
- extra->SectionAlignment = PE_DEF_SECTION_ALIGNMENT;
- }
-
- if (extra->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
- extra->Subsystem = pe->target_subsystem;
-
sa = extra->SectionAlignment;
fa = extra->FileAlignment;
ib = extra->ImageBase;