- /* Do not discard nested subprograms (those
- which end with .NNN, where N are digits). */
- if (*name == '.')
- for (name++; *name; name++)
- if (! ISDIGIT (*name))
- return 0;
+ while (*name == '.')
+ {
+ /* Allow both nested subprograms (which end with ".NNN", where N is
+ a digit) and GCC cloned functions (which contain ".clone").
+ Allow for multiple iterations of both - apparently GCC can clone
+ clones and subprograms. */
+ int digit_seen = 0;
+#define CLONE_NAME ".clone."
+#define CLONE_NAME_LEN strlen (CLONE_NAME)
+#define CONSTPROP_NAME ".constprop."
+#define CONSTPROP_NAME_LEN strlen (CONSTPROP_NAME)
+
+ if (strlen (name) > CLONE_NAME_LEN
+ && strncmp (name, CLONE_NAME, CLONE_NAME_LEN) == 0)
+ name += CLONE_NAME_LEN - 1;
+
+ else if (strlen (name) > CONSTPROP_NAME_LEN
+ && strncmp (name, CONSTPROP_NAME, CONSTPROP_NAME_LEN) == 0)
+ name += CONSTPROP_NAME_LEN - 1;
+
+ for (name++; *name; name++)
+ if (digit_seen && *name == '.')
+ break;
+ else if (ISDIGIT (*name))
+ digit_seen = 1;
+ else
+ return 0;
+ }