]> git.pld-linux.org Git - packages/gcc.git/blame - gcc32-i386-pic-label-thunk.patch
- more nof libs on ppc
[packages/gcc.git] / gcc32-i386-pic-label-thunk.patch
CommitLineData
5384b728 12002-06-04 Richard Henderson <rth@redhat.com>
2 Jakub Jelinek <jakub@redhat.com>
3
4 * config/i386/i386.c (USE_HIDDEN_LINKONCE): New.
5 (ix86_asm_file_end): If USE_HIDDEN_LINKONCE, emit get_pc thunks
6 into linkonce sections.
7 (load_pic_register): Set up pic_label_name for it.
8
9--- gcc/config/i386/i386.c.jj Mon Jun 3 17:24:13 2002
10+++ gcc/config/i386/i386.c Tue Jun 4 15:49:17 2002
11@@ -3786,6 +3786,12 @@ ix86_setup_frame_addresses ()
12 cfun->machine->accesses_prev_frame = 1;
13 }
14 \f
15+#if defined(HAVE_GAS_HIDDEN) && defined(SUPPORTS_ONE_ONLY)
16+# define USE_HIDDEN_LINKONCE 1
17+#else
18+# define USE_HIDDEN_LINKONCE 0
19+#endif
20+
21 static char pic_label_name[32];
22
23 /* This function generates code for -fpic that loads %ebx with
24@@ -3800,10 +3806,6 @@ ix86_asm_file_end (file)
25 if (! TARGET_DEEP_BRANCH_PREDICTION || pic_label_name[0] == 0)
26 return;
27
28- /* ??? Binutils 2.10 and earlier has a linkonce elimination bug related
29- to updating relocations to a section being discarded such that this
30- doesn't work. Ought to detect this at configure time. */
31-#if 0
32 /* The trick here is to create a linkonce section containing the
33 pic label thunk, but to refer to it with an internal label.
34 Because the label is internal, we don't have inter-dso name
35@@ -3811,28 +3813,27 @@ ix86_asm_file_end (file)
36
37 In order to use these macros, however, we must create a fake
38 function decl. */
39- if (targetm.have_named_sections)
40+ if (USE_HIDDEN_LINKONCE && targetm.have_named_sections)
41 {
42 tree decl = build_decl (FUNCTION_DECL,
43- get_identifier ("i686.get_pc_thunk"),
44+ get_identifier (pic_label_name),
45 error_mark_node);
46+ TREE_PUBLIC (decl) = 1;
47+ TREE_STATIC (decl) = 1;
48 DECL_ONE_ONLY (decl) = 1;
49 UNIQUE_SECTION (decl, 0);
50- named_section (decl, NULL);
51+ named_section (decl, NULL, 0);
52+ ASM_GLOBALIZE_LABEL (file, pic_label_name);
53+ fputs ("\t.hidden\t", file);
54+ assemble_name (file, pic_label_name);
55+ fputc ('\n', file);
56+ ASM_DECLARE_FUNCTION_NAME (file, pic_label_name, decl);
57 }
58 else
59-#else
60- text_section ();
61-#endif
62-
63- /* This used to call ASM_DECLARE_FUNCTION_NAME() but since it's an
64- internal (non-global) label that's being emitted, it didn't make
65- sense to have .type information for local labels. This caused
66- the SCO OpenServer 5.0.4 ELF assembler grief (why are you giving
67- me debug info for a label that you're declaring non-global?) this
68- was changed to call ASM_OUTPUT_LABEL() instead. */
69-
70- ASM_OUTPUT_LABEL (file, pic_label_name);
71+ {
72+ text_section ();
73+ ASM_OUTPUT_LABEL (file, pic_label_name);
74+ }
75
76 xops[0] = pic_offset_table_rtx;
77 xops[1] = gen_rtx_MEM (SImode, stack_pointer_rtx);
78@@ -3853,7 +3854,12 @@ load_pic_register ()
79 if (TARGET_DEEP_BRANCH_PREDICTION)
80 {
81 if (! pic_label_name[0])
82- ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0);
83+ {
84+ if (USE_HIDDEN_LINKONCE && targetm.have_named_sections)
85+ strcpy (pic_label_name, "__i686.get_pc_thunk.bx");
86+ else
87+ ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0);
88+ }
89 pclab = gen_rtx_MEM (QImode, gen_rtx_SYMBOL_REF (Pmode, pic_label_name));
90 }
91 else
This page took 0.35997 seconds and 4 git commands to generate.