summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools/gcc/gcc-10/0016-Patch-microblaze-Add-INIT_PRIORITY-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-microblaze/recipes-devtools/gcc/gcc-10/0016-Patch-microblaze-Add-INIT_PRIORITY-support.patch')
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-10/0016-Patch-microblaze-Add-INIT_PRIORITY-support.patch102
1 files changed, 102 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-10/0016-Patch-microblaze-Add-INIT_PRIORITY-support.patch b/meta-microblaze/recipes-devtools/gcc/gcc-10/0016-Patch-microblaze-Add-INIT_PRIORITY-support.patch
new file mode 100644
index 00000000..13c3ccd9
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-10/0016-Patch-microblaze-Add-INIT_PRIORITY-support.patch
@@ -0,0 +1,102 @@
1From 9a4253a92a5e1811693ea1707b5fc272908ec556 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 17 Jan 2017 14:41:58 +0530
4Subject: [PATCH 16/58] [Patch, microblaze]: Add INIT_PRIORITY support
5
6Added TARGET_ASM_CONSTRUCTOR and TARGET_ASM_DESTRUCTOR macros.
7
8These macros allows users to control the order of initialization
9of objects defined at namespace scope with the init_priority
10attribute by specifying a relative priority, a constant integral
11expression currently bounded between 101 and 65535 inclusive.
12
13Lower numbers indicate a higher priority.
14
15Changelog
16
172013-11-26 Nagaraju Mekala <nagaraju.mekala@xilinx.com>
18
19 * gcc/config/microblaze/microblaze.c: Add microblaze_asm_constructor,
20 microblaze_asm_destructor. Define TARGET_ASM_CONSTRUCTOR and
21 TARGET_ASM_DESTRUCTOR.
22
23Signed-off-by:nagaraju <nmekala@xilix.com>
24Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
25---
26 gcc/config/microblaze/microblaze.c | 53 ++++++++++++++++++++++++++++++
27 1 file changed, 53 insertions(+)
28
29diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
30index 0186171c04c..9eae5515c60 100644
31--- a/gcc/config/microblaze/microblaze.c
32+++ b/gcc/config/microblaze/microblaze.c
33@@ -2634,6 +2634,53 @@ print_operand_address (FILE * file, rtx addr)
34 }
35 }
36
37+/* Output an element in the table of global constructors. */
38+void
39+microblaze_asm_constructor (rtx symbol ATTRIBUTE_UNUSED, int priority)
40+{
41+ const char *section = ".ctors";
42+ char buf[16];
43+
44+ if (priority != DEFAULT_INIT_PRIORITY)
45+ {
46+ sprintf (buf, ".ctors.%.5u",
47+ /* Invert the numbering so the linker puts us in the proper
48+ order; constructors are run from right to left, and the
49+ linker sorts in increasing order. */
50+ MAX_INIT_PRIORITY - priority);
51+ section = buf;
52+ }
53+
54+ switch_to_section (get_section (section, 0, NULL));
55+ assemble_align (POINTER_SIZE);
56+ fputs ("\t.word\t", asm_out_file);
57+ output_addr_const (asm_out_file, symbol);
58+ fputs ("\n", asm_out_file);
59+}
60+
61+/* Output an element in the table of global destructors. */
62+void
63+microblaze_asm_destructor (rtx symbol, int priority)
64+{
65+ const char *section = ".dtors";
66+ char buf[16];
67+ if (priority != DEFAULT_INIT_PRIORITY)
68+ {
69+ sprintf (buf, ".dtors.%.5u",
70+ /* Invert the numbering so the linker puts us in the proper
71+ order; constructors are run from right to left, and the
72+ linker sorts in increasing order. */
73+ MAX_INIT_PRIORITY - priority);
74+ section = buf;
75+ }
76+
77+ switch_to_section (get_section (section, 0, NULL));
78+ assemble_align (POINTER_SIZE);
79+ fputs ("\t.word\t", asm_out_file);
80+ output_addr_const (asm_out_file, symbol);
81+ fputs ("\n", asm_out_file);
82+}
83+
84 /* Emit either a label, .comm, or .lcomm directive, and mark that the symbol
85 is used, so that we don't emit an .extern for it in
86 microblaze_asm_file_end. */
87@@ -3975,6 +4022,12 @@ microblaze_starting_frame_offset (void)
88 #undef TARGET_ATTRIBUTE_TABLE
89 #define TARGET_ATTRIBUTE_TABLE microblaze_attribute_table
90
91+#undef TARGET_ASM_CONSTRUCTOR
92+#define TARGET_ASM_CONSTRUCTOR microblaze_asm_constructor
93+
94+#undef TARGET_ASM_DESTRUCTOR
95+#define TARGET_ASM_DESTRUCTOR microblaze_asm_destructor
96+
97 #undef TARGET_IN_SMALL_DATA_P
98 #define TARGET_IN_SMALL_DATA_P microblaze_elf_in_small_data_p
99
100--
1012.17.1
102