@@ -24,8 +24,6 @@ pub(crate) mod ffi;
2424pub ( crate ) mod map_data;
2525pub mod mapgen;
2626
27- const VAR_ALIGN : Align = Align :: EIGHT ;
28-
2927/// A context object for maintaining all state needed by the coverageinfo module.
3028pub struct CrateCoverageContext < ' ll , ' tcx > {
3129 /// Coverage data for each instrumented function identified by DefId.
@@ -226,7 +224,8 @@ pub(crate) fn save_cov_data_to_mod<'ll, 'tcx>(
226224 llvm:: set_global_constant ( llglobal, true ) ;
227225 llvm:: set_linkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
228226 llvm:: set_section ( llglobal, & covmap_section_name) ;
229- llvm:: set_alignment ( llglobal, VAR_ALIGN ) ;
227+ // LLVM's coverage mapping format specifies 8-byte alignment for items in this section.
228+ llvm:: set_alignment ( llglobal, Align :: EIGHT ) ;
230229 cx. add_used_global ( llglobal) ;
231230}
232231
@@ -256,7 +255,8 @@ pub(crate) fn save_func_record_to_mod<'ll, 'tcx>(
256255 llvm:: set_linkage ( llglobal, llvm:: Linkage :: LinkOnceODRLinkage ) ;
257256 llvm:: set_visibility ( llglobal, llvm:: Visibility :: Hidden ) ;
258257 llvm:: set_section ( llglobal, covfun_section_name) ;
259- llvm:: set_alignment ( llglobal, VAR_ALIGN ) ;
258+ // LLVM's coverage mapping format specifies 8-byte alignment for items in this section.
259+ llvm:: set_alignment ( llglobal, Align :: EIGHT ) ;
260260 llvm:: set_comdat ( cx. llmod , llglobal, & func_record_var_name) ;
261261 cx. add_used_global ( llglobal) ;
262262}
0 commit comments