aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorYuri Gribov <y.gribov@samsung.com>2014-02-27 14:35:37 +0000
committerNick Clifton <nickc@redhat.com>2014-02-27 14:35:37 +0000
commit1db37fe62781b677a37acbe801c1e69d8912a124 (patch)
tree48caffe8619eea72d91b80bb71ca0a6632bc5a63 /ld
parentfa96cb382c12b099675c5cc238aaa7352a3fd3d7 (diff)
downloadgdb-1db37fe62781b677a37acbe801c1e69d8912a124.zip
gdb-1db37fe62781b677a37acbe801c1e69d8912a124.tar.gz
gdb-1db37fe62781b677a37acbe801c1e69d8912a124.tar.bz2
This patch adds support for ARM PLT entries that support a full 32-bit offset range.
Enabled via the use of a new linker command line option: --long-plt. * bfd-in.h: Add export of bfd_elf32_arm_use_long_plt. * bfd-in2.h: Regenerate. * elf32-arm.c (elf32_arm_plt_entry_long): New array. (elf32_arm_link_hash_table_create): Set plt_entry_size to 16 if using long PLT entries. (bfd_elf32_arm_use_long_plt): New function. (elf32_arm_populate_plt_entry): Add support for long PLT entries. * emultempl/armelf.em (OPTION_LONG_PLT): Define. (PARSE_AND_LIST_LONGOPTS): Add long-plt. (PARSE_AND_LIST_OPTIONS): Likewise. (PARSE_AND_LIST_ARGS_CASES): Handle long-plt. * ld.texinfo: Document --long-plt. * ld-arm/long-plt-format.s: New test case. * ld-arm/long-plt-format.d: Expected disassembly. * ld-arm/arm-elf.exp: Run the new test.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/emultempl/armelf.em14
-rw-r--r--ld/ld.texinfo35
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp6
-rw-r--r--ld/testsuite/ld-arm/long-plt-format.d15
-rw-r--r--ld/testsuite/ld-arm/long-plt-format.s7
7 files changed, 73 insertions, 18 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a0c5284..57120d1 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2014-02-27 Yuri Gribov <y.gribov@samsung.com>
+
+ * emultempl/armelf.em (OPTION_LONG_PLT): Define.
+ (PARSE_AND_LIST_LONGOPTS): Add long-plt.
+ (PARSE_AND_LIST_OPTIONS): Likewise.
+ (PARSE_AND_LIST_ARGS_CASES): Handle long-plt.
+ * ld.texinfo: Document --long-plt.
+
2014-02-27 Alan Modra <amodra@gmail.com>
* emulparams/elf32ppcvxworks.sh: Source plt_unwind.sh and
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index 85e924f..6a64793 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 1991-2013 Free Software Foundation, Inc.
+# Copyright 1991-2014 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -28,10 +28,10 @@ fragment <<EOF
#include "ldctor.h"
#include "elf/arm.h"
-static char *thumb_entry_symbol = NULL;
+static char * thumb_entry_symbol = NULL;
static int byteswap_code = 0;
static int target1_is_rel = 0${TARGET1_IS_REL};
-static char *target2_type = "${TARGET2_TYPE}";
+static char * target2_type = "${TARGET2_TYPE}";
static int fix_v4bx = 0;
static int use_blx = 0;
static bfd_arm_vfp11_fix vfp11_denorm_fix = BFD_ARM_VFP11_FIX_DEFAULT;
@@ -531,6 +531,7 @@ PARSE_AND_LIST_PROLOGUE='
#define OPTION_NO_MERGE_EXIDX_ENTRIES 316
#define OPTION_FIX_ARM1176 317
#define OPTION_NO_FIX_ARM1176 318
+#define OPTION_LONG_PLT 319
'
PARSE_AND_LIST_SHORTOPTS=p
@@ -555,6 +556,7 @@ PARSE_AND_LIST_LONGOPTS='
{ "no-merge-exidx-entries", no_argument, NULL, OPTION_NO_MERGE_EXIDX_ENTRIES },
{ "fix-arm1176", no_argument, NULL, OPTION_FIX_ARM1176 },
{ "no-fix-arm1176", no_argument, NULL, OPTION_NO_FIX_ARM1176 },
+ { "long-plt", no_argument, NULL, OPTION_LONG_PLT },
'
PARSE_AND_LIST_OPTIONS='
@@ -572,6 +574,8 @@ PARSE_AND_LIST_OPTIONS='
fprintf (file, _(" --no-wchar-size-warning Don'\''t warn about objects with incompatible\n"
" wchar_t sizes\n"));
fprintf (file, _(" --pic-veneer Always generate PIC interworking veneers\n"));
+ fprintf (file, _(" --long-plt Generate long .plt entries\n"
+ " to handle large .plt/.got displacements\n"));
fprintf (file, _("\
--stub-group-size=N Maximum size of a group of input sections that\n\
can be handled by one stub section. A negative\n\
@@ -675,6 +679,10 @@ PARSE_AND_LIST_ARGS_CASES='
case OPTION_NO_FIX_ARM1176:
fix_arm1176 = 0;
break;
+
+ case OPTION_LONG_PLT:
+ bfd_elf32_arm_use_long_plt ();
+ break;
'
# We have our own before_allocation etc. functions, but they call
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index b1dff79..eb0b991 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -1,6 +1,6 @@
\input texinfo
@setfilename ld.info
-@c Copyright 1991-2013 Free Software Foundation, Inc.
+@c Copyright 1991-2014 Free Software Foundation, Inc.
@syncodeindex ky cp
@c man begin INCLUDE
@include configdoc.texi
@@ -55,7 +55,7 @@ This file documents the @sc{gnu} linker LD
@end ifset
version @value{VERSION}.
-Copyright @copyright{} 1991-2013 Free Software Foundation, Inc.
+Copyright @copyright{} 1991-2014 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
@@ -92,7 +92,7 @@ section entitled ``GNU Free Documentation License''.
@vskip 0pt plus 1filll
@c man begin COPYRIGHT
-Copyright @copyright{} 1991-2013 Free Software Foundation, Inc.
+Copyright @copyright{} 1991-2014 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
@@ -6257,17 +6257,6 @@ instructions into @code{bal} instructions when it determines that the
target subroutine is a leaf routine (that is, the target subroutine does
not itself call any subroutines).
-@cindex Cortex-A8 erratum workaround
-@kindex --fix-cortex-a8
-@kindex --no-fix-cortex-a8
-The @samp{--fix-cortex-a8} switch enables a link-time workaround for an erratum in certain Cortex-A8 processors. The workaround is enabled by default if you are targeting the ARM v7-A architecture profile. It can be enabled otherwise by specifying @samp{--fix-cortex-a8}, or disabled unconditionally by specifying @samp{--no-fix-cortex-a8}.
-
-The erratum only affects Thumb-2 code. Please contact ARM for further details.
-
-@kindex --merge-exidx-entries
-@kindex --no-merge-exidx-entries
-The @samp{--no-merge-exidx-entries} switch disables the merging of adjacent exidx entries in debuginfo.
-
@ifclear GENERIC
@lowersections
@end ifclear
@@ -6526,6 +6515,24 @@ Farcalls stubs insertion is fully supported for the ARM-EABI target
only, because it relies on object files properties not present
otherwise.
+@cindex Cortex-A8 erratum workaround
+@kindex --fix-cortex-a8
+@kindex --no-fix-cortex-a8
+The @samp{--fix-cortex-a8} switch enables a link-time workaround for an erratum in certain Cortex-A8 processors. The workaround is enabled by default if you are targeting the ARM v7-A architecture profile. It can be enabled otherwise by specifying @samp{--fix-cortex-a8}, or disabled unconditionally by specifying @samp{--no-fix-cortex-a8}.
+
+The erratum only affects Thumb-2 code. Please contact ARM for further details.
+
+@kindex --merge-exidx-entries
+@kindex --no-merge-exidx-entries
+@cindex Merging exidx entries
+The @samp{--no-merge-exidx-entries} switch disables the merging of adjacent exidx entries in debuginfo.
+
+@kindex --long-plt
+@cindex 32-bit PLT entries
+The @samp{--long-plt} option enables the use of 16 byte PLT entries
+which support up to 4Gb of code. The default is to use 12 byte PLT
+entries which only support 512Mb of code.
+
@ifclear GENERIC
@lowersections
@end ifclear
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 1af8109..84ca6b1 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-27 Yuri Gribov <y.gribov@samsung.com>
+
+ * ld-arm/long-plt-format.s: New test case.
+ * ld-arm/long-plt-format.d: Expected disassembly.
+ * ld-arm/arm-elf.exp: Run the new test.
+
2014-02-27 Nick Clifton <nickc@redhat.com>
* ld-pe/longsecn-1.d: Allow for extra sections.
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 4c0f802..ec569ca 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -1,5 +1,5 @@
# Expect script for various ARM ELF tests.
-# Copyright 2002-2013 Free Software Foundation, Inc.
+# Copyright 2002-2014 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -188,6 +188,10 @@ set armelftests_common {
"" {exec-got-1b.s}
{{readelf --relocs exec-got-1.d}}
"exec-got-1"}
+ {"Long PLT entries in executables" "--long-plt -shared --section-start=.plt=0x200 --section-start=.got=0xf0000300" ""
+ "" {long-plt-format.s}
+ {{objdump "-d -j .plt" long-plt-format.d}}
+ "long-plt-format"}
{"abs call" "-T arm.ld" "" "" {abs-call-1.s}
{{objdump -d abs-call-1.d}}
"abs-call-1"}
diff --git a/ld/testsuite/ld-arm/long-plt-format.d b/ld/testsuite/ld-arm/long-plt-format.d
new file mode 100644
index 0000000..c08cb71
--- /dev/null
+++ b/ld/testsuite/ld-arm/long-plt-format.d
@@ -0,0 +1,15 @@
+.*: file format elf32-.*
+
+
+Disassembly of section .plt:
+
+00000200 <.plt>:
+ 200: .*
+ 204: .*
+ 208: .*
+ 20c: .*
+ 210: .* .word .*
+ 214: .* add ip, pc, #-268435456 ; 0xf0000000
+ 218: .* add ip, ip, #0, 12
+ 21c: .* add ip, ip, #0, 20
+ 220: .* ldr pc, [ip, #[0-9]*]! ; 0x.*
diff --git a/ld/testsuite/ld-arm/long-plt-format.s b/ld/testsuite/ld-arm/long-plt-format.s
new file mode 100644
index 0000000..bb0c3a2
--- /dev/null
+++ b/ld/testsuite/ld-arm/long-plt-format.s
@@ -0,0 +1,7 @@
+ .globl _start
+ .type _start,%function
+ .globl foo
+_start:
+ bl foo(PLT)
+ .size _start,.-_start
+