This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] Variable page size support for MIPS/ELF
- From: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- To: binutils at sources dot redhat dot com
- Cc: Ralf Baechle <ralf at linux-mips dot org>
- Date: Tue, 23 Dec 2003 12:05:00 +0100 (CET)
- Subject: [patch] Variable page size support for MIPS/ELF
- Organization: Technical University of Gdansk
Hello,
The SVR4 MIPS ABI Supplement states page sizes of up to 64kB are
supported. But BFD currently uses 4kB, with a note that's compatible to
Irix 5. As support for a configurable page size of up to 64kB has been
recently added to Linux, that compatibility setting is no longer valid.
Here is a patch that changes the page size for traditional MIPS/ELF
targets while retaining Irix 5 compatibility. I've tested both targets
and the appropriate setting is respected. There is no compatibility
problem with the new setting for traditional targets -- old objects
continue to work for linking and new executables or shared objects are
created with the new setting.
2003-12-23 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* elf32-mips.c (ELF_MAXPAGESIZE): Redefine for traditional
targets to support pages of up to 64kB.
(elf32_bed): Redefine to get a separate backend data structure for
traditional targets.
* elf64-mips.c (ELF_MAXPAGESIZE): Redefine for traditional
targets to support pages of up to 64kB.
(elf64_bed): Redefine to get a separate backend data structure for
traditional targets.
* elfn32-mips.c (ELF_MAXPAGESIZE): Redefine for traditional
targets to support pages of up to 64kB.
(elf32_bed): Redefine to get a separate backend data structure for
traditional targets.
OK to apply?
Maciej
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
binutils-2.14.90-20031222-mips-pagesize.patch
diff -up --recursive --new-file binutils-2.14.90-20031222.macro/bfd/elf32-mips.c binutils-2.14.90-20031222/bfd/elf32-mips.c
--- binutils-2.14.90-20031222.macro/bfd/elf32-mips.c 2003-12-19 04:25:22.000000000 +0000
+++ binutils-2.14.90-20031222/bfd/elf32-mips.c 2003-12-23 09:38:01.000000000 +0000
@@ -1513,10 +1513,6 @@ static const struct ecoff_debug_swap mip
#define ELF_ARCH bfd_arch_mips
#define ELF_MACHINE_CODE EM_MIPS
-/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
- a value of 0x1000, and we are compatible. */
-#define ELF_MAXPAGESIZE 0x1000
-
#define elf_backend_collect TRUE
#define elf_backend_type_change_ok TRUE
#define elf_backend_can_gc_sections TRUE
@@ -1594,20 +1590,29 @@ static const struct ecoff_debug_swap mip
#define TARGET_BIG_SYM bfd_elf32_bigmips_vec
#define TARGET_BIG_NAME "elf32-bigmips"
+/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
+ a value of 0x1000, and we are compatible. */
+#define ELF_MAXPAGESIZE 0x1000
+
#include "elf32-target.h"
/* Support for traditional mips targets. */
-#define INCLUDED_TARGET_FILE /* More a type of flag. */
-
#undef TARGET_LITTLE_SYM
#undef TARGET_LITTLE_NAME
#undef TARGET_BIG_SYM
#undef TARGET_BIG_NAME
+#undef ELF_MAXPAGESIZE
+
#define TARGET_LITTLE_SYM bfd_elf32_tradlittlemips_vec
#define TARGET_LITTLE_NAME "elf32-tradlittlemips"
#define TARGET_BIG_SYM bfd_elf32_tradbigmips_vec
#define TARGET_BIG_NAME "elf32-tradbigmips"
+/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
+ page sizes of up to that limit, so we need to respect it. */
+#define ELF_MAXPAGESIZE 0x10000
+#define elf32_bed elf32_tradbed
+
/* Include the target file again for this target. */
#include "elf32-target.h"
diff -up --recursive --new-file binutils-2.14.90-20031222.macro/bfd/elf64-mips.c binutils-2.14.90-20031222/bfd/elf64-mips.c
--- binutils-2.14.90-20031222.macro/bfd/elf64-mips.c 2003-12-19 04:25:22.000000000 +0000
+++ binutils-2.14.90-20031222/bfd/elf64-mips.c 2003-12-23 09:48:28.000000000 +0000
@@ -2676,11 +2676,6 @@ const struct elf_size_info mips_elf64_si
#define ELF_ARCH bfd_arch_mips
#define ELF_MACHINE_CODE EM_MIPS
-/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
- a value of 0x1000, and we are compatible.
- FIXME: How does this affect NewABI? */
-#define ELF_MAXPAGESIZE 0x1000
-
#define elf_backend_collect TRUE
#define elf_backend_type_change_ok TRUE
#define elf_backend_can_gc_sections TRUE
@@ -2791,9 +2786,12 @@ extern bfd_boolean bfd_elf64_archive_wri
#define TARGET_BIG_SYM bfd_elf64_bigmips_vec
#define TARGET_BIG_NAME "elf64-bigmips"
-#include "elf64-target.h"
+/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
+ a value of 0x1000, and we are compatible.
+ FIXME: How does this affect NewABI? */
+#define ELF_MAXPAGESIZE 0x1000
-#define INCLUDED_TARGET_FILE /* More a type of flag. */
+#include "elf64-target.h"
/* The SYSV-style 'traditional' (n)64 NewABI. */
#undef TARGET_LITTLE_SYM
@@ -2801,10 +2799,17 @@ extern bfd_boolean bfd_elf64_archive_wri
#undef TARGET_BIG_SYM
#undef TARGET_BIG_NAME
+#undef ELF_MAXPAGESIZE
+
#define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec
#define TARGET_LITTLE_NAME "elf64-tradlittlemips"
#define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec
#define TARGET_BIG_NAME "elf64-tradbigmips"
+/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
+ page sizes of up to that limit, so we need to respect it. */
+#define ELF_MAXPAGESIZE 0x10000
+#define elf64_bed elf64_tradbed
+
/* Include the target file again for this target. */
#include "elf64-target.h"
diff -up --recursive --new-file binutils-2.14.90-20031222.macro/bfd/elfn32-mips.c binutils-2.14.90-20031222/bfd/elfn32-mips.c
--- binutils-2.14.90-20031222.macro/bfd/elfn32-mips.c 2003-12-19 04:25:22.000000000 +0000
+++ binutils-2.14.90-20031222/bfd/elfn32-mips.c 2003-12-23 09:38:18.000000000 +0000
@@ -1873,11 +1873,6 @@ static const struct ecoff_debug_swap mip
#define ELF_ARCH bfd_arch_mips
#define ELF_MACHINE_CODE EM_MIPS
-/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
- a value of 0x1000, and we are compatible.
- FIXME: How does this affect NewABI? */
-#define ELF_MAXPAGESIZE 0x1000
-
#define elf_backend_collect TRUE
#define elf_backend_type_change_ok TRUE
#define elf_backend_can_gc_sections TRUE
@@ -1959,20 +1954,30 @@ static const struct ecoff_debug_swap mip
#define TARGET_BIG_SYM bfd_elf32_nbigmips_vec
#define TARGET_BIG_NAME "elf32-nbigmips"
+/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
+ a value of 0x1000, and we are compatible.
+ FIXME: How does this affect NewABI? */
+#define ELF_MAXPAGESIZE 0x1000
+
#include "elf32-target.h"
/* Support for traditional mips targets using n32 ABI. */
-#define INCLUDED_TARGET_FILE /* More a type of flag. */
-
#undef TARGET_LITTLE_SYM
#undef TARGET_LITTLE_NAME
#undef TARGET_BIG_SYM
#undef TARGET_BIG_NAME
+#undef ELF_MAXPAGESIZE
+
#define TARGET_LITTLE_SYM bfd_elf32_ntradlittlemips_vec
#define TARGET_LITTLE_NAME "elf32-ntradlittlemips"
#define TARGET_BIG_SYM bfd_elf32_ntradbigmips_vec
#define TARGET_BIG_NAME "elf32-ntradbigmips"
+/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
+ page sizes of up to that limit, so we need to respect it. */
+#define ELF_MAXPAGESIZE 0x10000
+#define elf32_bed elf32_tradbed
+
/* Include the target file again for this target. */
#include "elf32-target.h"