Type:
Bug
Priority:
Minor
Resolution:
Fixed
Affects Version/s:
10.2(EOL) , 10.3(EOL) , 10.4(EOL) , 10.5 , 10.6 , 10.7(EOL) , 10.8(EOL) , 10.9(EOL)
Clang expects 8-byte alignment for some 64-bit atomic operations
in some 32-bit targets. Native instruction lock cmpxchg8b (for x86)
should only require 4-byte alignment.
As a result laterst mariadb fails to build with clang on 32bit/x86 architecture because it
can not find the missing symbol
undefined reference to `__atomic_fetch_or_8'
here is a shortened testcase that can reproduce the problem with clang
#include <stdint.h>
# ifdef __GNUC__
typedef __attribute__((__aligned__(8))) uint64_t ATOMIC_U64;
# else
typedef uint64_t ATOMIC_U64;
# endif
int main() { return 0;}
#ifdef BUGGY
uint64_t foo(uint64_t *val, uint64_t op)
#else
uint64_t foo(ATOMIC_U64 *val, uint64_t op)
#endif
{
return __atomic_or_fetch(val, op, __ATOMIC_ACQ_REL);
}
compiles ok with `gcc -m32` or `clang -m32` fine but interesting thing happens with
`gcc -DBUGGY -m32` or `clang -DBUGGY -m32`
and you see the difference. Clang says
/tmp/a.c:17:12: warning: misaligned atomic operation may incur significant performance penalty; the expected alignment (8 bytes) exceeds the actual alignment (4 bytes) [-Watomic-alignment]
return __atomic_or_fetch(val, op, __ATOMIC_ACQ_REL);
^
1 warning generated.
/usr/bin/ld: /tmp/a-4a5d79.o: in function `foo':
a.c:(.text+0x6b): undefined reference to `__atomic_fetch_or_8'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
but gcc sails along.
so I guess we need to make sure that any data being accessed atomically is aligned to 64bit as well to
help the compiler a bit here.
{"report":{"fcp":1099,"ttfb":260.7999997138977,"pageVisibility":"visible","entityId":109157,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"67b99708-1be8-4813-96fb-9d86fc505a45","navigationType":0,"readyForUser":1185.2999997138977,"redirectCount":0,"resourceLoadedEnd":1376.5,"resourceLoadedStart":265.90000009536743,"resourceTiming":[{"duration":283,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":265.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":265.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":548.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":283,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":266.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":266.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":549.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":316,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":266.2999997138977,"connectEnd":266.2999997138977,"connectStart":266.2999997138977,"domainLookupEnd":266.2999997138977,"domainLookupStart":266.2999997138977,"fetchStart":266.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":266.2999997138977,"responseEnd":582.2999997138977,"responseStart":582.2999997138977,"secureConnectionStart":266.2999997138977},{"duration":409.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":266.5,"connectEnd":266.5,"connectStart":266.5,"domainLookupEnd":266.5,"domainLookupStart":266.5,"fetchStart":266.5,"redirectEnd":0,"redirectStart":0,"requestStart":266.5,"responseEnd":676,"responseStart":676,"secureConnectionStart":266.5},{"duration":413.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":266.69999980926514,"connectEnd":266.69999980926514,"connectStart":266.69999980926514,"domainLookupEnd":266.69999980926514,"domainLookupStart":266.69999980926514,"fetchStart":266.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":266.69999980926514,"responseEnd":680.4000000953674,"responseStart":680.4000000953674,"secureConnectionStart":266.69999980926514},{"duration":413.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":267,"connectEnd":267,"connectStart":267,"domainLookupEnd":267,"domainLookupStart":267,"fetchStart":267,"redirectEnd":0,"redirectStart":0,"requestStart":267,"responseEnd":680.9000000953674,"responseStart":680.9000000953674,"secureConnectionStart":267},{"duration":414.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":267.19999980926514,"connectEnd":267.19999980926514,"connectStart":267.19999980926514,"domainLookupEnd":267.19999980926514,"domainLookupStart":267.19999980926514,"fetchStart":267.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":267.19999980926514,"responseEnd":681.2999997138977,"responseStart":681.2999997138977,"secureConnectionStart":267.19999980926514},{"duration":459.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":267.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":267.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":727,"responseStart":0,"secureConnectionStart":0},{"duration":414.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":267.5,"connectEnd":267.5,"connectStart":267.5,"domainLookupEnd":267.5,"domainLookupStart":267.5,"fetchStart":267.5,"redirectEnd":0,"redirectStart":0,"requestStart":267.5,"responseEnd":681.9000000953674,"responseStart":681.9000000953674,"secureConnectionStart":267.5},{"duration":459.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":267.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":267.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":727.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":414.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":267.90000009536743,"connectEnd":267.90000009536743,"connectStart":267.90000009536743,"domainLookupEnd":267.90000009536743,"domainLookupStart":267.90000009536743,"fetchStart":267.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":267.90000009536743,"responseEnd":682.5,"responseStart":682.5,"secureConnectionStart":267.90000009536743},{"duration":1103,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":273.19999980926514,"connectEnd":273.19999980926514,"connectStart":273.19999980926514,"domainLookupEnd":273.19999980926514,"domainLookupStart":273.19999980926514,"fetchStart":273.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":273.19999980926514,"responseEnd":1376.1999998092651,"responseStart":1376.1999998092651,"secureConnectionStart":273.19999980926514},{"duration":1103.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":273.2999997138977,"connectEnd":273.2999997138977,"connectStart":273.2999997138977,"domainLookupEnd":273.2999997138977,"domainLookupStart":273.2999997138977,"fetchStart":273.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":273.2999997138977,"responseEnd":1376.5,"responseStart":1376.5,"secureConnectionStart":273.2999997138977},{"duration":177.19999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":739,"connectEnd":739,"connectStart":739,"domainLookupEnd":739,"domainLookupStart":739,"fetchStart":739,"redirectEnd":0,"redirectStart":0,"requestStart":739,"responseEnd":916.1999998092651,"responseStart":916.1999998092651,"secureConnectionStart":739}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":106,"responseStart":261,"responseEnd":265,"domLoading":264,"domInteractive":1398,"domContentLoadedEventStart":1398,"domContentLoadedEventEnd":1440,"domComplete":2816,"loadEventStart":2816,"loadEventEnd":2818,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1379.4000000953674},{"name":"bigPipe.sidebar-id.end","time":1380.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1380.2999997138977},{"name":"bigPipe.activity-panel-pipe-id.end","time":1382.9000000953674},{"name":"activityTabFullyLoaded","time":1446.5999999046326}],"measures":[],"correlationId":"e816791af96bcd","effectiveType":"4g","downlink":9.2,"rtt":0,"serverDuration":92,"dbReadsTimeInMs":13,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}