tamer: {ir::asg=>ld::xmle}::section

Sections, as written, are specific to xmle files.

I think the intent originally was to have this be more generic, but that
doesn't really make sense.

By explicitly coupling it with `xmle` files, that will allow us to turn this
into a proper lowering operation with its own validations that will allow
`xmle::xir` to do its job without having to validate anything itself.
main
Mike Gerwitz 2021-10-12 00:03:12 -04:00
parent 1c181b568d
commit 81ec65742a
7 changed files with 15 additions and 14 deletions

View File

@ -27,7 +27,7 @@ use super::ident::IdentKind;
use super::object::{
FragmentText, IdentObjectData, IdentObjectState, Source, TransitionResult,
};
use super::Sections;
use crate::ld::xmle::Sections;
use crate::sym::{GlobalSymbolResolve, SymbolId};
use petgraph::graph::{DiGraph, Graph, NodeIndex};
use petgraph::visit::DfsPostOrder;

View File

@ -24,7 +24,7 @@ use super::object::{
FragmentText, IdentObjectData, IdentObjectState, Source, TransitionError,
UnresolvedError,
};
use super::Sections;
use crate::ld::xmle::Sections;
use crate::sym::SymbolId;
use petgraph::graph::NodeIndex;
use std::fmt::Debug;

View File

@ -194,7 +194,6 @@ mod base;
mod graph;
mod ident;
mod object;
mod section;
pub use graph::{
Asg, AsgError, AsgResult, IndexType, ObjectRef, SortableAsg,
@ -205,7 +204,6 @@ pub use object::{
FragmentText, IdentObject, IdentObjectData, IdentObjectState, Source,
TransitionError, TransitionResult, UnresolvedError,
};
pub use section::{Section, SectionIter, Sections, SectionsIter};
/// Default concrete ASG implementation.
pub type DefaultAsg<O, Ix = crate::global::ProgSymSize> = base::BaseAsg<O, Ix>;

View File

@ -20,13 +20,13 @@
//! **This contains the remaining portions of the proof-of-concept linker.**
//! It is feature-complete and just needs final refactoring.
use super::xmle::xir::lower_iter;
use super::xmle::{xir::lower_iter, Sections};
use crate::fs::{
Filesystem, FsCanonicalizer, PathFile, VisitOnceFile, VisitOnceFilesystem,
};
use crate::global;
use crate::ir::asg::{
Asg, DefaultAsg, IdentObject, IdentObjectData, Sections, SortableAsg,
Asg, DefaultAsg, IdentObject, IdentObjectData, SortableAsg,
SortableAsgError,
};
use crate::ir::xir::writer::XmlWriter;

View File

@ -69,4 +69,7 @@
//! </package>
//! ```
mod section;
pub mod xir;
pub use section::{Section, SectionIter, Sections, SectionsIter};

View File

@ -17,14 +17,15 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! Ordered sections of ASG object references.
//! Sections of a linked [`xmle`](super) object file.
//!
//! These sections are the result of an ordering operation from
//! [`SortableAsg::sort`].
//! These sections are the result of [`SortableAsg::sort`],
//! which places the relocatable object code fragments in the order
//! necessary for execution.
//!
//! [`SortableAsg::sort`]: super::SortableAsg::sort
//! [`SortableAsg::sort`]: crate::ir::asg::SortableAsg::sort
use super::IdentObjectData;
use crate::ir::asg::IdentObjectData;
use crate::sym::SymbolId;
use fxhash::FxHashSet;
use std::collections::hash_set;

View File

@ -29,11 +29,10 @@
//! which can then use [`XmlWriter`](crate::ir::xir::writer::XmlWriter)
//! for writing.
use super::{Sections, SectionsIter};
use crate::{
ir::{
asg::{
IdentKind, IdentObject, IdentObjectData, Sections, SectionsIter,
},
asg::{IdentKind, IdentObject, IdentObjectData},
xir::{
iter::{elem_wrap, ElemWrapIter},
AttrValue, QName, Text, Token,