Skip to content
Snippets Groups Projects
  • Jonathan Wakely's avatar
    94a311ab
    libstdc++: Disable cacheline alignment for DJGPP [PR109741] · 94a311ab
    Jonathan Wakely authored
    DJGPP (and maybe other targets) uses MAX_OFILE_ALIGNMENT=16 which means
    that globals (and static objects) can't have alignment greater than 16.
    This causes an error for the locks defined in src/c++11/shared_ptr.cc
    because we try to align them to the cacheline size, to avoid false
    sharing.
    
    Add a configure check for the increased alignment, and live with false
    sharing where we can't increase the alignment.
    
    libstdc++-v3/ChangeLog:
    
    	PR libstdc++/109741
    	* acinclude.m4 (GLIBCXX_CHECK_ALIGNAS_CACHELINE): Define.
    	* config.h.in: Regenerate.
    	* configure: Regenerate.
    	* configure.ac: Use GLIBCXX_CHECK_ALIGNAS_CACHELINE.
    	* src/c++11/shared_ptr.cc (__gnu_internal::get_mutex): Do not
    	align lock table if not supported. use __GCC_DESTRUCTIVE_SIZE
    	instead of hardcoded 64.
    94a311ab
    History
    libstdc++: Disable cacheline alignment for DJGPP [PR109741]
    Jonathan Wakely authored
    DJGPP (and maybe other targets) uses MAX_OFILE_ALIGNMENT=16 which means
    that globals (and static objects) can't have alignment greater than 16.
    This causes an error for the locks defined in src/c++11/shared_ptr.cc
    because we try to align them to the cacheline size, to avoid false
    sharing.
    
    Add a configure check for the increased alignment, and live with false
    sharing where we can't increase the alignment.
    
    libstdc++-v3/ChangeLog:
    
    	PR libstdc++/109741
    	* acinclude.m4 (GLIBCXX_CHECK_ALIGNAS_CACHELINE): Define.
    	* config.h.in: Regenerate.
    	* configure: Regenerate.
    	* configure.ac: Use GLIBCXX_CHECK_ALIGNAS_CACHELINE.
    	* src/c++11/shared_ptr.cc (__gnu_internal::get_mutex): Do not
    	align lock table if not supported. use __GCC_DESTRUCTIVE_SIZE
    	instead of hardcoded 64.