aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2013-12-02 14:30:32 +0100
committerTristan Gingold <tristan.gingold@adacore.com>2014-03-13 09:33:07 +0100
commit167ad85bf06582759e8dfe021aac9da79b81340d (patch)
treeca992034e6e0a0475963e057eb3044a90d1a5f6a /gas
parent5e3a2c38d793123e32547f165f18b362438ce603 (diff)
downloadgdb-167ad85bf06582759e8dfe021aac9da79b81340d.zip
gdb-167ad85bf06582759e8dfe021aac9da79b81340d.tar.gz
gdb-167ad85bf06582759e8dfe021aac9da79b81340d.tar.bz2
Add pe/x86_64 bigobj file format.
bfd/ * peicode.h (pe_ILF_object_p): Adjust, as the version number has been read. (pe_bfd_object_p): Also read version number to detect ILF. * pe-x86_64.c (COFF_WITH_PE_BIGOBJ): Define. (x86_64pe_bigobj_vec): Define * coffcode.h (bfd_coff_backend_data): Add _bfd_coff_max_nscns field. (bfd_coff_max_nscns): New macro. (coff_compute_section_file_positions): Use unsigned int for target_index. Compare with bfd_coff_max_nscns. (bfd_coff_std_swap_table, ticoff0_swap_table, ticoff1_swap_table): Set a value for _bfd_coff_max_nscns. (header_bigobj_classid): New constant. (coff_bigobj_swap_filehdr_in, coff_bigobj_swap_filehdr_out) (coff_bigobj_swap_sym_in, coff_bigobj_swap_sym_out) (coff_bigobj_swap_aux_in, coff_bigobj_swap_aux_out): New functions. (bigobj_swap_table): New table. * libcoff.h: Regenerate. * coff-sh.c (bfd_coff_small_swap_table): Likewise. * coff-alpha.c (alpha_ecoff_backend_data): Add value for _bfd_coff_max_nscns. * coff-mips.c (mips_ecoff_backend_data): Likewise. * coff-rs6000.c (bfd_xcoff_backend_data) (bfd_pmac_xcoff_backend_data): Likewise. * coff64-rs6000.c (bfd_xcoff_backend_data) (bfd_xcoff_aix5_backend_data): Likewise. * targets.c (x86_64pe_bigobj_vec): Declare. * configure.in (x86_64pe_bigobj_vec): New vector. * configure: Regenerate. * config.bfd: Add bigobj object format for Windows targets. gas/ * config/tc-i386.c (use_big_obj): Declare. (OPTION_MBIG_OBJ): Define. (md_longopts): Add -mbig-obj option. (md_parse_option): Handle it. (md_show_usage): Display help for this option. (i386_target_format): Use bigobj for x86-64 if -mbig-obj. * doc/c-i386.texi: Document the option. gas/testsuite/ * gas/pe/big-obj.d, gas/pe/big-obj.s: Add test. * gas/pe/pe.exp: Add test. include/coff/ * pe.h (struct external_ANON_OBJECT_HEADER_BIGOBJ): Declare. (FILHSZ_BIGOBJ): Define. (struct external_SYMBOL_EX): Declare. (SYMENT_BIGOBJ, SYMESZ_BIGOBJ): Define. (union external_AUX_SYMBOL_EX): Declare. (AUXENT_BIGOBJ, AUXESZ_BIGOBJ): Define. * internal.h (struct internal_filehdr): Change type of f_nscns.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/config/tc-i386.c24
-rw-r--r--gas/doc/c-i386.texi5
-rw-r--r--gas/testsuite/ChangeLog5
-rw-r--r--gas/testsuite/gas/pe/big-obj.d11
-rw-r--r--gas/testsuite/gas/pe/big-obj.s16
-rw-r--r--gas/testsuite/gas/pe/pe.exp8
7 files changed, 78 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 6851b8c..ab4036f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+2014-03-13 Tristan Gingold <gingold@adacore.com>
+
+ * config/tc-i386.c (use_big_obj): Declare.
+ (OPTION_MBIG_OBJ): Define.
+ (md_longopts): Add -mbig-obj option.
+ (md_parse_option): Handle it.
+ (md_show_usage): Display help for this option.
+ (i386_target_format): Use bigobj for x86-64 if -mbig-obj.
+ * doc/c-i386.texi: Document the option.
+
2014-03-12 Nick Clifton <nickc@redhat.com>
PR gas/16688
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index f6283a6..734935a 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -513,6 +513,11 @@ enum x86_elf_abi
static enum x86_elf_abi x86_elf_abi = I386_ABI;
#endif
+#if defined (TE_PE) || defined (TE_PEP)
+/* Use big object file format. */
+static int use_big_obj = 0;
+#endif
+
/* 1 for intel syntax,
0 if att syntax. */
static int intel_syntax = 0;
@@ -9497,6 +9502,7 @@ const char *md_shortopts = "qn";
#define OPTION_MADD_BND_PREFIX (OPTION_MD_BASE + 15)
#define OPTION_MEVEXLIG (OPTION_MD_BASE + 16)
#define OPTION_MEVEXWIG (OPTION_MD_BASE + 17)
+#define OPTION_MBIG_OBJ (OPTION_MD_BASE + 18)
struct option md_longopts[] =
{
@@ -9523,6 +9529,9 @@ struct option md_longopts[] =
{"madd-bnd-prefix", no_argument, NULL, OPTION_MADD_BND_PREFIX},
{"mevexlig", required_argument, NULL, OPTION_MEVEXLIG},
{"mevexwig", required_argument, NULL, OPTION_MEVEXWIG},
+# if defined (TE_PE) || defined (TE_PEP)
+ {"mbig-obj", no_argument, NULL, OPTION_MBIG_OBJ},
+#endif
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
@@ -9804,6 +9813,12 @@ md_parse_option (int c, char *arg)
as_fatal (_("invalid -mevexwig= option: `%s'"), arg);
break;
+# if defined (TE_PE) || defined (TE_PEP)
+ case OPTION_MBIG_OBJ:
+ use_big_obj = 1;
+ break;
+#endif
+
default:
return 0;
}
@@ -9956,6 +9971,10 @@ md_show_usage (FILE *stream)
-mold-gcc support old (<= 2.8.1) versions of gcc\n"));
fprintf (stream, _("\
-madd-bnd-prefix add BND prefix for all valid branches\n"));
+# if defined (TE_PE) || defined (TE_PEP)
+ fprintf (stream, _("\
+ -mbig-obj generate big object files\n"));
+#endif
}
#if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
@@ -9994,7 +10013,10 @@ i386_target_format (void)
#if defined (OBJ_MAYBE_COFF) || defined (OBJ_COFF)
# if defined (TE_PE) || defined (TE_PEP)
case bfd_target_coff_flavour:
- return flag_code == CODE_64BIT ? "pe-x86-64" : "pe-i386";
+ if (flag_code == CODE_64BIT)
+ return use_big_obj ? "pe-bigobj-x86-64" : "pe-x86-64";
+ else
+ return "pe-i386";
# elif defined (TE_GO32)
case bfd_target_coff_flavour:
return "coff-go32";
diff --git a/gas/doc/c-i386.texi b/gas/doc/c-i386.texi
index 18bd96a..1952cee 100644
--- a/gas/doc/c-i386.texi
+++ b/gas/doc/c-i386.texi
@@ -283,6 +283,11 @@ The @code{.att_syntax} and @code{.intel_syntax} directives will take precedent.
This option forces the assembler to add BND prefix to all branches, even
if such prefix was not explicitly specified in the source code.
+@cindex @samp{-mbig-obj} option, x86-64
+@item -mbig-obj
+On x86-64 PE/COFF target this option forces the use of big object file
+format, which allows more than 32768 sections.
+
@end table
@c man end
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 9e87cc0..161d49e 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-13 Tristan Gingold <gingold@adacore.com>
+
+ * gas/pe/big-obj.d, gas/pe/big-obj.s: Add test.
+ * gas/pe/pe.exp: Add test.
+
2014-03-12 Nick Clifton <nickc@redhat.com>
PR gas/16688
diff --git a/gas/testsuite/gas/pe/big-obj.d b/gas/testsuite/gas/pe/big-obj.d
new file mode 100644
index 0000000..95ff1d8
--- /dev/null
+++ b/gas/testsuite/gas/pe/big-obj.d
@@ -0,0 +1,11 @@
+#as: -mbig-obj
+#objdump: -h
+#name: PE x64 big obj
+
+.*: *file format pe-bigobj-.*
+
+Sections:
+#...
+5000. \.data\$a49999 .*
+ CONTENTS, ALLOC, LOAD, DATA
+
diff --git a/gas/testsuite/gas/pe/big-obj.s b/gas/testsuite/gas/pe/big-obj.s
new file mode 100644
index 0000000..07edc91
--- /dev/null
+++ b/gas/testsuite/gas/pe/big-obj.s
@@ -0,0 +1,16 @@
+ .file "big-obj.s"
+
+ .irp n,0,1,2,3,4
+ .irp m,0,1,2,3,4,5,6,7,8,9
+ .irp c,0,1,2,3,4,5,6,7,8,9
+ .irp d,0,1,2,3,4,5,6,7,8,9
+ .irp u,0,1,2,3,4,5,6,7,8,9
+ .globl a\n\m\c\d\u
+ .section .data$a\n\m\c\d\u,"w"
+a\n\m\c\d\u :
+ .byte 1
+ .endr
+ .endr
+ .endr
+ .endr
+ .endr
diff --git a/gas/testsuite/gas/pe/pe.exp b/gas/testsuite/gas/pe/pe.exp
index 0b70ee6..c1c5f49 100644
--- a/gas/testsuite/gas/pe/pe.exp
+++ b/gas/testsuite/gas/pe/pe.exp
@@ -48,3 +48,11 @@ if ([istarget "x86_64-*-mingw*"]) then {
run_dump_test "peseh-x64-5"
run_dump_test "peseh-x64-6"
}
+
+# Big obj
+
+
+if ([istarget "x86_64-*-mingw*"]) then {
+ # Currently only supported on x86_64
+ run_dump_test "big-obj"
+}