-
Notifications
You must be signed in to change notification settings - Fork 0
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
rewriter: static
fns with the same name result in duplicate extern IA2_fn_ptr_* __ia2_*
declarations
#428
Comments
We took the issue of call gates for static functions with the same name into account in a few places but ultimately decided to declare them all in the output header which prevents them. This was just to minimize the number of build artifacts and simplify the build process, but I think there's multiple ways we might be able to handle this.
If both these files define a |
|
Yup, we do. They're both passed to |
I think the easiest thing to handle the most common cases of this would be to assert that duplicate static functions have the same function signature and generate only one declaration in the header. |
Yeah that would improve things. Move the error to the rewriter, and if the functions are the same, then just remove duplicates. |
My tests for this cover static functions defined in headers, duplicate definitions of static functions in source files and different definitions of static functions with the same name and function signature in source files. @kkysen any other cases I should cover? |
oh I just realized the duplicate declarations don't actually cause an error and if the function signatures don't match it'll trigger a compile error. Since the generated header isn't considered developer-facing this is much lower priority than I thought. I'll push the tests I wrote and the change I made for #414 (it's needed for static functions defined in headers) but I don't think it's worth spending time on moving the errors to the rewriter for now. |
…th __used__ When we make call gates for static functions that have their address taken, the static function is only referenced from the asm for the call gate. When compiling with optimizations dead code elimination may get rid of the static functions unless they are marked with __attribute__((__used__)). The rewriter previously prepended this attribute in this case to avoid that. This commit removes the prepended attribute and instead redeclares these functions with that attribute. Closes #414 and fixes a test added for #428.
…th __used__ When we make call gates for static functions that have their address taken, the static function is only referenced from the asm for the call gate. When compiling with optimizations dead code elimination may get rid of the static functions unless they are marked with __attribute__((__used__)). The rewriter previously prepended this attribute in this case to avoid that. This commit removes the prepended attribute and instead redeclares these functions with that attribute. Closes #414 and fixes a test added for #428.
…th __used__ When we make call gates for static functions that have their address taken, the static function is only referenced from the asm for the call gate. When compiling with optimizations dead code elimination may get rid of the static functions unless they are marked with __attribute__((__used__)). The rewriter previously prepended this attribute in this case to avoid that. This commit removes the prepended attribute and instead redeclares these functions with that attribute. Closes #414 and fixes a test added for #428.
That sounds like all of them to me.
Is the only solution for now to just |
When there are multiple
static
functions with the same name, they result in duplicateextern IA2_fn_ptr_* __ia2_*
declarations incallgate_wrapper.h
. I'm not certain this an error, since other errors are in the way first, but it seems like an error.For example, in
dav1d
, this happens withinit_internal
, which is defined inlib.c
andscan.c
and used when callingpthread_once
.The text was updated successfully, but these errors were encountered: