Skip to content
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

Unneeded "weak"ness of "weak_alias" #356

Open
nyh opened this issue Jun 29, 2014 · 0 comments
Open

Unneeded "weak"ness of "weak_alias" #356

nyh opened this issue Jun 29, 2014 · 0 comments

Comments

@nyh
Copy link
Contributor

nyh commented Jun 29, 2014

This is a low-priority "nitpick" kind of issue.

OSv code uses the weak_alias() macro in dozens of places, directly or through the LFS64() macro. I think we should have an alias() macro and use that instead of weak_alias() in many, if not all, the places where weak_alias() is currently used.

weak_alias() appears it used for two reasons:

  1. Musl code (libc//.c) defines the real function with a name __mktemp(), and then makes the regular name mktemp() a weak alias for that. That supposedly allows a program to redefine mktemp() to something else, and still use the library function, calling it __mktemp().
  2. LFS64() and two or three other uses of weak_alias(). Here, we don't really need a weak symbol. In my opinion, it makes little sense to have stat() a strong symbol which cannot be overriden by the program, and yet stat64() is weak, and can be overridden.

Finally, I don't think we even need weak symbols for #1 above. I believe our linker always look first in the program and not the kernel, so any symbol can be overriden by the program, not just weak symbols. I believe we ignore the "weak" parameter of symbols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants