Projects
openEuler:24.03:SP1:Everything
gcc
_service:tar_scm:0112-LoongArch-Assign-the-u-at...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0112-LoongArch-Assign-the-u-attribute-to-the-mem-to-which.patch of Package gcc
From 191675bdfd4cef0fbcf642f53da82a49bd23a3bf Mon Sep 17 00:00:00 2001 From: Lulu Cheng <chenglulu@loongson.cn> Date: Fri, 12 Jan 2024 17:06:30 +0800 Subject: [PATCH 112/188] LoongArch: Assign the '/u' attribute to the mem to which the global offset table belongs. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_split_symbol): Assign the '/u' attribute to the mem. gcc/testsuite/ChangeLog: * g++.target/loongarch/got-load.C: New test. --- gcc/config/loongarch/loongarch.cc | 5 +++++ gcc/testsuite/g++.target/loongarch/got-load.C | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.target/loongarch/got-load.C diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 13481130b..7da00c132 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -3198,6 +3198,11 @@ loongarch_split_symbol (rtx temp, rtx addr, machine_mode mode, rtx *low_out) rtx mem = gen_rtx_MEM (Pmode, low); *low_out = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, mem), UNSPEC_LOAD_FROM_GOT); + + /* Nonzero in a mem, if the memory is statically allocated and + read-only. A common example of the later is a shared library’s + global offset table. */ + MEM_READONLY_P (mem) = 1; } break; diff --git a/gcc/testsuite/g++.target/loongarch/got-load.C b/gcc/testsuite/g++.target/loongarch/got-load.C new file mode 100644 index 000000000..20924c739 --- /dev/null +++ b/gcc/testsuite/g++.target/loongarch/got-load.C @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-mabi=lp64d -O2 -mexplicit-relocs -mcmodel=normal -fdump-rtl-expand" } */ +/* { dg-final { scan-rtl-dump-times "mem/u" 2 "expand" } } */ + +#include <bits/stdc++.h> + +using namespace std; + +int lr[100005][2]; + +void +test(void) +{ + int n; + + cin >> n; + for (int i = 0; i < n; ++i) + cin >> lr[i][0] >> lr[i][1]; +} -- 2.43.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2