Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
d9407988
Commit
d9407988
authored
May 09, 1996
by
Michael Meissner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add fine grain control to -msdata
From-SVN: r11959
parent
0821c881
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
153 additions
and
68 deletions
+153
-68
gcc/config/rs6000/rs6000.c
+96
-10
gcc/config/rs6000/sysv4.h
+57
-58
No files found.
gcc/config/rs6000/rs6000.c
View file @
d9407988
...
@@ -82,6 +82,12 @@ int rs6000_pic_labelno;
...
@@ -82,6 +82,12 @@ int rs6000_pic_labelno;
/* Which abi to adhere to */
/* Which abi to adhere to */
char
*
rs6000_abi_name
=
RS6000_ABI_NAME
;
char
*
rs6000_abi_name
=
RS6000_ABI_NAME
;
/* Semantics of the small data area */
enum
rs6000_sdata_type
rs6000_sdata
=
SDATA_DATA
;
/* Which small data model to use */
char
*
rs6000_sdata_name
=
(
char
*
)
0
;
#endif
#endif
/* Whether a System V.4 varargs area was created. */
/* Whether a System V.4 varargs area was created. */
...
@@ -224,6 +230,16 @@ output_options (file, f_options, f_len, W_options, W_len)
...
@@ -224,6 +230,16 @@ output_options (file, f_options, f_len, W_options, W_len)
if
(
rs6000_select
[
j
].
string
!=
(
char
*
)
0
)
if
(
rs6000_select
[
j
].
string
!=
(
char
*
)
0
)
pos
=
output_option
(
file
,
rs6000_select
[
j
].
name
,
rs6000_select
[
j
].
string
,
pos
);
pos
=
output_option
(
file
,
rs6000_select
[
j
].
name
,
rs6000_select
[
j
].
string
,
pos
);
#ifdef USING_SVR4_H
switch
(
rs6000_sdata
)
{
case
SDATA_NONE
:
pos
=
output_option
(
file
,
"-msdata="
,
"none"
,
pos
);
break
;
case
SDATA_DATA
:
pos
=
output_option
(
file
,
"-msdata="
,
"data"
,
pos
);
break
;
case
SDATA_SYSV
:
pos
=
output_option
(
file
,
"-msdata="
,
"sysv"
,
pos
);
break
;
case
SDATA_EABI
:
pos
=
output_option
(
file
,
"-msdata="
,
"eabi"
,
pos
);
break
;
}
#endif
fputs
(
"
\n\n
"
,
file
);
fputs
(
"
\n\n
"
,
file
);
}
}
...
@@ -1014,12 +1030,11 @@ small_data_operand (op, mode)
...
@@ -1014,12 +1030,11 @@ small_data_operand (op, mode)
rtx
op
;
rtx
op
;
enum
machine_mode
mode
;
enum
machine_mode
mode
;
{
{
#ifdef TARGET_SDATA
rtx
sym_ref
,
const_part
;
rtx
sym_ref
,
const_part
;
#ifdef TARGET_SDATA
if
(
rs6000_sdata
==
SDATA_NONE
||
rs6000_sdata
==
SDATA_DATA
)
if
(
!
TARGET_SDATA
)
return
0
;
return
0
;
#endif
if
(
DEFAULT_ABI
!=
ABI_V4
/* && DEFAULT_ABI != ABI_SOLARIS */
)
if
(
DEFAULT_ABI
!=
ABI_V4
/* && DEFAULT_ABI != ABI_SOLARIS */
)
return
0
;
return
0
;
...
@@ -1040,6 +1055,10 @@ small_data_operand (op, mode)
...
@@ -1040,6 +1055,10 @@ small_data_operand (op, mode)
return
0
;
return
0
;
return
1
;
return
1
;
#else
return
0
;
#endif
}
}
...
@@ -2080,8 +2099,8 @@ ccr_bit (op, scc_p)
...
@@ -2080,8 +2099,8 @@ ccr_bit (op, scc_p)
/* Print an operand. Recognize special options, documented below. */
/* Print an operand. Recognize special options, documented below. */
#ifdef TARGET_
EABI
#ifdef TARGET_
SDATA
#define SMALL_DATA_RELOC ((
TARGET
_EABI) ? "sda21" : "sdarel")
#define SMALL_DATA_RELOC ((
rs6000_sdata == SDATA
_EABI) ? "sda21" : "sdarel")
#else
#else
#define SMALL_DATA_RELOC "sda21"
#define SMALL_DATA_RELOC "sda21"
#endif
#endif
...
@@ -4609,20 +4628,18 @@ rs6000_select_section (decl, reloc)
...
@@ -4609,20 +4628,18 @@ rs6000_select_section (decl, reloc)
||
(
DECL_INITIAL
(
decl
)
!=
error_mark_node
||
(
DECL_INITIAL
(
decl
)
!=
error_mark_node
&&
!
TREE_CONSTANT
(
DECL_INITIAL
(
decl
))))
&&
!
TREE_CONSTANT
(
DECL_INITIAL
(
decl
))))
{
{
if
(
TARGET_SDATA
&&
(
size
>
0
)
&&
(
size
<=
g_switch_value
))
if
(
rs6000_sdata
!=
SDATA_NONE
&&
(
size
>
0
)
&&
(
size
<=
g_switch_value
))
sdata_section
();
sdata_section
();
else
else
data_section
();
data_section
();
}
}
else
else
{
{
if
(
TARGET_SDATA
&&
(
size
>
0
)
&&
(
size
<=
g_switch_value
))
if
(
rs6000_sdata
!=
SDATA_NONE
&&
(
size
>
0
)
&&
(
size
<=
g_switch_value
))
{
{
#ifdef TARGET_EABI
if
(
rs6000_sdata
==
SDATA_EABI
)
if
(
TARGET_EABI
)
sdata2_section
();
sdata2_section
();
else
else
#endif
sdata_section
();
/* System V doesn't have .sdata2/.sbss2 */
sdata_section
();
/* System V doesn't have .sdata2/.sbss2 */
}
}
else
else
...
@@ -4632,6 +4649,75 @@ rs6000_select_section (decl, reloc)
...
@@ -4632,6 +4649,75 @@ rs6000_select_section (decl, reloc)
else
else
const_section
();
const_section
();
}
}
/* If we are referencing a function that is static or is known to be
in this file, make the SYMBOL_REF special. We can use this to indicate
that we can branch to this function without emitting a no-op after the
call. For real AIX and NT calling sequences, we also replace the
function name with the real name (1 or 2 leading .'s), rather than
the function descriptor name. This saves a lot of overriding code
to readd the prefixes. */
void
rs6000_encode_section_info
(
decl
)
tree
decl
;
{
if
(
TREE_CODE
(
decl
)
==
FUNCTION_DECL
)
{
rtx
sym_ref
=
XEXP
(
DECL_RTL
(
decl
),
0
);
if
(
TREE_ASM_WRITTEN
(
decl
)
||
!
TREE_PUBLIC
(
decl
))
SYMBOL_REF_FLAG
(
sym_ref
)
=
1
;
if
(
DEFAULT_ABI
==
ABI_AIX
||
DEFAULT_ABI
==
ABI_NT
)
{
char
*
prefix
=
(
DEFAULT_ABI
==
ABI_AIX
)
?
"."
:
".."
;
char
*
str
=
permalloc
(
strlen
(
prefix
)
+
1
+
strlen
(
XSTR
(
sym_ref
,
0
)));
strcpy
(
str
,
prefix
);
strcat
(
str
,
XSTR
(
sym_ref
,
0
));
XSTR
(
sym_ref
,
0
)
=
str
;
}
}
else
if
(
rs6000_sdata
!=
SDATA_NONE
&&
(
DEFAULT_ABI
==
ABI_V4
||
DEFAULT_ABI
==
ABI_SOLARIS
)
&&
TREE_CODE
(
decl
)
==
VAR_DECL
)
{
int
size
=
int_size_in_bytes
(
TREE_TYPE
(
decl
));
tree
section_name
=
DECL_SECTION_NAME
(
decl
);
char
*
name
=
(
char
*
)
0
;
int
len
=
0
;
if
(
section_name
)
{
if
(
TREE_CODE
(
section_name
)
==
STRING_CST
)
{
name
=
TREE_STRING_POINTER
(
section_name
);
len
=
TREE_STRING_LENGTH
(
section_name
);
}
else
abort
();
}
if
((
size
>
0
&&
size
<=
g_switch_value
)
||
(
name
&&
((
len
==
sizeof
(
".sdata"
)
-
1
&&
strcmp
(
name
,
".sdata"
)
==
0
)
||
(
len
==
sizeof
(
".sdata2"
)
-
1
&&
strcmp
(
name
,
".sdata2"
)
==
0
)
||
(
len
==
sizeof
(
".sbss"
)
-
1
&&
strcmp
(
name
,
".sbss"
)
==
0
)
||
(
len
==
sizeof
(
".sbss2"
)
-
1
&&
strcmp
(
name
,
".sbss2"
)
==
0
)
||
(
len
==
sizeof
(
".PPC.EMB.sdata0"
)
-
1
&&
strcmp
(
name
,
".PPC.EMB.sdata0"
)
==
0
)
||
(
len
==
sizeof
(
".PPC.EMB.sbss0"
)
-
1
&&
strcmp
(
name
,
".PPC.EMB.sbss0"
)
==
0
))))
{
rtx
sym_ref
=
XEXP
(
DECL_RTL
(
decl
),
0
);
char
*
str
=
permalloc
(
2
+
strlen
(
XSTR
(
sym_ref
,
0
)));
strcpy
(
str
,
"@"
);
strcat
(
str
,
XSTR
(
sym_ref
,
0
));
XSTR
(
sym_ref
,
0
)
=
str
;
}
}
}
#endif
/* USING_SVR4_H */
#endif
/* USING_SVR4_H */
...
...
gcc/config/rs6000/sysv4.h
View file @
d9407988
...
@@ -19,13 +19,21 @@ along with GNU CC; see the file COPYING. If not, write to
...
@@ -19,13 +19,21 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Boston, MA 02111-1307, USA. */
/* eABI local switches -- put here rather than eabi.h, so the switches
/* Small data support types */
can be tested in macros. */
enum
rs6000_sdata_type
{
SDATA_NONE
,
/* no small data support */
SDATA_DATA
,
/* just put data in .sbss/.sdata, don't use relocs */
SDATA_SYSV
,
/* Use r13 to point to .sdata/.sbss */
SDATA_EABI
/* Use r13 like above, r2 points to .sdata2/.sbss2 */
};
extern
enum
rs6000_sdata_type
rs6000_sdata
;
/* V.4/eabi switches */
#define MASK_NO_BITFIELD_TYPE 0x40000000
/* Set PCC_BITFIELD_TYPE_MATTERS to 0 */
#define MASK_NO_BITFIELD_TYPE 0x40000000
/* Set PCC_BITFIELD_TYPE_MATTERS to 0 */
#define MASK_STRICT_ALIGN 0x20000000
/* Set STRICT_ALIGNMENT to 1. */
#define MASK_STRICT_ALIGN 0x20000000
/* Set STRICT_ALIGNMENT to 1. */
#define MASK_RELOCATABLE 0x10000000
/* GOT pointers are PC relative */
#define MASK_RELOCATABLE 0x10000000
/* GOT pointers are PC relative */
#define MASK_SDATA 0x08000000
/* use
eabi .sdata/.sdata2/.sbss relocation
s */
#define MASK_SDATA 0x08000000
/* use
small data area
s */
#define MASK_LITTLE_ENDIAN 0x04000000
/* target is little endian */
#define MASK_LITTLE_ENDIAN 0x04000000
/* target is little endian */
#define MASK_REGNAMES 0x02000000
/* use alternate register names. */
#define MASK_REGNAMES 0x02000000
/* use alternate register names. */
#define MASK_PROTOTYPE 0x01000000
/* Only prototyped fcns pass variable args */
#define MASK_PROTOTYPE 0x01000000
/* Only prototyped fcns pass variable args */
...
@@ -67,6 +75,7 @@ Boston, MA 02111-1307, USA. */
...
@@ -67,6 +75,7 @@ Boston, MA 02111-1307, USA. */
{ "relocatable", -MASK_SDATA }, \
{ "relocatable", -MASK_SDATA }, \
{ "no-relocatable", -MASK_RELOCATABLE }, \
{ "no-relocatable", -MASK_RELOCATABLE }, \
{ "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
{ "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
{ "relocatable-lib", -MASK_SDATA }, \
{ "no-relocatable-lib", -MASK_RELOCATABLE }, \
{ "no-relocatable-lib", -MASK_RELOCATABLE }, \
{ "sdata", MASK_SDATA }, \
{ "sdata", MASK_SDATA }, \
{ "no-sdata", -MASK_SDATA }, \
{ "no-sdata", -MASK_SDATA }, \
...
@@ -89,13 +98,16 @@ Boston, MA 02111-1307, USA. */
...
@@ -89,13 +98,16 @@ Boston, MA 02111-1307, USA. */
{ "emb", 0 }, \
{ "emb", 0 }, \
{ "newlib", 0 },
{ "newlib", 0 },
/* Which abi to adhere to */
extern
char
*
rs6000_abi_name
;
/* Default ABI to use */
/* Default ABI to use */
#define RS6000_ABI_NAME "sysv"
#define RS6000_ABI_NAME "sysv"
#define SUBTARGET_OPTIONS {"call-", &rs6000_abi_name}
/* Strings provided by SUBTARGET_OPTIONS */
extern
char
*
rs6000_abi_name
;
extern
char
*
rs6000_sdata_name
;
#define SUBTARGET_OPTIONS \
{ "call-", &rs6000_abi_name}, \
{ "sdata=", &rs6000_sdata_name}
/* Max # of bytes for variables to automatically be put into the .sdata
/* Max # of bytes for variables to automatically be put into the .sdata
or .sdata2 sections. */
or .sdata2 sections. */
...
@@ -152,14 +164,41 @@ do { \
...
@@ -152,14 +164,41 @@ do { \
error ("Bad value for -mcall-%s", rs6000_abi_name); \
error ("Bad value for -mcall-%s", rs6000_abi_name); \
} \
} \
\
\
/* CYGNUS LOCAL -fcombine-statics vs. -msdata */
\
if (rs6000_sdata_name) \
if (TARGET_SDATA) \
{ \
flag_combine_statics = 0; \
target_flags |= MASK_SDATA; \
/* END CYGNUS LOCAL -fcombine-statics vs. -msdata */
\
if (!strcmp (rs6000_sdata_name, "none")) \
{ \
rs6000_sdata = SDATA_NONE; \
target_flags &= ~MASK_SDATA; \
} \
else if (!strcmp (rs6000_sdata_name, "data")) \
rs6000_sdata = SDATA_DATA; \
else if (!strcmp (rs6000_sdata_name, "default")) \
rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
else if (!strcmp (rs6000_sdata_name, "sysv")) \
rs6000_sdata = SDATA_SYSV; \
else if (!strcmp (rs6000_sdata_name, "eabi")) \
rs6000_sdata = SDATA_EABI; \
else \
error ("Bad value for -msdata=%s", rs6000_sdata_name); \
} \
else if (TARGET_SDATA) \
rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
else if (!TARGET_RELOCATABLE && !flag_pic \
&& (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)) \
{ \
rs6000_sdata = SDATA_DATA; \
target_flags |= MASK_SDATA; \
} \
else \
rs6000_sdata = SDATA_NONE; \
\
\
if (TARGET_RELOCATABLE && TARGET_SDATA) \
if (TARGET_RELOCATABLE && \
(rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
{ \
{ \
target_flags &= ~MASK_SDATA; \
target_flags &= ~MASK_SDATA; \
rs6000_sdata = SDATA_NONE; \
error ("-mrelocatable and -msdata are incompatible."); \
error ("-mrelocatable and -msdata are incompatible."); \
} \
} \
\
\
...
@@ -729,51 +768,9 @@ do { \
...
@@ -729,51 +768,9 @@ do { \
to readd the prefixes. */
to readd the prefixes. */
#undef ENCODE_SECTION_INFO
#undef ENCODE_SECTION_INFO
#define ENCODE_SECTION_INFO(DECL) \
#define ENCODE_SECTION_INFO(DECL) rs6000_encode_section_info (DECL)
do { \
if (TREE_CODE (DECL) == FUNCTION_DECL) \
extern
void
rs6000_encode_section_info
();
{ \
rtx sym_ref = XEXP (DECL_RTL (DECL), 0); \
if (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL)) \
SYMBOL_REF_FLAG (sym_ref) = 1; \
\
if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
{ \
char *prefix = (DEFAULT_ABI == ABI_AIX) ? "." : ".."; \
char *str = permalloc (strlen (prefix) + 1 \
+ strlen (XSTR (sym_ref, 0))); \
strcpy (str, prefix); \
strcat (str, XSTR (sym_ref, 0)); \
XSTR (sym_ref, 0) = str; \
} \
} \
else if (TARGET_SDATA \
&& (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
&& TREE_CODE (DECL) == VAR_DECL) \
{ \
int size = int_size_in_bytes (TREE_TYPE (DECL)); \
tree section_name = DECL_SECTION_NAME (DECL); \
char *name = ((section_name) \
? IDENTIFIER_POINTER (section_name) \
: (char *)0); \
\
if ((size > 0 && size <= 8) \
|| (name \
&& (strcmp (name, ".sdata") == 0 \
|| strcmp (name, ".sdata2") == 0 \
|| strcmp (name, ".sbss") == 0 \
|| strcmp (name, ".sbss2") == 0 \
|| strcmp (name, ".PPC.EMB.sdata0") == 0 \
|| strcmp (name, ".PPC.EMB.sbss0") == 0))) \
{ \
rtx sym_ref = XEXP (DECL_RTL (DECL), 0); \
char *str = permalloc (2 + strlen (XSTR (sym_ref, 0))); \
strcpy (str, "@"); \
strcat (str, XSTR (sym_ref, 0)); \
XSTR (sym_ref, 0) = str; \
} \
} \
} while (0)
/* This macro gets just the user-specified name
/* This macro gets just the user-specified name
out of the string in a SYMBOL_REF. Discard
out of the string in a SYMBOL_REF. Discard
...
@@ -842,7 +839,8 @@ do { \
...
@@ -842,7 +839,8 @@ do { \
#undef ASM_SPEC
#undef ASM_SPEC
#define ASM_SPEC "-u %(asm_cpu) %{mregnames} \
#define ASM_SPEC "-u %(asm_cpu) %{mregnames} \
%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
%{mrelocatable} %{mrelocatable-lib} %{memb} %{msdata: -memb} \
%{mrelocatable} %{mrelocatable-lib} \
%{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb} \
%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \
%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \
%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
%{mcall-solaris: -mlittle} %{mcall-linux: -mbig} }}}}"
%{mcall-solaris: -mlittle} %{mcall-linux: -mbig} }}}}"
...
@@ -856,6 +854,7 @@ do { \
...
@@ -856,6 +854,7 @@ do { \
%{mcall-solaris: -mlittle } \
%{mcall-solaris: -mlittle } \
%{mcall-linux: -mbig} }}}} \
%{mcall-linux: -mbig} }}}} \
%{mcall-solaris: -mregnames } \
%{mcall-solaris: -mregnames } \
%{mno-sdata: -msdata=none } \
%{meabi: %{!mcall-*: -mcall-sysv }} \
%{meabi: %{!mcall-*: -mcall-sysv }} \
%{!meabi: %{!mno-eabi: \
%{!meabi: %{!mno-eabi: \
%{mcall-solaris: -mno-eabi } \
%{mcall-solaris: -mno-eabi } \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment