diff options
author | Christophe Lyon <christophe.lyon@st.com> | 2018-03-20 10:55:37 +0100 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2018-04-25 20:57:39 +0000 |
commit | cb10292c2a6c26349c02ec275e4087147fd1cdf0 (patch) | |
tree | 4539fa62ce1191d95c73a1312763514f9e0007ea | |
parent | 5c5a4843ec385a60954fbbc4bcf5b64763639bd3 (diff) | |
download | gdb-cb10292c2a6c26349c02ec275e4087147fd1cdf0.zip gdb-cb10292c2a6c26349c02ec275e4087147fd1cdf0.tar.gz gdb-cb10292c2a6c26349c02ec275e4087147fd1cdf0.tar.bz2 |
[ARM] FDPIC: Add stack segment
The size of the stack segment defaults to 32KB, and can be overridden
by defining the __stacksize symbol.
2018-04-25 Christophe Lyon <christophe.lyon@st.com>
Mickaël Guêné <mickael.guene@st.com>
bfd/
* elf32-arm.c (DEFAULT_STACK_SIZE): New.
(elf32_arm_always_size_sections): Create stack segment.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3e5415e..bd7c6ae 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,12 @@ 2018-04-25 Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> + * elf32-arm.c (DEFAULT_STACK_SIZE): New. + (elf32_arm_always_size_sections): Create stack segment. + +2018-04-25 Christophe Lyon <christophe.lyon@st.com> + Mickaël Guêné <mickael.guene@st.com> + * bfd-in2.h (BFD_RELOC_ARM_TLS_GD32_FDPIC) (BFD_RELOC_ARM_TLS_LDM32_FDPIC, BFD_RELOC_ARM_TLS_IE32_FDPIC): New relocations. diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index fb29c0c..35b60ed 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -2251,6 +2251,9 @@ typedef unsigned short int insn16; section. */ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" +/* FDPIC default stack size. */ +#define DEFAULT_STACK_SIZE 0x8000 + static const unsigned long tls_trampoline [] = { 0xe08e0000, /* add r0, lr, r0 */ @@ -16485,6 +16488,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p) /* Not an error, just cut short the traversal. */ return FALSE; } + return TRUE; } @@ -16955,6 +16959,9 @@ elf32_arm_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) { asection *tls_sec; + struct elf32_arm_link_hash_table *htab; + + htab = elf32_arm_hash_table (info); if (bfd_link_relocatable (info)) return TRUE; @@ -16987,6 +16994,12 @@ elf32_arm_always_size_sections (bfd *output_bfd, (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE); } } + + if (htab->fdpic_p && !bfd_link_relocatable (info) + && !bfd_elf_stack_segment_size (output_bfd, info, + "__stacksize", DEFAULT_STACK_SIZE)) + return FALSE; + return TRUE; } |