Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@ryansg.com>2020-03-25 15:37:55 -0400
committerMike Gerwitz <mike.gerwitz@ryansg.com>2020-03-26 09:14:26 -0400
commitd6762ab54736091c12c924ae3ba94d70763ee6d1 (patch)
tree8ad8cc2c84025fcd990f50e5e592f8872ff7923d /tamer/src/ld/poc.rs
parent8de174d6a22af73c31d5ba88857ced391eb0f183 (diff)
downloadtame-d6762ab54736091c12c924ae3ba94d70763ee6d1.tar.gz
tame-d6762ab54736091c12c924ae3ba94d70763ee6d1.tar.bz2
tame-d6762ab54736091c12c924ae3ba94d70763ee6d1.zip
[DEV-7087] TAMER: Type compatability check during extern resolution
This properly verifies extern types, and cleans up Asg's API a little so that externs aren't handled much differently than other declarations. With that said, after making src optional, I realized that we will indeed want source information for externs themselves so we can direct the user to what package is expecting that symbol (as the old linker does). So this approach will not work, and I'll have to undo some of those changes.
Diffstat (limited to 'tamer/src/ld/poc.rs')
-rw-r--r--tamer/src/ld/poc.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/tamer/src/ld/poc.rs b/tamer/src/ld/poc.rs
index 224fbeb..d1677da 100644
--- a/tamer/src/ld/poc.rs
+++ b/tamer/src/ld/poc.rs
@@ -174,10 +174,6 @@ fn load_xmlo<'a, 'i, I: Interner<'i>>(
Ok(XmloEvent::SymDecl(sym, attrs)) => {
if let Some(sym_src) = attrs.src {
found.insert(sym_src);
- } else if attrs.extern_ {
- // TODO: externs (they're implicitly handled, without
- // checks, by Missing)
- // depgraph.declare_extern(sym, kind);
} else {
let owned = attrs.src.is_none();
@@ -185,13 +181,19 @@ fn load_xmlo<'a, 'i, I: Interner<'i>>(
format!("sym `{}` attrs error: {}", sym, err)
});
- let mut src: Source = attrs.into();
+ let src = if attrs.extern_ {
+ None
+ } else {
+ let mut s: Source = attrs.into();
- // Existing convention is to omit @src of local package
- // (in this case, the program being linked)
- if first {
- src.pkg_name = None;
- }
+ // Existing convention is to omit @src of local package
+ // (in this case, the program being linked)
+ if first {
+ s.pkg_name = None;
+ }
+
+ Some(s)
+ };
match kind {
Ok(kindval) => {