This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
use lituse_jsrdirect for alpha division
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 1 Jun 2005 01:25:23 -0700
- Subject: use lituse_jsrdirect for alpha division
Over the weekend I implemented a new plt format for Alpha that's acceptable
to SELinux. But this new format can't handle the non- standard calling
convention of the division routines.
This won't be a problem in practice with anything that links against libc,
and so the division symbols are resolved at link time; the symbols are also
marked such that a plt entry is suppressed. This patch merely fills the hole
for improperly constructed shared libraries.
Applied to 4.0 and mainline; I may apply it to 3.4 branch as well, since
it's so trivial.
r~
* configure.ac (HAVE_AS_JSRDIRECT_RELOCS): New.
* config.in, configure: Rebuild.
* config/alpha/alpha.c (print_operand): Add 'j'.
* alpha.md (divmodsi_internal_er_1): Use it.
(divmoddi_internal_er_1): Likewise.
Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.ac,v
retrieving revision 2.94.8.3
diff -u -p -d -r2.94.8.3 configure.ac
--- configure.ac 7 May 2005 22:27:52 -0000 2.94.8.3
+++ configure.ac 1 Jun 2005 08:09:23 -0000
@@ -2594,6 +2594,14 @@ case "$target" in
lda $29, 0($29) !gpdisp!3],,
[AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1,
[Define if your assembler supports explicit relocations.])])
+ gcc_GAS_CHECK_FEATURE([jsrdirect relocation support],
+ gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],,
+[ .set nomacro
+ .text
+ ldq $27, a($29) !literal!1
+ jsr $26, ($27), a !lituse_jsrdirect!1],,
+ [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1,
+ [Define if your assembler supports the lituse_jsrdirect relocation.])])
;;
cris-*-*)
Index: config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.408.8.2
diff -u -p -d -r1.408.8.2 alpha.c
--- config/alpha/alpha.c 19 May 2005 09:53:33 -0000 1.408.8.2
+++ config/alpha/alpha.c 1 Jun 2005 08:09:25 -0000
@@ -4775,6 +4775,20 @@ print_operand (FILE *file, rtx x, int co
}
break;
+ case 'j':
+ {
+ const char *lituse;
+
+#ifdef HAVE_AS_JSRDIRECT_RELOCS
+ lituse = "lituse_jsrdirect";
+#else
+ lituse = "lituse_jsr";
+#endif
+
+ gcc_assert (INTVAL (x) != 0);
+ fprintf (file, "\t\t!%s!%d", lituse, (int) INTVAL (x));
+ }
+ break;
case 'r':
/* If this operand is the constant zero, write it as "$31". */
if (GET_CODE (x) == REG)
Index: config/alpha/alpha.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.md,v
retrieving revision 1.235
diff -u -p -d -r1.235 alpha.md
--- config/alpha/alpha.md 28 Jan 2005 00:54:59 -0000 1.235
+++ config/alpha/alpha.md 1 Jun 2005 08:09:26 -0000
@@ -974,7 +974,7 @@
(clobber (reg:DI 23))
(clobber (reg:DI 28))]
"TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
- "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
+ "#"
"&& reload_completed"
[(parallel [(set (match_dup 0)
(sign_extend:DI (match_dup 3)))
@@ -1019,7 +1019,7 @@
(clobber (reg:DI 23))
(clobber (reg:DI 28))]
"TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
- "jsr $23,($27),__%E3%J5"
+ "jsr $23,($27),__%E3%j5"
[(set_attr "type" "jsr")
(set_attr "length" "4")])
@@ -1043,7 +1043,7 @@
(clobber (reg:DI 23))
(clobber (reg:DI 28))]
"TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
- "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
+ "#"
"&& reload_completed"
[(parallel [(set (match_dup 0) (match_dup 3))
(use (match_dup 0))
@@ -1087,7 +1087,7 @@
(clobber (reg:DI 23))
(clobber (reg:DI 28))]
"TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
- "jsr $23,($27),__%E3%J5"
+ "jsr $23,($27),__%E3%j5"
[(set_attr "type" "jsr")
(set_attr "length" "4")])