Commit 11abc112 by Mark Mitchell Committed by Mark Mitchell

dwarf2out.c (output_call_frame_info): Set SYMBOL_FLAG_LOCAL on generated SYMBOL_REFs for labels.

	* dwarf2out.c (output_call_frame_info): Set SYMBOL_FLAG_LOCAL on
	generated SYMBOL_REFs for labels.
	* config/darwin-protos.h (machopic_validate_stub_or_non_lazy_ptr):
	Change prototype.
	(machopic_stub_name): Remove.
	(machopic_indirection_name): New function.
	(machopic_mcount_stub_name): Likewise.
	(machopic_classify_name): Remove.
	(machopic_function_base_sym): New function.
	(machpoic_classify_symbol): Likewise.
	(machopic_classify_ident): Remove.
	(machopic_define_ident): Likewise.
	(machopic_define_name): Likewise.
	(machopic_name_defined_p): Likewise.
	(machopic_ident_defined_p): Likewise.
	(darwin_strip_name_encoding): Likewise.
	(machopic_define_symbol): New function.
	* config/darwin.c (hashtab.h): Include.
	(machopic_defined_list): Remove.
	(machopic_classify_ident): Likewise.
	(machopic_classify_name): Likewise.
	(machopic_ident_defined_p): Likewise.
	(machopic_define_ident): Likewise.
	(machopic_define_name): Likewise.
	(machopic_symbol_defined_p): New function.
	(machopic_classify_symbol): Likewise.
	(machopic_data_defined_p): Use machopic_classify_symbol.
	(machopic_define_symbol): New function.
	(machopic_function_base_sym): New function.
	(machopic_non_lazy_pointers): Remove.
	(machopic_non_lazy_ptr_name): Likewise.
	(machopic_stubs): Likewise.
	(machopic_stub_name): Likewise.
	(NON_LAZY_POINTER_SUFFIX): New macro.
	(STUB_SUFFIX): Likewise.
	(machopic_indirection): New structure.
	(machopic_indirections): New variable.
	(machopic_indirection_hash): New function.
	(machopic_indirection_eq): Likewise.
	(machopic_indirection_name): Likewise.
	(machopic_mcount_stub_name): New function.
	(machopic_validate_stub_or_non_lazy_pointer): Reimplement to use
	hash table.
	(machopic_indirect_data_reference): Rework to use new functions.
	(machopic_indirect_call_target): Likewise.
	(machopic_legitimize_pic_address): Likewise.
	(machopic_output_indirection): New function.
	(machopic_finish): Use it.
	(machopic_operand_p): Rework to use new functions.
	(darwin_encode_seciton_info): Use SYMBOL_REF_FLAGS.
	(darwin_strip_name_encoding): Remove.
	(update_non_lazy_ptrs): Remove.
	(update_stubs): Likewise.
	(darwin_non_lazy_pcrel): Use new functions.
	* config/darwin.h (ASM_DECLARE_OBJECT_NAME): Likewise.
	(ASM_OUTPUT_LABELREF): Likewise.
	(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Likewise.
	(MACHO_SYMBOL_FLAG_VARIABLE): New macro.
	(MACHO_SYMBOL_FLAG_DEFINED): Likewise.
	(TARGET_STRIP_NAME_ENCODING): Do not use
	darwin_strip_name_encoding.
	(GEN_LAZY_PTR_NAME_FOR_SYMBOL): Do not use
	darwin_strip_name_encoding.
	* config/i386/darwin.h (FUNCTION_PROFILER): Use
	machopic_mcount_stub_name.
	* config/i386/i386.c (x86_output_mi_thunk): Use
	machopic_indirection_name, not machopic_stub_name.
	* config/rs6000/rs6000.c (rs6000_legitimize_reload_address): Use
	machopic_function_base_sym.
	(print_operand): Use machopic_classify_symbol.
	(rs6000_emit_prologue): Use machopic_function_base_sym.
	(output_profile_hook): Do not use machopic_stub_name.
	(macho_branch_isalnds): Do not use darwin_strip_name_encoding.

From-SVN: r85071
parent f1f90ae0
2004-07-22 Mark Mitchell <mark@codesourcery.com>
* dwarf2out.c (output_call_frame_info): Set SYMBOL_FLAG_LOCAL on
generated SYMBOL_REFs for labels.
* config/darwin-protos.h (machopic_validate_stub_or_non_lazy_ptr):
Change prototype.
(machopic_stub_name): Remove.
(machopic_indirection_name): New function.
(machopic_mcount_stub_name): Likewise.
(machopic_classify_name): Remove.
(machopic_function_base_sym): New function.
(machpoic_classify_symbol): Likewise.
(machopic_classify_ident): Remove.
(machopic_define_ident): Likewise.
(machopic_define_name): Likewise.
(machopic_name_defined_p): Likewise.
(machopic_ident_defined_p): Likewise.
(darwin_strip_name_encoding): Likewise.
(machopic_define_symbol): New function.
* config/darwin.c (hashtab.h): Include.
(machopic_defined_list): Remove.
(machopic_classify_ident): Likewise.
(machopic_classify_name): Likewise.
(machopic_ident_defined_p): Likewise.
(machopic_define_ident): Likewise.
(machopic_define_name): Likewise.
(machopic_symbol_defined_p): New function.
(machopic_classify_symbol): Likewise.
(machopic_data_defined_p): Use machopic_classify_symbol.
(machopic_define_symbol): New function.
(machopic_function_base_sym): New function.
(machopic_non_lazy_pointers): Remove.
(machopic_non_lazy_ptr_name): Likewise.
(machopic_stubs): Likewise.
(machopic_stub_name): Likewise.
(NON_LAZY_POINTER_SUFFIX): New macro.
(STUB_SUFFIX): Likewise.
(machopic_indirection): New structure.
(machopic_indirections): New variable.
(machopic_indirection_hash): New function.
(machopic_indirection_eq): Likewise.
(machopic_indirection_name): Likewise.
(machopic_mcount_stub_name): New function.
(machopic_validate_stub_or_non_lazy_pointer): Reimplement to use
hash table.
(machopic_indirect_data_reference): Rework to use new functions.
(machopic_indirect_call_target): Likewise.
(machopic_legitimize_pic_address): Likewise.
(machopic_output_indirection): New function.
(machopic_finish): Use it.
(machopic_operand_p): Rework to use new functions.
(darwin_encode_seciton_info): Use SYMBOL_REF_FLAGS.
(darwin_strip_name_encoding): Remove.
(update_non_lazy_ptrs): Remove.
(update_stubs): Likewise.
(darwin_non_lazy_pcrel): Use new functions.
* config/darwin.h (ASM_DECLARE_OBJECT_NAME): Likewise.
(ASM_OUTPUT_LABELREF): Likewise.
(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Likewise.
(MACHO_SYMBOL_FLAG_VARIABLE): New macro.
(MACHO_SYMBOL_FLAG_DEFINED): Likewise.
(TARGET_STRIP_NAME_ENCODING): Do not use
darwin_strip_name_encoding.
(GEN_LAZY_PTR_NAME_FOR_SYMBOL): Do not use
darwin_strip_name_encoding.
* config/i386/darwin.h (FUNCTION_PROFILER): Use
machopic_mcount_stub_name.
* config/i386/i386.c (x86_output_mi_thunk): Use
machopic_indirection_name, not machopic_stub_name.
* config/rs6000/rs6000.c (rs6000_legitimize_reload_address): Use
machopic_function_base_sym.
(print_operand): Use machopic_classify_symbol.
(rs6000_emit_prologue): Use machopic_function_base_sym.
(output_profile_hook): Do not use machopic_stub_name.
(macho_branch_isalnds): Do not use darwin_strip_name_encoding.
2004-07-22 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/7284
......
......@@ -20,11 +20,12 @@ Boston, MA 02111-1307, USA. */
extern int name_needs_quotes (const char *);
extern void machopic_validate_stub_or_non_lazy_ptr (const char *, int);
extern void machopic_validate_stub_or_non_lazy_ptr (const char *);
extern const char *machopic_function_base_name (void);
extern void machopic_output_function_base_name (FILE *);
extern const char *machopic_stub_name (const char*);
extern const char *machopic_indirection_name (rtx, bool);
extern const char *machopic_mcount_stub_name (void);
extern void machopic_picsymbol_stub_section (void);
extern void machopic_picsymbol_stub1_section (void);
......@@ -40,8 +41,9 @@ extern void mod_term_section (void);
#ifdef RTX_CODE
extern rtx machopic_function_base_sym (void);
extern int machopic_operand_p (rtx);
extern enum machopic_addr_class machopic_classify_name (const char*);
extern enum machopic_addr_class machopic_classify_symbol (rtx);
extern rtx machopic_indirect_data_reference (rtx, rtx);
extern rtx machopic_indirect_call_target (rtx);
......@@ -53,13 +55,8 @@ extern void machopic_asm_out_destructor (rtx, int);
#ifdef TREE_CODE
extern enum machopic_addr_class machopic_classify_ident (tree);
extern void machopic_define_ident (tree);
extern void machopic_define_name (const char*);
extern int machopic_name_defined_p (const char*);
extern int machopic_ident_defined_p (tree);
extern void machopic_define_symbol (rtx);
extern void darwin_encode_section_info (tree, rtx, int);
extern const char *darwin_strip_name_encoding (const char *);
#endif /* TREE_CODE */
......
......@@ -413,7 +413,7 @@ do { text_section (); \
/* The RTTI data (e.g., __ti4name) is common and public (and static),
but it does need to be referenced via indirect PIC data pointers.
The machopic_define_name calls are telling the machopic subsystem
The machopic_define_symbol calls are telling the machopic subsystem
that the name *is* defined in this module, so it doesn't need to
make them indirect. */
......@@ -427,7 +427,7 @@ do { text_section (); \
if ((TREE_STATIC (DECL) \
&& (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
|| DECL_INITIAL (DECL)) \
machopic_define_name (xname); \
machopic_define_symbol (DECL_RTL (DECL)); \
if ((TREE_STATIC (DECL) \
&& (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
|| DECL_INITIAL (DECL)) \
......@@ -448,7 +448,7 @@ do { text_section (); \
if ((TREE_STATIC (DECL) \
&& (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
|| DECL_INITIAL (DECL)) \
machopic_define_name (xname); \
machopic_define_symbol (DECL_RTL (DECL)); \
if ((TREE_STATIC (DECL) \
&& (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
|| DECL_INITIAL (DECL)) \
......@@ -471,18 +471,18 @@ do { text_section (); \
#undef ASM_OUTPUT_LABELREF
#define ASM_OUTPUT_LABELREF(FILE,NAME) \
do { \
const char *xname = darwin_strip_name_encoding (NAME); \
const char *xname = (NAME); \
if (! strcmp (xname, "<pic base>")) \
machopic_output_function_base_name(FILE); \
else if (xname[0] == '&' || xname[0] == '*') \
{ \
int len = strlen (xname); \
if (len > 6 && !strcmp ("$stub", xname + len - 5)) \
machopic_validate_stub_or_non_lazy_ptr (xname, 1); \
machopic_validate_stub_or_non_lazy_ptr (xname); \
else if (len > 7 && !strcmp ("$stub\"", xname + len - 6)) \
machopic_validate_stub_or_non_lazy_ptr (xname, 1); \
machopic_validate_stub_or_non_lazy_ptr (xname); \
else if (len > 14 && !strcmp ("$non_lazy_ptr", xname + len - 13)) \
machopic_validate_stub_or_non_lazy_ptr (xname, 0); \
machopic_validate_stub_or_non_lazy_ptr (xname); \
fputs (&xname[1], FILE); \
} \
else if (xname[0] == '+' || xname[0] == '-') \
......@@ -514,7 +514,7 @@ do { text_section (); \
/* Ensure correct alignment of bss data. */
#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
do { \
fputs (".lcomm ", (FILE)); \
......@@ -524,11 +524,10 @@ do { text_section (); \
if ((DECL) && ((TREE_STATIC (DECL) \
&& (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
|| DECL_INITIAL (DECL))) \
(* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false); \
if ((DECL) && ((TREE_STATIC (DECL) \
&& (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
|| DECL_INITIAL (DECL))) \
machopic_define_name (NAME); \
{ \
(* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false); \
machopic_define_symbol (DECL_RTL (DECL)); \
} \
} while (0)
/* The maximum alignment which the object file format can support.
......@@ -791,6 +790,12 @@ objc_section_init (void) \
#define JUMP_TABLES_IN_TEXT_SECTION 1
#endif
/* Set on a symbol with SYMBOL_FLAG_FUNCTION or
MACHO_SYMBOL_FLAG_VARIABLE to indicate that the function or
variable has been defined in this translation unit. */
#define MACHO_SYMBOL_FLAG_VARIABLE (SYMBOL_FLAG_MACH_DEP)
#define MACHO_SYMBOL_FLAG_DEFINED ((SYMBOL_FLAG_MACH_DEP) << 1)
/* Symbolic names for various things we might know about a symbol. */
enum machopic_addr_class {
......@@ -811,7 +816,7 @@ enum machopic_addr_class {
#undef TARGET_ENCODE_SECTION_INFO
#define TARGET_ENCODE_SECTION_INFO darwin_encode_section_info
#undef TARGET_STRIP_NAME_ENCODING
#define TARGET_STRIP_NAME_ENCODING darwin_strip_name_encoding
#define TARGET_STRIP_NAME_ENCODING default_strip_name_encoding
#define GEN_BINDER_NAME_FOR_STUB(BUF,STUB,STUB_LENGTH) \
do { \
......@@ -847,7 +852,7 @@ enum machopic_addr_class {
#define GEN_LAZY_PTR_NAME_FOR_SYMBOL(BUF,SYMBOL,SYMBOL_LENGTH) \
do { \
const char *symbol_ = darwin_strip_name_encoding (SYMBOL); \
const char *symbol_ = (SYMBOL); \
char *buffer_ = (BUF); \
if (symbol_[0] == '"') \
{ \
......
......@@ -143,9 +143,9 @@ Boston, MA 02111-1307, USA. */
do { \
if (MACHOPIC_INDIRECT) \
{ \
const char *name = machopic_stub_name ("*mcount"); \
const char *name = machopic_mcount_stub_name (); \
fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \
machopic_validate_stub_or_non_lazy_ptr (name, /*stub:*/1); \
machopic_validate_stub_or_non_lazy_ptr (name); \
} \
else fprintf (FILE, "\tcall mcount\n"); \
} while (0)
......@@ -15521,8 +15521,10 @@ x86_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED,
#if TARGET_MACHO
if (TARGET_MACHO)
{
const char *ip = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (function));
tmp = gen_rtx_SYMBOL_REF (Pmode, machopic_stub_name (ip));
rtx sym_ref = XEXP (DECL_RTL (function), 0);
tmp = (gen_rtx_SYMBOL_REF
(Pmode,
machopic_indirection_name (sym_ref, /*stub_p=*/true)));
tmp = gen_rtx_MEM (QImode, tmp);
xops[0] = tmp;
output_asm_insn ("jmp\t%0", xops);
......
......@@ -3675,8 +3675,7 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode,
{
rtx offset = gen_rtx_CONST (Pmode,
gen_rtx_MINUS (Pmode, x,
gen_rtx_SYMBOL_REF (Pmode,
machopic_function_base_name ())));
machopic_function_base_sym ()));
x = gen_rtx_LO_SUM (GET_MODE (x),
gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
gen_rtx_HIGH (Pmode, offset)), offset);
......@@ -10092,8 +10091,8 @@ print_operand (FILE *file, rtx x, int code)
const char *name = XSTR (x, 0);
#if TARGET_MACHO
if (MACHOPIC_INDIRECT
&& machopic_classify_name (name) == MACHOPIC_UNDEFINED_FUNCTION)
name = machopic_stub_name (name);
&& machopic_classify_symbol (x) == MACHOPIC_UNDEFINED_FUNCTION)
name = machopic_indirection_name (x, /*stub_p=*/true);
#endif
assemble_name (file, name);
}
......@@ -12958,8 +12957,7 @@ rs6000_emit_prologue (void)
&& flag_pic && current_function_uses_pic_offset_table)
{
rtx lr = gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM);
const char *picbase = machopic_function_base_name ();
rtx src = gen_rtx_SYMBOL_REF (Pmode, picbase);
rtx src = machopic_function_base_sym ();
rs6000_maybe_dead (emit_insn (gen_load_macho_picbase (lr, src)));
......@@ -14456,12 +14454,9 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED)
#if TARGET_MACHO
/* For PIC code, set up a stub and collect the caller's address
from r0, which is where the prologue puts it. */
if (MACHOPIC_INDIRECT)
{
mcount_name = machopic_stub_name (mcount_name);
if (current_function_uses_pic_offset_table)
caller_addr_regno = 0;
}
if (MACHOPIC_INDIRECT
&& current_function_uses_pic_offset_table)
caller_addr_regno = 0;
#endif
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mcount_name),
0, VOIDmode, 1,
......@@ -15902,8 +15897,7 @@ macho_branch_islands (void)
const char *label =
IDENTIFIER_POINTER (BRANCH_ISLAND_LABEL_NAME (branch_island));
const char *name =
darwin_strip_name_encoding (
IDENTIFIER_POINTER (BRANCH_ISLAND_FUNCTION_NAME (branch_island)));
IDENTIFIER_POINTER (BRANCH_ISLAND_FUNCTION_NAME (branch_island));
char name_buf[512];
/* Cheap copy of the details from the Darwin ASM_OUTPUT_LABELREF(). */
if (name[0] == '*' || name[0] == '&')
......
......@@ -2265,9 +2265,13 @@ output_call_frame_info (int for_eh)
(DECL_ASSEMBLER_NAME (fde->decl))),
"FDE initial location");
else
dw2_asm_output_encoded_addr_rtx (fde_encoding,
gen_rtx_SYMBOL_REF (Pmode, fde->dw_fde_begin),
"FDE initial location");
{
rtx sym_ref = gen_rtx_SYMBOL_REF (Pmode, fde->dw_fde_begin);
SYMBOL_REF_FLAGS (sym_ref) |= SYMBOL_FLAG_LOCAL;
dw2_asm_output_encoded_addr_rtx (fde_encoding,
sym_ref,
"FDE initial location");
}
dw2_asm_output_delta (size_of_encoded_value (fde_encoding),
fde->dw_fde_end, fde->dw_fde_begin,
"FDE address range");
......
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