Commit 5bff1750 by Jeff Law

pa.h (readonly_section): During PIC code generation, put readonly data into the…

pa.h (readonly_section): During PIC code generation, put readonly data into the standard data section.

	* pa.h (readonly_section): During PIC code generation, put
	readonly data into the standard data section.

	* pa.c (pic_label_operand): Disallow SYMBOL_REFs (constant data).

From-SVN: r8661
parent 1c688cd7
...@@ -235,14 +235,9 @@ pic_label_operand (op, mode) ...@@ -235,14 +235,9 @@ pic_label_operand (op, mode)
{ {
case LABEL_REF: case LABEL_REF:
return 1; return 1;
case SYMBOL_REF:
return (read_only_operand (op) && !FUNCTION_NAME_P (XSTR (op, 0)));
case CONST: case CONST:
op = XEXP (op, 0); op = XEXP (op, 0);
return (((GET_CODE (XEXP (op, 0)) == SYMBOL_REF return (GET_CODE (XEXP (op, 0)) == LABEL_REF
&& read_only_operand (XEXP (op, 0))
&& !FUNCTION_NAME_P (XSTR (XEXP (op, 0), 0)))
|| GET_CODE (XEXP (op, 0)) == LABEL_REF)
&& GET_CODE (XEXP (op, 1)) == CONST_INT); && GET_CODE (XEXP (op, 1)) == CONST_INT);
default: default:
return 0; return 0;
...@@ -477,7 +472,7 @@ legitimize_pic_address (orig, mode, reg) ...@@ -477,7 +472,7 @@ legitimize_pic_address (orig, mode, reg)
{ {
rtx pic_ref = orig; rtx pic_ref = orig;
/* Lables and read-only data need special handling. */ /* Lables need special handling. */
if (pic_label_operand (orig)) if (pic_label_operand (orig))
{ {
emit_insn (gen_pic_load_label (reg, orig)); emit_insn (gen_pic_load_label (reg, orig));
......
...@@ -1728,10 +1728,19 @@ do { fprintf (FILE, "\t.SPACE $PRIVATE$\n\ ...@@ -1728,10 +1728,19 @@ do { fprintf (FILE, "\t.SPACE $PRIVATE$\n\
#define EXTRA_SECTIONS in_bss, in_readonly_data #define EXTRA_SECTIONS in_bss, in_readonly_data
/* FIXME: GAS doesn't grok expressions involving two symbols in different /* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups
segments (aka subspaces). Two avoid creating such expressions, we place which reference data within the $TEXT$ space (for example constant
readonly data into the $CODE$ subspace when generating PIC code. If strings in the $LIT$ subspace).
GAS ever handles such expressions, this hack can disappear. */
The assemblers (GAS and HP as) both have problems with handling
the difference of two symbols which is the other correct way to
reference constant data during PIC code generation.
So, there's no way to reference constant data which is in the
$TEXT$ space during PIC generation. Instead place all constant
data into the $PRIVATE$ subspace (this reduces sharing, but it
works correctly). */
#define EXTRA_SECTION_FUNCTIONS \ #define EXTRA_SECTION_FUNCTIONS \
void \ void \
bss_section () \ bss_section () \
...@@ -1748,7 +1757,7 @@ readonly_data () \ ...@@ -1748,7 +1757,7 @@ readonly_data () \
if (in_section != in_readonly_data) \ if (in_section != in_readonly_data) \
{ \ { \
if (flag_pic) \ if (flag_pic) \
fprintf (asm_out_file, "%s\n", TEXT_SECTION_ASM_OP); \ fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP); \
else \ else \
fprintf (asm_out_file, "%s\n", READONLY_DATA_ASM_OP); \ fprintf (asm_out_file, "%s\n", READONLY_DATA_ASM_OP); \
in_section = in_readonly_data; \ in_section = in_readonly_data; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment