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

Modules can race to build object files #112

Open
reticulatedpines opened this issue Aug 19, 2023 · 1 comment
Open

Modules can race to build object files #112

reticulatedpines opened this issue Aug 19, 2023 · 1 comment

Comments

@reticulatedpines
Copy link
Owner

reticulatedpines commented Aug 19, 2023

Both mlv_lite and silent modules list lossless.o as a dependency. mlv_lite/Makefile has it like this:

MODULE_OBJS=mlv_lite.o ../mlv_rec/mlv.o ../silent/lossless.o

This means if lossless.o is first built during silent module, and mlv_lite happens to build later, mlv_lite will overwrite lossless.o, making the timestamp later than silent.mo. This leads to successive makes in the modules dir building silent module twice, which is at least wasteful. Maybe this causes real problems, too?

mlv_rec/mlv.o should suffer from the same problem.

It's not clear to me exactly how MODULE_OBJS leads to the build occuring at all, possibly implicit make rules, .o from .c of same name?

I'd guess the fix is to correctly list the shared dependency. With that done, parallel builds should know lossless.o must be built before either, and it should only get built once.

@reticulatedpines
Copy link
Owner Author

This pattern also means that multiple modules export the same symbols. E.g. because mlv_lite.o links in lossless.o, all the externally visible lossless.o symbols are provided by mlv_lite.mo and silent.mo. This complicates module autoloading and increases module size for no reason.

Maybe we want to split out the shared functions into another, non-user-visible module, and autoload that if either of silent or mlv_lite are enabled? Maybe we don't need to link against lossless.o for mlv_lite, if we have module autoloading?

reticulatedpines added a commit that referenced this issue Aug 21, 2023
If multiple modules provide the same symbol,
don't autoload any of them.  Annoyingly, this
prevents all autoloading, because current status
of module system is a bit janky.

See:
#112
#113

As we clean up clashing symbol names and redundant code,
autoloading will start to work properly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant