1 Star 1 Fork 139

zhouxudong8/gcc

forked from src-openEuler/gcc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fix-SYMBOL_TINY_GOT-handling-for-ILP32.patch 2.09 KB
一键复制 编辑 原始数据 按行查看 历史
eastb233 提交于 2020-05-14 10:48 . Init gcc-9.3.0
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index b0cbb6e2d55..58d38f74bde 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -2739,8 +2739,21 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm,
}
case SYMBOL_TINY_GOT:
- emit_insn (gen_ldr_got_tiny (dest, imm));
- return;
+ {
+ rtx insn;
+ machine_mode mode = GET_MODE (dest);
+
+ if (mode == ptr_mode)
+ insn = gen_ldr_got_tiny (mode, dest, imm);
+ else
+ {
+ gcc_assert (mode == Pmode);
+ insn = gen_ldr_got_tiny_sidi (dest, imm);
+ }
+
+ emit_insn (insn);
+ return;
+ }
case SYMBOL_TINY_TLSIE:
{
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 7ad4e918578..c7c4d1dd519 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -6766,13 +6766,23 @@
[(set_attr "type" "load_4")]
)
-(define_insn "ldr_got_tiny"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")]
- UNSPEC_GOTTINYPIC))]
+(define_insn "@ldr_got_tiny_<mode>"
+ [(set (match_operand:PTR 0 "register_operand" "=r")
+ (unspec:PTR [(match_operand:PTR 1 "aarch64_valid_symref" "S")]
+ UNSPEC_GOTTINYPIC))]
""
- "ldr\\t%0, %L1"
- [(set_attr "type" "load_8")]
+ "ldr\t%<w>0, %L1"
+ [(set_attr "type" "load_<ldst_sz>")]
+)
+
+(define_insn "ldr_got_tiny_sidi"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (zero_extend:DI
+ (unspec:SI [(match_operand:DI 1 "aarch64_valid_symref" "S")]
+ UNSPEC_GOTTINYPIC)))]
+ "TARGET_ILP32"
+ "ldr\t%w0, %L1"
+ [(set_attr "type" "load_4")]
)
(define_insn "aarch64_load_tp_hard"
diff --git a/gcc/testsuite/gcc.target/aarch64/pr94201.c b/gcc/testsuite/gcc.target/aarch64/pr94201.c
new file mode 100644
index 00000000000..69176169186
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr94201.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmodel=tiny -mabi=ilp32 -fPIC" } */
+
+extern int bar (void *);
+extern long long a;
+
+int
+foo (void)
+{
+ a = 1;
+ return bar ((void *)bar);
+}
+
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhouxudong8/gcc.git
git@gitee.com:zhouxudong8/gcc.git
zhouxudong8
gcc
gcc
master

搜索帮助