@@ -199,7 +199,6 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
199199 type SectionIterator < ' data > : Iterator < Item = & ' data Self :: SectionHeader > ;
200200 type DynamicTagValues < ' data > : DynamicTagValues < ' data > ;
201201 type RelocationList < ' data > : Send + Sync + ' data ;
202- type VerneedTable < ' data > : VerneedTable < ' data > ;
203202 type DynamicLayoutStateExt < ' data > : Default + Send + Sync + ' data ;
204203 type DynamicLayoutExt < ' data > : std:: fmt:: Debug + Send + Sync + ' data ;
205204 type LayoutResourcesExt < ' data > : std:: fmt:: Debug + Send + Sync + ' data ;
@@ -215,6 +214,9 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
215214 /// For platforms that don't support symbol versioning, this can just be the unit type.
216215 type VersionNames < ' data > ;
217216
217+ /// For platforms that don't support symbol versioning, this can just be the unit type.
218+ type VerneedTable < ' data > : VerneedTable < ' data > ;
219+
218220 /// Invoke the linker for requested architecture.
219221 fn link_for_arch < ' data > (
220222 linker : & ' data crate :: Linker ,
@@ -226,6 +228,8 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
226228 layout : & Layout < ' data , Self > ,
227229 ) -> Result ;
228230
231+ /// Possibly initialise a linker plugin if the platform supports it and the arguments specifies
232+ /// that one should be used.
229233 fn maybe_init_linker_plugin < ' data > (
230234 _args : & ' data Self :: Args ,
231235 _linker_plugin_arena : & ' data colosseum:: sync:: Arena < crate :: linker_plugins:: LoadedPlugin > ,
@@ -234,6 +238,7 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
234238 Ok ( None )
235239 }
236240
241+ /// Called once all symbols have been read, but only if a linker plugin is active.
237242 fn plugin_all_symbols_read < ' data > (
238243 _plugin : & mut LinkerPlugin < ' data > ,
239244 _symbol_db : & mut SymbolDb < ' data , Self > ,
@@ -257,8 +262,8 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
257262 Ok ( ( ) )
258263 }
259264
260- fn section_flags ( header : & Self :: SectionHeader ) -> Self :: SectionFlags ;
261-
265+ /// Returns attributes of the supplied section. This is type+flags and doesn't include other
266+ /// information like name, size etc.
262267 fn section_attributes ( header : & Self :: SectionHeader ) -> Self :: SectionAttributes ;
263268
264269 /// Validate that the supplied sizes are internally consistent.
@@ -361,23 +366,27 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
361366 ) -> Result < layout:: DynamicSymbolDefinition < ' data , Self > > ;
362367
363368 fn validate_section < ' data > (
364- section_info : & crate :: output_section_id:: SectionOutputInfo < Self > ,
365- section_flags : Self :: SectionFlags ,
366- section_layout : & OutputRecordLayout ,
367- merge_target : OutputSectionId ,
368- output_sections : & OutputSections < ' data , Self > ,
369- section_id : OutputSectionId ,
370- ) -> Result ;
369+ _section_info : & crate :: output_section_id:: SectionOutputInfo < Self > ,
370+ _section_flags : Self :: SectionFlags ,
371+ _section_layout : & OutputRecordLayout ,
372+ _merge_target : OutputSectionId ,
373+ _output_sections : & OutputSections < ' data , Self > ,
374+ _section_id : OutputSectionId ,
375+ ) -> Result {
376+ Ok ( ( ) )
377+ }
371378
372379 /// Called when we detect an internal error with allocation in order to try and help determine
373- /// what we did wrong.
380+ /// what we did wrong. Can optionally return a more helpful error.
374381 fn verify_resolution_allocation (
375- output_sections : & OutputSections < Self > ,
376- output_order : & OutputOrder ,
377- output_kind : OutputKind ,
378- mem_sizes : & OutputSectionPartMap < u64 > ,
379- resolution : & layout:: Resolution < Self > ,
380- ) -> Result ;
382+ _output_sections : & OutputSections < Self > ,
383+ _output_order : & OutputOrder ,
384+ _output_kind : OutputKind ,
385+ _mem_sizes : & OutputSectionPartMap < u64 > ,
386+ _resolution : & layout:: Resolution < Self > ,
387+ ) -> Result {
388+ Ok ( ( ) )
389+ }
381390
382391 /// Updates the list of segments to keep.
383392 fn update_segment_keep_list (
@@ -494,7 +503,9 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
494503
495504 /// Verifies that it's OK to load a section with the given name. Mostly just used to detect
496505 /// linker plugin inputs, since we shouldn't be loading those.
497- fn verify_allowed_input_section_name ( name : & [ u8 ] ) -> Result ;
506+ fn verify_allowed_input_section_name ( _name : & [ u8 ] ) -> Result {
507+ Ok ( ( ) )
508+ }
498509
499510 /// Allocate space for headers based on segment and section counts.
500511 fn allocate_header_sizes (
@@ -504,11 +515,15 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
504515 output_sections : & OutputSections < Self > ,
505516 ) ;
506517
518+ /// Gives the platform an opportunity to error out if an input stack section is requesting an
519+ /// executable stack, but that's not permitted due to flags.
507520 fn validate_stack_section (
508- section : & Self :: SectionHeader ,
509- object : & impl std:: fmt:: Display ,
510- args : & Self :: Args ,
511- ) -> Result ;
521+ _section : & Self :: SectionHeader ,
522+ _object : & impl std:: fmt:: Display ,
523+ _args : & Self :: Args ,
524+ ) -> Result {
525+ Ok ( ( ) )
526+ }
512527
513528 fn finalise_sizes_for_symbol < ' data > (
514529 common : & mut CommonGroupState < ' data , Self > ,
@@ -553,11 +568,13 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
553568 ) -> layout:: Resolution < Self > ;
554569
555570 fn validate_resolution (
556- name : & [ u8 ] ,
557- resolution : & crate :: layout:: Resolution < Self > ,
558- got : & Self :: SectionHeader ,
559- got_data : & [ u8 ] ,
560- ) -> Result ;
571+ _name : & [ u8 ] ,
572+ _resolution : & crate :: layout:: Resolution < Self > ,
573+ _got : & Self :: SectionHeader ,
574+ _got_data : & [ u8 ] ,
575+ ) -> Result {
576+ Ok ( ( ) )
577+ }
561578
562579 fn raw_symbol_name < ' data > (
563580 name_bytes : & ' data [ u8 ] ,
@@ -571,19 +588,26 @@ pub(crate) trait Platform: Copy + Send + Sync + Sized + std::fmt::Debug + 'stati
571588
572589 fn default_layout_rules ( ) -> & ' static [ SectionRule < ' static > ] ;
573590
591+ /// Only called if a linker script that provides custom sections and layout rules is present.
592+ /// Gives the platform a chance to add extra built-in rules that need to be present even when a
593+ /// linker script is providing most of the rules.
574594 fn linker_script_rules_pre_build ( _rule_builder : & mut layout_rules:: LayoutRulesBuilder ) { }
575595
576596 fn copy_relocate_symbol < ' scope , ' data > (
577- state : & mut layout:: DynamicLayoutState < Self > ,
578- symbol_id : SymbolId ,
579- resources : & layout:: GraphResources < ' data , ' scope , Self > ,
580- ) -> Result ;
597+ _state : & mut layout:: DynamicLayoutState < Self > ,
598+ _symbol_id : SymbolId ,
599+ _resources : & layout:: GraphResources < ' data , ' scope , Self > ,
600+ ) -> Result {
601+ bail ! ( "Platform does not support copy relocations" ) ;
602+ }
581603
582604 fn finalise_copy_relocations < ' data > (
583- group_states : & mut [ layout:: GroupState < ' data , Self > ] ,
584- symbol_db : & SymbolDb < ' data , Self > ,
585- symbol_flags : & AtomicPerSymbolFlags ,
586- ) -> Result ;
605+ _group_states : & mut [ layout:: GroupState < ' data , Self > ] ,
606+ _symbol_db : & SymbolDb < ' data , Self > ,
607+ _symbol_flags : & AtomicPerSymbolFlags ,
608+ ) -> Result {
609+ Ok ( ( ) )
610+ }
587611}
588612
589613/// Abstracts over the different object file formats that we support (or may support). e.g. ELF.
0 commit comments