mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-19 04:14:24 +00:00
Fix paginator counter on x86-32
Atomic operations with 64 bit values must be aligned for 64-bit on x86-32. According to the spec: "The first word in a global variable or in an allocated struct or slice can be relied upon to be 64-bit aligned." The above wasn't enough for the `paginationPageCount` on `SiteInfo`, maybe due to how `SiteInfo` is embedded. This commit adds a 4 byte padding before the `uint64` that creates the correct alignment. Fixes #2415
This commit is contained in:
parent
eaf2f9bce5
commit
4df86a703a
1 changed files with 8 additions and 1 deletions
|
@ -155,7 +155,14 @@ type targetList struct {
|
||||||
|
|
||||||
type SiteInfo struct {
|
type SiteInfo struct {
|
||||||
// atomic requires 64-bit alignment for struct field access
|
// atomic requires 64-bit alignment for struct field access
|
||||||
paginationPageCount uint64
|
// According to the docs, " The first word in a global variable or in an
|
||||||
|
// allocated struct or slice can be relied upon to be 64-bit aligned."
|
||||||
|
// Moving paginationPageCount to the top of this struct didn't do the
|
||||||
|
// magic, maybe due to the way SiteInfo is embedded.
|
||||||
|
// Adding the 4 byte padding below does the trick.
|
||||||
|
_ [4]byte
|
||||||
|
paginationPageCount uint64
|
||||||
|
|
||||||
BaseURL template.URL
|
BaseURL template.URL
|
||||||
Taxonomies TaxonomyList
|
Taxonomies TaxonomyList
|
||||||
Authors AuthorList
|
Authors AuthorList
|
||||||
|
|
Loading…
Reference in a new issue