Skip to content

Conversation

@zebreus
Copy link
Contributor

@zebreus zebreus commented Nov 14, 2025

Previously it was fine not to exports __tls_base from the main module, #5852 changed that to be an error. This PR prints a more meaningful error message when the __tls_base export is missing but tls symbols are used.

Copilot AI review requested due to automatic review settings November 14, 2025 16:24
Copilot finished reviewing on behalf of zebreus November 14, 2025 16:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error messaging when the __tls_base export is missing from a module that uses thread-local storage (TLS) symbols. Previously, after PR #5852 made this an error condition, the error message was generic. This change provides more specific information by identifying which TLS symbol requires the __tls_base export.

Key changes:

  • Added a new MissingTlsBaseExport error variant to LinkError that includes the module and symbol name
  • Renamed TlsSymbolWithoutTls to NoTlsBaseGlobalExport in ResolveError for clarity
  • Replaced panicking .expect() calls with proper error handling that converts NoTlsBaseGlobalExport to the more informative MissingTlsBaseExport

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
};

// .expect("Internal error: bad in-progress symbol resolution");
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this commented-out code. The error handling has been properly replaced with the match statement above, so this comment serves no purpose and should be deleted.

Suggested change
// .expect("Internal error: bad in-progress symbol resolution");

Copilot uses AI. Check for mistakes.
@marxin marxin requested a review from Arshia001 November 20, 2025 10:39
@zebreus
Copy link
Contributor Author

zebreus commented Nov 20, 2025

@copilot fix the clippy error

Copy link

Copilot AI commented Nov 20, 2025

@zebreus I've opened a new pull request, #5890, to work on those changes. Once the pull request is ready, I'll request review from you.

Comment on lines +3127 to +3136
Ok(e) => e,
Err(ResolveError::NoTlsBaseGlobalExport) => {
return Err(LinkError::MissingTlsBaseExport(
import.module().to_string(),
import.name().to_string(),
));
}
Err(e) => {
panic!("Internal error: failed to resolve exported symbol: {e}")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Arshia001 I don't really like having to match here, because that will still cause a panic if we unwrap that error type on another path. Do you have a better idea on how to handle this?

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

Successfully merging this pull request may close these issues.

2 participants