Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 6.2.1 weak linkage
#1
Dear MISRA group,

I have a question regarding the interpretation of the one-definition-rule in the presence of weak linkage (i.e. __attribute__((weak))).
In particular, is it considered a violation of the odr rule/rule 6.2.1 if a function with "strong" linkage "overrides" a function with "weak" linkage (as typically found in (standard) libraries)?

A special case within this discussion are global allocation and deallocation functions. The C++ standard calls them explicitly "replaceable".
Implementation-wise in any standard library I know, this is expressed by the weak linkage attribute.
Since the standard allows these few functions to be replaced explicitly, I conclude this does not constitute a violation of the one-definition-rule.

But how about any other weak-linkage function?

Thanks in advance!
Reply


Messages In This Thread
Rule 6.2.1 weak linkage - by hahn - 28-02-2025, 09:33 AM
RE: Rule 6.2.1 weak linkage - by misra cpp - 28-02-2025, 01:04 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)