[ARM] FDPIC: Add stack segment
authorChristophe Lyon <christophe.lyon@st.com>
Tue, 20 Mar 2018 09:55:37 +0000 (10:55 +0100)
committerChristophe Lyon <christophe.lyon@linaro.org>
Wed, 25 Apr 2018 20:57:39 +0000 (20:57 +0000)
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.

bfd/ChangeLog
bfd/elf32-arm.c

index 3e5415e4238f3db3dcf6e2159cce0585471542db..bd7c6aeea40b835d0a34a918675eb44d75574290 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
index fb29c0c0108df1453bd46ad4911331d22eae6010..35b60ed9f5bff2a0e04b07fc65017221df1be877 100644 (file)
@@ -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;
 }
 
This page took 0.031832 seconds and 4 git commands to generate.