RFR: 8369393: NMT: poison the malloc header and footer under ASAN build [v2]

Afshin Zafari azafari at openjdk.org
Wed Dec 17 09:02:25 UTC 2025


On Wed, 3 Dec 2025 08:28:54 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> These functions are not templated. When put them in inline file, the definitions will be repeated for every cpp that include the inline file. There are 3 instances of these cpp files. Then, linker complains about duplicate definitions.
>
> Did you ensure the header declarations are declared inline?
> 
> 
> $ cat inline.hpp
> #ifndef header
> #define header
> inline void foo();
> #endif
> $ cat inline.inline.hpp
> #include "inline.hpp"
> #include <cstdio>
> 
> #ifndef inlheader
> #define inlheader
> 
> void foo() {
>   printf("Inline definition");
> }
> 
> #endif
> $ cat a.cpp
> #include "inline.inline.hpp"
> #include "a.hpp"
> 
> void bar() {
>   foo();
> }
> $ cat b.cpp
> #include "b.hpp"
> #include "inline.inline.hpp"
> 
> void baz() {
>   foo();
> }
> $ cat main.cpp
> #include "b.hpp"
> #include "a.hpp"
> 
> int main() {
>   baz();
>   bar();
>   return 0;
> }
> $ g++ -c main.cpp -o main.o
> $ g++ -c a.cpp -o a.o
> $ g++ -c b.cpp -o b.o
> $ g++ *.o -o myprogram
> $ ./myprogram
> Inline definitionInline definition

Thanks for the detailed sample. The functions are now inlined and moved to inline.hpp.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28503#discussion_r2584145556


More information about the hotspot-runtime-dev mailing list