aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-08-13 17:29:30 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-08-13 13:29:30 -0400
commit2ce3c6c615fa735693e1de39e9777919ba4fd106 (patch)
tree5151de01751b24d690444de42bb0d59e3a3d0764 /gcc/tree.c
parentdb04386fd134ed6619ea9acf279ee245afd440a3 (diff)
downloadgcc-2ce3c6c615fa735693e1de39e9777919ba4fd106.zip
gcc-2ce3c6c615fa735693e1de39e9777919ba4fd106.tar.gz
gcc-2ce3c6c615fa735693e1de39e9777919ba4fd106.tar.bz2
tree.h: De-conditionalize init_priority code.
* tree.h: De-conditionalize init_priority code. * mips.h (NM_FLAGS): Change from -Bp to -Bn. * collect2.c (NM_FLAGS): Change from -p to -n. * configure.in: Turn on collect2 for mipstx39-elf. Handle use_collect2=no properly. * c-common.c: De-conditionalize init_priority code. * collect2.c (extract_init_priority, sort_ids): New fns. (main): Call sort_ids. Move sequence_number to file scope. * configure.in: Handle --enable-init-priority. * c-common.c (attrs): Add A_INIT_PRIORITY. (init_attributes, decl_attributes): Likewise. * tree.h (DEFAULT_INIT_PRIORITY, MAX_INIT_PRIORITY): New macros. * tree.c (get_file_function_name_long): Split out... (get_file_function_name): ...from here. cp/: * lang-options.h: Add -finit-priority. * decl2.c: Likewise. Check flag_init_priority instead of USE_INIT_PRIORITY. * decl2.c (setup_initp): New fn. (start_objects, finish_objects, do_ctors): Handle init_priority. (do_dtors, finish_file): Likewise. From-SVN: r21701
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 82b2cc5..59c02b4 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4806,24 +4806,24 @@ dump_tree_statistics ()
#define FILE_FUNCTION_PREFIX_LEN 9
#ifndef NO_DOLLAR_IN_LABEL
-#define FILE_FUNCTION_FORMAT "_GLOBAL_$D$%s"
+#define FILE_FUNCTION_FORMAT "_GLOBAL_$%s$%s"
#else /* NO_DOLLAR_IN_LABEL */
#ifndef NO_DOT_IN_LABEL
-#define FILE_FUNCTION_FORMAT "_GLOBAL_.D.%s"
+#define FILE_FUNCTION_FORMAT "_GLOBAL_.%s.%s"
#else /* NO_DOT_IN_LABEL */
-#define FILE_FUNCTION_FORMAT "_GLOBAL__D_%s"
+#define FILE_FUNCTION_FORMAT "_GLOBAL__%s_%s"
#endif /* NO_DOT_IN_LABEL */
#endif /* NO_DOLLAR_IN_LABEL */
extern char * first_global_object_name;
extern char * weak_global_object_name;
-/* If KIND=='I', return a suitable global initializer (constructor) name.
- If KIND=='D', return a suitable global clean-up (destructor) name. */
+/* TYPE is some string to identify this function to the linker or
+ collect2. */
tree
-get_file_function_name (kind)
- int kind;
+get_file_function_name_long (type)
+ char *type;
{
char *buf;
register char *p;
@@ -4837,13 +4837,14 @@ get_file_function_name (kind)
else
p = input_filename;
- buf = (char *) alloca (sizeof (FILE_FUNCTION_FORMAT) + strlen (p));
+ buf = (char *) alloca (sizeof (FILE_FUNCTION_FORMAT) + strlen (p)
+ + strlen (type));
/* Set up the name of the file-level functions we may need. */
/* Use a global object (which is already required to be unique over
the program) rather than the file name (which imposes extra
constraints). -- Raeburn@MIT.EDU, 10 Jan 1990. */
- sprintf (buf, FILE_FUNCTION_FORMAT, p);
+ sprintf (buf, FILE_FUNCTION_FORMAT, type, p);
/* Don't need to pull weird characters out of global names. */
if (p != first_global_object_name)
@@ -4866,10 +4867,23 @@ get_file_function_name (kind)
*p = '_';
}
- buf[FILE_FUNCTION_PREFIX_LEN] = kind;
-
return get_identifier (buf);
}
+
+/* If KIND=='I', return a suitable global initializer (constructor) name.
+ If KIND=='D', return a suitable global clean-up (destructor) name. */
+
+tree
+get_file_function_name (kind)
+ int kind;
+{
+ char p[2];
+ p[0] = kind;
+ p[1] = 0;
+
+ return get_file_function_name_long (p);
+}
+
/* Expand (the constant part of) a SET_TYPE CONSTRUCTOR node.
The result is placed in BUFFER (which has length BIT_SIZE),