New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcc -flto=auto : function ‘uftrace___cyg_profile_func_exit’ redeclared as variable #1343
Comments
Thanks for the report, I'll take a look. |
Hmm.. The error is also shown only with Is there any special reason to use |
That redeclation looks like a hidden bug for me. |
Hmm.. we will think more about it. Thanks for reporting the issue. |
Same issue here when trying to package uftrace for ArchLinux. Temporarily disable LTO to solve the problem. |
Related bug in Gentoo Linux: https://bugs.gentoo.org/858503 |
I'm not sure but does the below help? diff --git a/libmcount/plthook.c b/libmcount/plthook.c
index 5b5620bd6a..aa54bbc364 100644
--- a/libmcount/plthook.c
+++ b/libmcount/plthook.c
@@ -81,13 +81,14 @@ static void resolve_pltgot(struct plthook_data *pd, int idx)
/* use weak reference for non-defined (arch-dependent) symbols */
#define ALIAS_DECL(_sym) extern __weak void (*uftrace_##_sym)(void);
+#define ALIAS_DECL2(_sym) extern __weak void (*uftrace_##_sym)(void *, void *);
ALIAS_DECL(mcount);
ALIAS_DECL(_mcount);
ALIAS_DECL(__fentry__);
ALIAS_DECL(__gnu_mcount_nc);
-ALIAS_DECL(__cyg_profile_func_enter);
-ALIAS_DECL(__cyg_profile_func_exit);
+ALIAS_DECL2(__cyg_profile_func_enter);
+ALIAS_DECL2(__cyg_profile_func_exit);
#define SKIP_SYM(func) \
{ \ |
Unfortunately, no. I still get a compile error:
If you want to reproduce this locally, try using
when building. |
Thanks, I was able to reproduce it locally with your help. :) This patch fixes the redeclaration error. diff --git a/libmcount/plthook.c b/libmcount/plthook.c
index 5b5620bd6a..d9f1e8dd6a 100644
--- a/libmcount/plthook.c
+++ b/libmcount/plthook.c
@@ -80,14 +80,15 @@ static void resolve_pltgot(struct plthook_data *pd, int idx)
}
/* use weak reference for non-defined (arch-dependent) symbols */
-#define ALIAS_DECL(_sym) extern __weak void (*uftrace_##_sym)(void);
+#define ALIAS_DECL(_sym) extern __weak void uftrace_##_sym(void);
+#define ALIAS_DECL2(_sym) extern __weak void uftrace_##_sym(void *, void *);
ALIAS_DECL(mcount);
ALIAS_DECL(_mcount);
ALIAS_DECL(__fentry__);
ALIAS_DECL(__gnu_mcount_nc);
-ALIAS_DECL(__cyg_profile_func_enter);
-ALIAS_DECL(__cyg_profile_func_exit);
+ALIAS_DECL2(__cyg_profile_func_enter);
+ALIAS_DECL2(__cyg_profile_func_exit);
#define SKIP_SYM(func) \
{ \ But it reveals another problem like below. :-(
|
I tried with 0.13.1 and this bug is still there. |
I'm still not sure if LTO supports partial linking ( |
With -flto=auto optflag I got
The text was updated successfully, but these errors were encountered: