Darwin - strip trailing whitespace from a file, NFC.
2019-06-18 Iain Sandoe <iain@sandoe.co.uk> * config/darwin.c: Strip trailing whitespace. From-SVN: r272410
This commit is contained in:
parent
dbe89f49da
commit
a9e47ccf26
2 changed files with 131 additions and 127 deletions
|
@ -1,3 +1,7 @@
|
|||
2019-06-18 Iain Sandoe <iain@sandoe.co.uk>
|
||||
|
||||
* config/darwin.c: Strip trailing whitespace.
|
||||
|
||||
2019-06-18 Iain Sandoe <iain@sandoe.co.uk>
|
||||
|
||||
* config/darwin.c (darwin_emit_unwind_label): New default to false.
|
||||
|
|
|
@ -115,7 +115,7 @@ section * darwin_sections[NUM_DARWIN_SECTIONS];
|
|||
/* True if we're setting __attribute__ ((ms_struct)). */
|
||||
int darwin_ms_struct = false;
|
||||
|
||||
/* Earlier versions of Darwin as do not recognize an alignment field in
|
||||
/* Earlier versions of Darwin as do not recognize an alignment field in
|
||||
.comm directives, this should be set for versions that allow it. */
|
||||
int emit_aligned_common = false;
|
||||
|
||||
|
@ -127,8 +127,8 @@ output_objc_section_asm_op (const void *directive)
|
|||
{
|
||||
static bool been_here = false;
|
||||
|
||||
/* The NeXT ObjC Runtime requires these sections to be present and in
|
||||
order in the object. The code below implements this by emitting
|
||||
/* The NeXT ObjC Runtime requires these sections to be present and in
|
||||
order in the object. The code below implements this by emitting
|
||||
a section header for each ObjC section the first time that an ObjC
|
||||
section is requested. */
|
||||
if (! been_here)
|
||||
|
@ -238,7 +238,7 @@ name_needs_quotes (const char *name)
|
|||
{
|
||||
int c;
|
||||
while ((c = *name++) != '\0')
|
||||
if (! ISIDNUM (c)
|
||||
if (! ISIDNUM (c)
|
||||
&& c != '.' && c != '$' && c != '_' )
|
||||
return 1;
|
||||
return 0;
|
||||
|
@ -710,8 +710,8 @@ machopic_indirect_data_reference (rtx orig, rtx reg)
|
|||
ptr_ref = gen_const_mem (Pmode, ptr_ref);
|
||||
machopic_define_symbol (ptr_ref);
|
||||
|
||||
if (DARWIN_X86
|
||||
&& reg
|
||||
if (DARWIN_X86
|
||||
&& reg
|
||||
&& MACHO_DYNAMIC_NO_PIC_P)
|
||||
{
|
||||
emit_insn (gen_rtx_SET (reg, ptr_ref));
|
||||
|
@ -727,12 +727,12 @@ machopic_indirect_data_reference (rtx orig, rtx reg)
|
|||
appropriate. */
|
||||
if (GET_CODE (XEXP (orig, 0)) == PLUS)
|
||||
return machopic_indirect_data_reference (XEXP (orig, 0), reg);
|
||||
else
|
||||
else
|
||||
return orig;
|
||||
}
|
||||
else if (GET_CODE (orig) == MEM)
|
||||
{
|
||||
XEXP (ptr_ref, 0) =
|
||||
XEXP (ptr_ref, 0) =
|
||||
machopic_indirect_data_reference (XEXP (orig, 0), reg);
|
||||
return ptr_ref;
|
||||
}
|
||||
|
@ -1262,8 +1262,8 @@ static section *
|
|||
darwin_mergeable_string_section (tree exp,
|
||||
unsigned HOST_WIDE_INT align)
|
||||
{
|
||||
/* Darwin's ld expects to see non-writable string literals in the .cstring
|
||||
section. Later versions of ld check and complain when CFStrings are
|
||||
/* Darwin's ld expects to see non-writable string literals in the .cstring
|
||||
section. Later versions of ld check and complain when CFStrings are
|
||||
enabled. Therefore we shall force the strings into .cstring since we
|
||||
don't support writable ones anyway. */
|
||||
if ((darwin_constant_cfstrings || flag_merge_constants)
|
||||
|
@ -1296,8 +1296,8 @@ darwin_mergeable_constant_section (tree exp,
|
|||
machine_mode mode = DECL_MODE (exp);
|
||||
unsigned int modesize = GET_MODE_BITSIZE (mode);
|
||||
|
||||
if (DARWIN_SECTION_ANCHORS
|
||||
&& flag_section_anchors
|
||||
if (DARWIN_SECTION_ANCHORS
|
||||
&& flag_section_anchors
|
||||
&& zsize)
|
||||
return darwin_sections[zobj_const_section];
|
||||
|
||||
|
@ -1343,14 +1343,14 @@ machopic_reloc_rw_mask (void)
|
|||
|
||||
/* We have to deal with ObjC/C++ metadata section placement in the common
|
||||
code, since it will also be called from LTO.
|
||||
|
||||
|
||||
Return metadata attributes, if present (searching for ABI=2 first)
|
||||
Return NULL_TREE if no such attributes are found. */
|
||||
|
||||
static tree
|
||||
is_objc_metadata (tree decl)
|
||||
{
|
||||
if (DECL_P (decl)
|
||||
if (DECL_P (decl)
|
||||
&& (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == CONST_DECL)
|
||||
&& DECL_ATTRIBUTES (decl))
|
||||
{
|
||||
|
@ -1529,11 +1529,11 @@ machopic_select_section (tree decl,
|
|||
&& !lookup_attribute ("weak_import", DECL_ATTRIBUTES (decl)));
|
||||
|
||||
zsize = (DECL_P (decl)
|
||||
&& (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == CONST_DECL)
|
||||
&& (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == CONST_DECL)
|
||||
&& tree_to_uhwi (DECL_SIZE_UNIT (decl)) == 0);
|
||||
|
||||
one = DECL_P (decl)
|
||||
&& TREE_CODE (decl) == VAR_DECL
|
||||
&& TREE_CODE (decl) == VAR_DECL
|
||||
&& DECL_COMDAT_GROUP (decl);
|
||||
|
||||
use_coal = (weak || one) && ld_uses_coal_sects;
|
||||
|
@ -1574,17 +1574,17 @@ machopic_select_section (tree decl,
|
|||
{
|
||||
if (ro)
|
||||
base_section = darwin_sections[const_data_coal_section];
|
||||
else
|
||||
else
|
||||
base_section = darwin_sections[data_coal_section];
|
||||
}
|
||||
else if (DARWIN_SECTION_ANCHORS
|
||||
else if (DARWIN_SECTION_ANCHORS
|
||||
&& flag_section_anchors
|
||||
&& zsize)
|
||||
{
|
||||
/* If we're doing section anchors, then punt zero-sized objects into
|
||||
their own sections so that they don't interfere with offset
|
||||
computation for the remaining vars. This does not need to be done
|
||||
for stuff in mergeable sections, since these are ineligible for
|
||||
for stuff in mergeable sections, since these are ineligible for
|
||||
anchors. */
|
||||
if (ro)
|
||||
base_section = darwin_sections[zobj_const_data_section];
|
||||
|
@ -1616,10 +1616,10 @@ machopic_select_section (tree decl,
|
|||
gcc_unreachable ();
|
||||
}
|
||||
|
||||
/* Darwin weird special cases.
|
||||
/* Darwin weird special cases.
|
||||
a) OBJC Meta-data. */
|
||||
if (DECL_P (decl)
|
||||
&& (TREE_CODE (decl) == VAR_DECL
|
||||
if (DECL_P (decl)
|
||||
&& (TREE_CODE (decl) == VAR_DECL
|
||||
|| TREE_CODE (decl) == CONST_DECL)
|
||||
&& DECL_ATTRIBUTES (decl))
|
||||
{
|
||||
|
@ -1671,10 +1671,10 @@ machopic_select_section (tree decl,
|
|||
{
|
||||
const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
|
||||
static bool warned_objc_46 = false;
|
||||
/* We shall assert that zero-sized objects are an error in ObjC
|
||||
/* We shall assert that zero-sized objects are an error in ObjC
|
||||
meta-data. */
|
||||
gcc_assert (tree_to_uhwi (DECL_SIZE_UNIT (decl)) != 0);
|
||||
|
||||
|
||||
/* ??? This mechanism for determining the metadata section is
|
||||
broken when LTO is in use, since the frontend that generated
|
||||
the data is not identified. We will keep the capability for
|
||||
|
@ -1688,7 +1688,7 @@ machopic_select_section (tree decl,
|
|||
" and will be removed in 4.7");
|
||||
warned_objc_46 = true;
|
||||
}
|
||||
|
||||
|
||||
if (!strncmp (name, "_OBJC_CLASS_METHODS_", 20))
|
||||
return darwin_sections[objc_cls_meth_section];
|
||||
else if (!strncmp (name, "_OBJC_INSTANCE_METHODS_", 23))
|
||||
|
@ -1814,12 +1814,12 @@ sort_cdtor_records (const void * a, const void * b)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
finalize_ctors ()
|
||||
{
|
||||
unsigned int i;
|
||||
cdtor_record *elt;
|
||||
|
||||
|
||||
if (MACHOPIC_INDIRECT)
|
||||
switch_to_section (darwin_sections[mod_init_section]);
|
||||
else
|
||||
|
@ -1861,11 +1861,11 @@ darwin_globalize_label (FILE *stream, const char *name)
|
|||
default_globalize_label (stream, name);
|
||||
}
|
||||
|
||||
/* This routine returns non-zero if 'name' starts with the special objective-c
|
||||
anonymous file-scope static name. It accommodates c++'s mangling of such
|
||||
/* This routine returns non-zero if 'name' starts with the special objective-c
|
||||
anonymous file-scope static name. It accommodates c++'s mangling of such
|
||||
symbols (in this case the symbols will have form _ZL{d}*_OBJC_* d=digit). */
|
||||
|
||||
int
|
||||
|
||||
int
|
||||
darwin_label_is_anonymous_local_objc_name (const char *name)
|
||||
{
|
||||
const unsigned char *p = (const unsigned char *) name;
|
||||
|
@ -2083,19 +2083,19 @@ darwin_emit_unwind_label (FILE *file, tree decl, int for_eh, int empty)
|
|||
char buf[32];
|
||||
static int invok_count = 0;
|
||||
static tree last_fun_decl = NULL_TREE;
|
||||
|
||||
|
||||
/* Modern linkers can produce distinct FDEs without compiler support. */
|
||||
if (! for_eh || ! ld_needs_eh_markers)
|
||||
return;
|
||||
|
||||
/* FIXME: This only works when the eh for all sections of a function are
|
||||
/* FIXME: This only works when the eh for all sections of a function are
|
||||
emitted at the same time. If that changes, we would need to use a lookup
|
||||
table of some form to determine what to do. Also, we should emit the
|
||||
unadorned label for the partition containing the public label for a
|
||||
function. This is of limited use, probably, since we do not currently
|
||||
enable partitioning. */
|
||||
strcpy (buf, ".eh");
|
||||
if (decl && TREE_CODE (decl) == FUNCTION_DECL)
|
||||
if (decl && TREE_CODE (decl) == FUNCTION_DECL)
|
||||
{
|
||||
if (decl == last_fun_decl)
|
||||
{
|
||||
|
@ -2191,8 +2191,8 @@ darwin_non_lazy_pcrel (FILE *file, rtx addr)
|
|||
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. */
|
||||
void
|
||||
darwin_asm_declare_object_name (FILE *file,
|
||||
void
|
||||
darwin_asm_declare_object_name (FILE *file,
|
||||
const char *nam, tree decl)
|
||||
{
|
||||
const char *xname = nam;
|
||||
|
@ -2201,11 +2201,11 @@ darwin_asm_declare_object_name (FILE *file,
|
|||
|
||||
weak = (DECL_P (decl)
|
||||
&& DECL_WEAK (decl)
|
||||
&& !lookup_attribute ("weak_import",
|
||||
&& !lookup_attribute ("weak_import",
|
||||
DECL_ATTRIBUTES (decl)));
|
||||
|
||||
local_def = DECL_INITIAL (decl) || (TREE_STATIC (decl)
|
||||
&& (!DECL_COMMON (decl)
|
||||
local_def = DECL_INITIAL (decl) || (TREE_STATIC (decl)
|
||||
&& (!DECL_COMMON (decl)
|
||||
|| !TREE_PUBLIC (decl)));
|
||||
|
||||
if (GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
|
||||
|
@ -2223,17 +2223,17 @@ darwin_asm_declare_object_name (FILE *file,
|
|||
#ifdef DEBUG_DARWIN_MEM_ALLOCATORS
|
||||
fprintf (file, "# dadon: %s %s (%llu, %u) local %d weak %d"
|
||||
" stat %d com %d pub %d t-const %d t-ro %d init %lx\n",
|
||||
xname, (TREE_CODE (decl) == VAR_DECL?"var":"const"),
|
||||
(unsigned long long)size, DECL_ALIGN (decl), local_def,
|
||||
xname, (TREE_CODE (decl) == VAR_DECL?"var":"const"),
|
||||
(unsigned long long)size, DECL_ALIGN (decl), local_def,
|
||||
DECL_WEAK (decl), TREE_STATIC (decl), DECL_COMMON (decl),
|
||||
TREE_PUBLIC (decl), TREE_CONSTANT (decl), TREE_READONLY (decl),
|
||||
(unsigned long)DECL_INITIAL (decl));
|
||||
(unsigned long)DECL_INITIAL (decl));
|
||||
#endif
|
||||
|
||||
/* Darwin needs help to support local zero-sized objects.
|
||||
/* Darwin needs help to support local zero-sized objects.
|
||||
They must be made at least one byte, and the section containing must be
|
||||
marked as unsuitable for section-anchors (see storage allocators below).
|
||||
|
||||
|
||||
For non-zero objects this output is handled by varasm.c.
|
||||
*/
|
||||
if (!size)
|
||||
|
@ -2254,7 +2254,7 @@ fprintf (file, "# dadon: %s %s (%llu, %u) local %d weak %d"
|
|||
/* Check that we've correctly picked up the zero-sized item and placed it
|
||||
properly. */
|
||||
gcc_assert ((!DARWIN_SECTION_ANCHORS || !flag_section_anchors)
|
||||
|| (in_section
|
||||
|| (in_section
|
||||
&& (in_section->common.flags & SECTION_NO_ANCHOR)));
|
||||
}
|
||||
else
|
||||
|
@ -2275,7 +2275,7 @@ darwin_asm_declare_constant_name (FILE *file, const char *name,
|
|||
/* Check that we've correctly picked up the zero-sized item and placed it
|
||||
properly. */
|
||||
gcc_assert ((!DARWIN_SECTION_ANCHORS || !flag_section_anchors)
|
||||
|| (in_section
|
||||
|| (in_section
|
||||
&& (in_section->common.flags & SECTION_NO_ANCHOR)));
|
||||
}
|
||||
}
|
||||
|
@ -2301,7 +2301,7 @@ darwin_asm_declare_constant_name (FILE *file, const char *name,
|
|||
/* Emit a chunk of data for items coalesced by the linker. */
|
||||
static void
|
||||
darwin_emit_weak_or_comdat (FILE *fp, tree decl, const char *name,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
bool use_coal,
|
||||
unsigned int align)
|
||||
{
|
||||
|
@ -2323,7 +2323,7 @@ darwin_emit_weak_or_comdat (FILE *fp, tree decl, const char *name,
|
|||
if (TREE_PUBLIC (decl))
|
||||
darwin_globalize_label (fp, name);
|
||||
|
||||
/* ... and we let it deal with outputting one byte of zero for them too. */
|
||||
/* ... and we let it deal with outputting one byte of zero for them too. */
|
||||
darwin_asm_declare_object_name (fp, name, decl);
|
||||
if (size)
|
||||
assemble_zeros (size);
|
||||
|
@ -2332,7 +2332,7 @@ darwin_emit_weak_or_comdat (FILE *fp, tree decl, const char *name,
|
|||
/* Emit a chunk of data for ObjC meta-data that got placed in BSS erroneously. */
|
||||
static void
|
||||
darwin_emit_objc_zeroed (FILE *fp, tree decl, const char *name,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
unsigned int align, tree meta)
|
||||
{
|
||||
section *ocs = data_section;
|
||||
|
@ -2348,14 +2348,14 @@ darwin_emit_objc_zeroed (FILE *fp, tree decl, const char *name,
|
|||
gcc_assert (size);
|
||||
fprintf (fp, "\t.align\t%d\n", floor_log2 (align / BITS_PER_UNIT));
|
||||
|
||||
/* ... and we let it deal with outputting one byte of zero for them too. */
|
||||
/* ... and we let it deal with outputting one byte of zero for them too. */
|
||||
darwin_asm_declare_object_name (fp, name, decl);
|
||||
assemble_zeros (size);
|
||||
}
|
||||
|
||||
/* This routine emits 'local' storage:
|
||||
|
||||
When Section Anchors are off this routine emits .zerofill commands in
|
||||
When Section Anchors are off this routine emits .zerofill commands in
|
||||
sections named for their alignment.
|
||||
|
||||
When Section Anchors are on, smaller (non-zero-sized) items are placed in
|
||||
|
@ -2364,8 +2364,8 @@ darwin_emit_objc_zeroed (FILE *fp, tree decl, const char *name,
|
|||
The routine has no checking - it is all assumed to be done by the caller.
|
||||
*/
|
||||
static void
|
||||
darwin_emit_local_bss (FILE *fp, tree decl, const char *name,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
darwin_emit_local_bss (FILE *fp, tree decl, const char *name,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
unsigned int l2align)
|
||||
{
|
||||
/* FIXME: We have a fudge to make this work with Java even when the target does
|
||||
|
@ -2393,17 +2393,17 @@ darwin_emit_local_bss (FILE *fp, tree decl, const char *name,
|
|||
if (l2align)
|
||||
fprintf (fp, "\t.align\t%u\n", l2align);
|
||||
|
||||
assemble_name (fp, name);
|
||||
assemble_name (fp, name);
|
||||
fprintf (fp, ":\n\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED"\n", size);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/* When we are on a non-section anchor target, we can get zero-sized
|
||||
items here. However, all we need to do is to bump them to one byte
|
||||
and the section alignment will take care of the rest. */
|
||||
char secnam[64];
|
||||
unsigned int flags ;
|
||||
snprintf (secnam, 64, "__DATA,__%sbss%u", ((size)?"":"zo_"),
|
||||
snprintf (secnam, 64, "__DATA,__%sbss%u", ((size)?"":"zo_"),
|
||||
(unsigned) l2align);
|
||||
/* We can't anchor (yet, if ever) in zerofill sections, because we can't
|
||||
switch to them and emit a label. */
|
||||
|
@ -2429,12 +2429,12 @@ darwin_emit_local_bss (FILE *fp, tree decl, const char *name,
|
|||
/* Emit a chunk of common. */
|
||||
static void
|
||||
darwin_emit_common (FILE *fp, const char *name,
|
||||
unsigned HOST_WIDE_INT size, unsigned int align)
|
||||
unsigned HOST_WIDE_INT size, unsigned int align)
|
||||
{
|
||||
unsigned HOST_WIDE_INT rounded;
|
||||
unsigned int l2align;
|
||||
|
||||
/* Earlier systems complain if the alignment exceeds the page size.
|
||||
/* Earlier systems complain if the alignment exceeds the page size.
|
||||
The magic number is 4096 * 8 - hard-coded for legacy systems. */
|
||||
if (!emit_aligned_common && (align > 32768UL))
|
||||
align = 4096UL; /* In units. */
|
||||
|
@ -2445,9 +2445,9 @@ darwin_emit_common (FILE *fp, const char *name,
|
|||
if (!align)
|
||||
align = 1;
|
||||
|
||||
/* For earlier toolchains, we need to emit the var as a rounded size to
|
||||
/* For earlier toolchains, we need to emit the var as a rounded size to
|
||||
tell ld the alignment. */
|
||||
if (size < align)
|
||||
if (size < align)
|
||||
rounded = align;
|
||||
else
|
||||
rounded = (size + (align-1)) & ~(align-1);
|
||||
|
@ -2468,7 +2468,7 @@ darwin_emit_common (FILE *fp, const char *name,
|
|||
|
||||
fputs ("\t.comm\t", fp);
|
||||
assemble_name (fp, name);
|
||||
fprintf (fp, "," HOST_WIDE_INT_PRINT_UNSIGNED,
|
||||
fprintf (fp, "," HOST_WIDE_INT_PRINT_UNSIGNED,
|
||||
emit_aligned_common?size:rounded);
|
||||
if (l2align && emit_aligned_common)
|
||||
fprintf (fp, ",%u", l2align);
|
||||
|
@ -2490,18 +2490,18 @@ darwin_output_aligned_bss (FILE *fp, tree decl, const char *name,
|
|||
one = DECL_ONE_ONLY (decl);
|
||||
weak = (DECL_P (decl)
|
||||
&& DECL_WEAK (decl)
|
||||
&& !lookup_attribute ("weak_import",
|
||||
&& !lookup_attribute ("weak_import",
|
||||
DECL_ATTRIBUTES (decl)));
|
||||
|
||||
#ifdef DEBUG_DARWIN_MEM_ALLOCATORS
|
||||
fprintf (fp, "# albss: %s (%lld,%d) ro %d cst %d stat %d com %d"
|
||||
" pub %d weak %d one %d init %lx\n",
|
||||
name, (long long)size, (int)align, TREE_READONLY (decl),
|
||||
name, (long long)size, (int)align, TREE_READONLY (decl),
|
||||
TREE_CONSTANT (decl), TREE_STATIC (decl), DECL_COMMON (decl),
|
||||
pub, weak, one, (unsigned long)DECL_INITIAL (decl));
|
||||
pub, weak, one, (unsigned long)DECL_INITIAL (decl));
|
||||
#endif
|
||||
|
||||
/* ObjC metadata can get put in BSS because varasm.c decides it's BSS
|
||||
/* ObjC metadata can get put in BSS because varasm.c decides it's BSS
|
||||
before the target has a chance to comment. */
|
||||
if ((meta = is_objc_metadata (decl)))
|
||||
{
|
||||
|
@ -2510,8 +2510,8 @@ fprintf (fp, "# albss: %s (%lld,%d) ro %d cst %d stat %d com %d"
|
|||
}
|
||||
|
||||
/* Check that any initializer is valid. */
|
||||
gcc_assert ((DECL_INITIAL (decl) == NULL)
|
||||
|| (DECL_INITIAL (decl) == error_mark_node)
|
||||
gcc_assert ((DECL_INITIAL (decl) == NULL)
|
||||
|| (DECL_INITIAL (decl) == error_mark_node)
|
||||
|| initializer_zerop (DECL_INITIAL (decl)));
|
||||
|
||||
gcc_assert (DECL_SECTION_NAME (decl) == NULL);
|
||||
|
@ -2523,7 +2523,7 @@ fprintf (fp, "# albss: %s (%lld,%d) ro %d cst %d stat %d com %d"
|
|||
|
||||
l2align = floor_log2 (align / BITS_PER_UNIT);
|
||||
gcc_assert (l2align <= L2_MAX_OFILE_ALIGNMENT);
|
||||
|
||||
|
||||
last_assemble_variable_decl = decl;
|
||||
|
||||
/* We would rather not have to check this here - but it seems that we might
|
||||
|
@ -2531,24 +2531,24 @@ fprintf (fp, "# albss: %s (%lld,%d) ro %d cst %d stat %d com %d"
|
|||
if (one || weak)
|
||||
{
|
||||
/* Weak or COMDAT objects are put in mergeable sections. */
|
||||
darwin_emit_weak_or_comdat (fp, decl, name, size,
|
||||
darwin_emit_weak_or_comdat (fp, decl, name, size,
|
||||
ld_uses_coal_sects, DECL_ALIGN (decl));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is not public, then emit according to local rules. */
|
||||
if (!pub)
|
||||
{
|
||||
darwin_emit_local_bss (fp, decl, name, size, l2align);
|
||||
darwin_emit_local_bss (fp, decl, name, size, l2align);
|
||||
return;
|
||||
}
|
||||
|
||||
/* So we have a public symbol (small item fudge for Java, see above). */
|
||||
if ((DARWIN_SECTION_ANCHORS && flag_section_anchors && size < BYTES_ZFILL)
|
||||
if ((DARWIN_SECTION_ANCHORS && flag_section_anchors && size < BYTES_ZFILL)
|
||||
|| (size && size <= 2))
|
||||
{
|
||||
/* Put smaller objects in data, where the section anchors system can get
|
||||
them. However, if they are zero-sized punt them to yet a different
|
||||
them. However, if they are zero-sized punt them to yet a different
|
||||
section (that is not allowed to participate in anchoring). */
|
||||
if (!size)
|
||||
{
|
||||
|
@ -2568,7 +2568,7 @@ fprintf (fp, "# albss: %s (%lld,%d) ro %d cst %d stat %d com %d"
|
|||
assemble_name (fp, name);
|
||||
fprintf (fp, ":\n\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED"\n", size);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
char secnam[64];
|
||||
unsigned int flags ;
|
||||
|
@ -2598,7 +2598,7 @@ fprintf (fp, "# albss: %s (%lld,%d) ro %d cst %d stat %d com %d"
|
|||
supports this). */
|
||||
void
|
||||
darwin_asm_output_aligned_decl_common (FILE *fp, tree decl, const char *name,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
unsigned int align)
|
||||
{
|
||||
unsigned int l2align;
|
||||
|
@ -2609,7 +2609,7 @@ darwin_asm_output_aligned_decl_common (FILE *fp, tree decl, const char *name,
|
|||
if (decl==NULL)
|
||||
{
|
||||
#ifdef DEBUG_DARWIN_MEM_ALLOCATORS
|
||||
fprintf (fp, "# adcom: %s (%d,%d) decl=0x0\n", name, (int)size, (int)align);
|
||||
fprintf (fp, "# adcom: %s (%d,%d) decl=0x0\n", name, (int)size, (int)align);
|
||||
#endif
|
||||
darwin_emit_common (fp, name, size, align);
|
||||
return;
|
||||
|
@ -2618,18 +2618,18 @@ fprintf (fp, "# adcom: %s (%d,%d) decl=0x0\n", name, (int)size, (int)align);
|
|||
one = DECL_ONE_ONLY (decl);
|
||||
weak = (DECL_P (decl)
|
||||
&& DECL_WEAK (decl)
|
||||
&& !lookup_attribute ("weak_import",
|
||||
&& !lookup_attribute ("weak_import",
|
||||
DECL_ATTRIBUTES (decl)));
|
||||
|
||||
#ifdef DEBUG_DARWIN_MEM_ALLOCATORS
|
||||
fprintf (fp, "# adcom: %s (%lld,%d) ro %d cst %d stat %d com %d pub %d"
|
||||
" weak %d one %d init %lx\n",
|
||||
name, (long long)size, (int)align, TREE_READONLY (decl),
|
||||
name, (long long)size, (int)align, TREE_READONLY (decl),
|
||||
TREE_CONSTANT (decl), TREE_STATIC (decl), DECL_COMMON (decl),
|
||||
TREE_PUBLIC (decl), weak, one, (unsigned long)DECL_INITIAL (decl));
|
||||
TREE_PUBLIC (decl), weak, one, (unsigned long)DECL_INITIAL (decl));
|
||||
#endif
|
||||
|
||||
/* ObjC metadata can get put in BSS because varasm.c decides it's BSS
|
||||
/* ObjC metadata can get put in BSS because varasm.c decides it's BSS
|
||||
before the target has a chance to comment. */
|
||||
if ((meta = is_objc_metadata (decl)))
|
||||
{
|
||||
|
@ -2645,24 +2645,24 @@ fprintf (fp, "# adcom: %s (%lld,%d) ro %d cst %d stat %d com %d pub %d"
|
|||
if (one || weak)
|
||||
{
|
||||
/* Weak or COMDAT objects are put in mergable sections. */
|
||||
darwin_emit_weak_or_comdat (fp, decl, name, size,
|
||||
darwin_emit_weak_or_comdat (fp, decl, name, size,
|
||||
ld_uses_coal_sects, DECL_ALIGN (decl));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* We should only get here for DECL_COMMON, with a zero init (and, in
|
||||
/* We should only get here for DECL_COMMON, with a zero init (and, in
|
||||
principle, only for public symbols too - although we deal with local
|
||||
ones below). */
|
||||
|
||||
/* Check the initializer is OK. */
|
||||
gcc_assert (DECL_COMMON (decl)
|
||||
&& ((DECL_INITIAL (decl) == NULL)
|
||||
|| (DECL_INITIAL (decl) == error_mark_node)
|
||||
gcc_assert (DECL_COMMON (decl)
|
||||
&& ((DECL_INITIAL (decl) == NULL)
|
||||
|| (DECL_INITIAL (decl) == error_mark_node)
|
||||
|| initializer_zerop (DECL_INITIAL (decl))));
|
||||
|
||||
last_assemble_variable_decl = decl;
|
||||
|
||||
if (!size || !align)
|
||||
if (!size || !align)
|
||||
align = DECL_ALIGN (decl);
|
||||
|
||||
l2align = floor_log2 (align / BITS_PER_UNIT);
|
||||
|
@ -2672,13 +2672,13 @@ fprintf (fp, "# adcom: %s (%lld,%d) ro %d cst %d stat %d com %d pub %d"
|
|||
if (TREE_PUBLIC (decl) != 0)
|
||||
darwin_emit_common (fp, name, size, align);
|
||||
else
|
||||
darwin_emit_local_bss (fp, decl, name, size, l2align);
|
||||
darwin_emit_local_bss (fp, decl, name, size, l2align);
|
||||
}
|
||||
|
||||
/* Output a chunk of BSS with alignment specfied. */
|
||||
void
|
||||
darwin_asm_output_aligned_decl_local (FILE *fp, tree decl, const char *name,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
darwin_asm_output_aligned_decl_local (FILE *fp, tree decl, const char *name,
|
||||
unsigned HOST_WIDE_INT size,
|
||||
unsigned int align)
|
||||
{
|
||||
unsigned long l2align;
|
||||
|
@ -2688,18 +2688,18 @@ darwin_asm_output_aligned_decl_local (FILE *fp, tree decl, const char *name,
|
|||
one = DECL_ONE_ONLY (decl);
|
||||
weak = (DECL_P (decl)
|
||||
&& DECL_WEAK (decl)
|
||||
&& !lookup_attribute ("weak_import",
|
||||
&& !lookup_attribute ("weak_import",
|
||||
DECL_ATTRIBUTES (decl)));
|
||||
|
||||
#ifdef DEBUG_DARWIN_MEM_ALLOCATORS
|
||||
fprintf (fp, "# adloc: %s (%lld,%d) ro %d cst %d stat %d one %d pub %d"
|
||||
" weak %d init %lx\n",
|
||||
name, (long long)size, (int)align, TREE_READONLY (decl),
|
||||
name, (long long)size, (int)align, TREE_READONLY (decl),
|
||||
TREE_CONSTANT (decl), TREE_STATIC (decl), one, TREE_PUBLIC (decl),
|
||||
weak , (unsigned long)DECL_INITIAL (decl));
|
||||
weak , (unsigned long)DECL_INITIAL (decl));
|
||||
#endif
|
||||
|
||||
/* ObjC metadata can get put in BSS because varasm.c decides it's BSS
|
||||
/* ObjC metadata can get put in BSS because varasm.c decides it's BSS
|
||||
before the target has a chance to comment. */
|
||||
if ((meta = is_objc_metadata (decl)))
|
||||
{
|
||||
|
@ -2715,16 +2715,16 @@ fprintf (fp, "# adloc: %s (%lld,%d) ro %d cst %d stat %d one %d pub %d"
|
|||
if (one || weak)
|
||||
{
|
||||
/* Weak or COMDAT objects are put in mergable sections. */
|
||||
darwin_emit_weak_or_comdat (fp, decl, name, size,
|
||||
darwin_emit_weak_or_comdat (fp, decl, name, size,
|
||||
ld_uses_coal_sects, DECL_ALIGN (decl));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* .. and it should be suitable for placement in local mem. */
|
||||
gcc_assert(!TREE_PUBLIC (decl) && !DECL_COMMON (decl));
|
||||
/* .. and any initializer must be all-zero. */
|
||||
gcc_assert ((DECL_INITIAL (decl) == NULL)
|
||||
|| (DECL_INITIAL (decl) == error_mark_node)
|
||||
gcc_assert ((DECL_INITIAL (decl) == NULL)
|
||||
|| (DECL_INITIAL (decl) == error_mark_node)
|
||||
|| initializer_zerop (DECL_INITIAL (decl)));
|
||||
|
||||
last_assemble_variable_decl = decl;
|
||||
|
@ -2763,7 +2763,7 @@ darwin_assemble_visibility (tree decl, int vis)
|
|||
|
||||
/* vec used by darwin_asm_dwarf_section.
|
||||
Maybe a hash tab would be better here - but the intention is that this is
|
||||
a very short list (fewer than 16 items) and each entry should (ideally,
|
||||
a very short list (fewer than 16 items) and each entry should (ideally,
|
||||
eventually) only be presented once.
|
||||
|
||||
A structure to hold a dwarf debug section used entry. */
|
||||
|
@ -2778,7 +2778,7 @@ dwarf_sect_used_entry;
|
|||
/* A list of used __DWARF sections. */
|
||||
static GTY (()) vec<dwarf_sect_used_entry, va_gc> *dwarf_sect_names_table;
|
||||
|
||||
/* This is called when we are asked to assemble a named section and the
|
||||
/* This is called when we are asked to assemble a named section and the
|
||||
name begins with __DWARF,. We keep a list of the section names (without
|
||||
the __DWARF, prefix) and use this to emit our required start label on the
|
||||
first switch to each section. */
|
||||
|
@ -2819,7 +2819,7 @@ darwin_asm_dwarf_section (const char *name, unsigned int flags,
|
|||
if (dwarf_sect_names_table == NULL)
|
||||
vec_alloc (dwarf_sect_names_table, 16);
|
||||
else
|
||||
for (i = 0;
|
||||
for (i = 0;
|
||||
dwarf_sect_names_table->iterate (i, &ref);
|
||||
i++)
|
||||
{
|
||||
|
@ -3159,9 +3159,9 @@ darwin_override_options (void)
|
|||
" %<-fnext-runtime%>");
|
||||
}
|
||||
|
||||
/* Don't emit DWARF3/4 unless specifically selected. This is a
|
||||
/* Don't emit DWARF3/4 unless specifically selected. This is a
|
||||
workaround for tool bugs. */
|
||||
if (!global_options_set.x_dwarf_strict)
|
||||
if (!global_options_set.x_dwarf_strict)
|
||||
dwarf_strict = 1;
|
||||
if (!global_options_set.x_dwarf_version)
|
||||
dwarf_version = 2;
|
||||
|
@ -3174,7 +3174,7 @@ darwin_override_options (void)
|
|||
global_options_set.x_dwarf_split_debug_info = 0;
|
||||
}
|
||||
|
||||
/* Do not allow unwind tables to be generated by default for m32.
|
||||
/* Do not allow unwind tables to be generated by default for m32.
|
||||
fnon-call-exceptions will override this, regardless of what we do. */
|
||||
if (generating_for_darwin_version < 10
|
||||
&& !global_options_set.x_flag_asynchronous_unwind_tables
|
||||
|
@ -3208,7 +3208,7 @@ darwin_override_options (void)
|
|||
/* FIXME: flag_objc_sjlj_exceptions is no longer needed since there is only
|
||||
one valid choice of exception scheme for each runtime. */
|
||||
if (!global_options_set.x_flag_objc_sjlj_exceptions)
|
||||
global_options.x_flag_objc_sjlj_exceptions =
|
||||
global_options.x_flag_objc_sjlj_exceptions =
|
||||
flag_next_runtime && !TARGET_64BIT;
|
||||
|
||||
/* FIXME: and this could be eliminated then too. */
|
||||
|
@ -3259,7 +3259,7 @@ darwin_override_options (void)
|
|||
|
||||
/* Linkers >= ld64-62.1 (at least) are capable of making the necessary PIC
|
||||
indirections and we no longer need to emit pic symbol stubs.
|
||||
However, if we are generating code for earlier ones (or for use in the
|
||||
However, if we are generating code for earlier ones (or for use in the
|
||||
kernel) the stubs might still be required, and this will be set true.
|
||||
If the user sets it on or off - then that takes precedence.
|
||||
|
||||
|
@ -3268,18 +3268,18 @@ darwin_override_options (void)
|
|||
|
||||
if (!global_options_set.x_darwin_picsymbol_stubs)
|
||||
{
|
||||
if (darwin_target_linker)
|
||||
if (darwin_target_linker)
|
||||
{
|
||||
if (strverscmp (darwin_target_linker, MIN_LD64_OMIT_STUBS) < 0)
|
||||
{
|
||||
darwin_picsymbol_stubs = true;
|
||||
ld_needs_eh_markers = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (generating_for_darwin_version < 9)
|
||||
{
|
||||
/* If we don't know the linker version and we're targeting an old
|
||||
system, we know no better than to assume the use of an earlier
|
||||
system, we know no better than to assume the use of an earlier
|
||||
linker. */
|
||||
darwin_picsymbol_stubs = true;
|
||||
ld_needs_eh_markers = true;
|
||||
|
@ -3375,7 +3375,7 @@ static GTY (()) hash_table<cfstring_hasher> *cfstring_htab;
|
|||
static tree
|
||||
add_builtin_field_decl (tree type, const char *name, tree **chain)
|
||||
{
|
||||
tree field = build_decl (BUILTINS_LOCATION, FIELD_DECL,
|
||||
tree field = build_decl (BUILTINS_LOCATION, FIELD_DECL,
|
||||
get_identifier (name), type);
|
||||
|
||||
if (*chain != NULL)
|
||||
|
@ -3391,9 +3391,9 @@ darwin_init_cfstring_builtins (unsigned builtin_cfstring)
|
|||
tree cfsfun, fields, pccfstring_ftype_pcchar;
|
||||
tree *chain = NULL;
|
||||
|
||||
darwin_builtin_cfstring =
|
||||
darwin_builtin_cfstring =
|
||||
(enum built_in_function) builtin_cfstring;
|
||||
|
||||
|
||||
/* struct __builtin_CFString {
|
||||
const int *isa; (will point at
|
||||
int flags; __CFConstantStringClassReference)
|
||||
|
@ -3401,10 +3401,10 @@ darwin_init_cfstring_builtins (unsigned builtin_cfstring)
|
|||
long length;
|
||||
}; */
|
||||
|
||||
pcint_type_node = build_pointer_type
|
||||
pcint_type_node = build_pointer_type
|
||||
(build_qualified_type (integer_type_node, TYPE_QUAL_CONST));
|
||||
|
||||
pcchar_type_node = build_pointer_type
|
||||
pcchar_type_node = build_pointer_type
|
||||
(build_qualified_type (char_type_node, TYPE_QUAL_CONST));
|
||||
|
||||
cfstring_type_node = (*lang_hooks.types.make_type) (RECORD_TYPE);
|
||||
|
@ -3420,13 +3420,13 @@ darwin_init_cfstring_builtins (unsigned builtin_cfstring)
|
|||
/* const struct __builtin_CFstring *
|
||||
__builtin___CFStringMakeConstantString (const char *); */
|
||||
|
||||
ccfstring_type_node = build_qualified_type
|
||||
ccfstring_type_node = build_qualified_type
|
||||
(cfstring_type_node, TYPE_QUAL_CONST);
|
||||
pccfstring_type_node = build_pointer_type (ccfstring_type_node);
|
||||
pccfstring_ftype_pcchar = build_function_type_list
|
||||
pccfstring_ftype_pcchar = build_function_type_list
|
||||
(pccfstring_type_node, pcchar_type_node, NULL_TREE);
|
||||
|
||||
cfsfun = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
|
||||
cfsfun = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
|
||||
get_identifier ("__builtin___CFStringMakeConstantString"),
|
||||
pccfstring_ftype_pcchar);
|
||||
|
||||
|
@ -3451,7 +3451,7 @@ darwin_init_cfstring_builtins (unsigned builtin_cfstring)
|
|||
(*lang_hooks.decls.pushdecl) (cfstring_class_reference);
|
||||
DECL_EXTERNAL (cfstring_class_reference) = 1;
|
||||
rest_of_decl_compilation (cfstring_class_reference, 0, 0);
|
||||
|
||||
|
||||
/* Initialize the hash table used to hold the constant CFString objects. */
|
||||
cfstring_htab = hash_table<cfstring_hasher>::create_ggc (31);
|
||||
|
||||
|
@ -3459,16 +3459,16 @@ darwin_init_cfstring_builtins (unsigned builtin_cfstring)
|
|||
}
|
||||
|
||||
tree
|
||||
darwin_fold_builtin (tree fndecl, int n_args, tree *argp,
|
||||
darwin_fold_builtin (tree fndecl, int n_args, tree *argp,
|
||||
bool ARG_UNUSED (ignore))
|
||||
{
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
|
||||
|
||||
if (fcode == darwin_builtin_cfstring)
|
||||
{
|
||||
if (!darwin_constant_cfstrings)
|
||||
{
|
||||
error ("built-in function %qD requires the"
|
||||
error ("built-in function %qD requires the"
|
||||
" %<-mconstant-cfstrings%> flag", fndecl);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -3607,12 +3607,12 @@ darwin_build_constant_cfstring (tree str)
|
|||
|
||||
/* isa *. */
|
||||
field = TYPE_FIELDS (ccfstring_type_node);
|
||||
CONSTRUCTOR_APPEND_ELT(v, NULL_TREE,
|
||||
build1 (ADDR_EXPR, TREE_TYPE (field),
|
||||
CONSTRUCTOR_APPEND_ELT(v, NULL_TREE,
|
||||
build1 (ADDR_EXPR, TREE_TYPE (field),
|
||||
cfstring_class_reference));
|
||||
/* flags */
|
||||
field = DECL_CHAIN (field);
|
||||
CONSTRUCTOR_APPEND_ELT(v, NULL_TREE,
|
||||
CONSTRUCTOR_APPEND_ELT(v, NULL_TREE,
|
||||
build_int_cst (TREE_TYPE (field), 0x000007c8));
|
||||
/* string *. */
|
||||
field = DECL_CHAIN (field);
|
||||
|
@ -3636,7 +3636,7 @@ darwin_build_constant_cfstring (tree str)
|
|||
TREE_LANG_FLAG_4 (constructor) = 1; /* TREE_HAS_CONSTRUCTOR */
|
||||
|
||||
/* Create an anonymous global variable for this CFString. */
|
||||
var = build_decl (input_location, CONST_DECL,
|
||||
var = build_decl (input_location, CONST_DECL,
|
||||
NULL, TREE_TYPE (constructor));
|
||||
DECL_ARTIFICIAL (var) = 1;
|
||||
TREE_STATIC (var) = 1;
|
||||
|
@ -3670,7 +3670,7 @@ darwin_cfstring_p (tree str)
|
|||
|
||||
key.literal = str;
|
||||
cfstring_descriptor **loc = cfstring_htab->find_slot (&key, NO_INSERT);
|
||||
|
||||
|
||||
if (loc)
|
||||
return true;
|
||||
|
||||
|
@ -3702,7 +3702,7 @@ darwin_function_section (tree decl, enum node_frequency freq,
|
|||
bool weak = (decl
|
||||
&& DECL_WEAK (decl)
|
||||
&& (!DECL_ATTRIBUTES (decl)
|
||||
|| !lookup_attribute ("weak_import",
|
||||
|| !lookup_attribute ("weak_import",
|
||||
DECL_ATTRIBUTES (decl))));
|
||||
|
||||
bool use_coal = weak && ld_uses_coal_sects;
|
||||
|
|
Loading…
Add table
Reference in a new issue