2022-02-02 12:03:09 +01:00
# SPDX-License-Identifier: GPL-2.0
# Memblock simulator requires AddressSanitizer (libasan) and liburcu development
# packages installed
CFLAGS += -I. -I../../include -Wall -O2 -fsanitize= address \
-fsanitize= undefined -D CONFIG_PHYS_ADDR_T_64BIT
LDFLAGS += -fsanitize= address -fsanitize= undefined
TARGETS = main
2022-02-28 15:46:49 +01:00
TEST_OFILES = tests/alloc_nid_api.o tests/alloc_helpers_api.o tests/alloc_api.o \
2022-11-07 00:28:05 -06:00
tests/basic_api.o tests/common.o tests/alloc_exact_nid_api.o
2022-02-02 12:03:10 +01:00
DEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o
OFILES = main.o $( DEP_OFILES) $( TEST_OFILES)
2022-02-02 12:03:09 +01:00
EXTR_SRC = ../../../mm/memblock.c
i f e q ( $( BUILD ) , 3 2 )
CFLAGS += -m32
LDFLAGS += -m32
e n d i f
# Process user parameters
i n c l u d e s c r i p t s / M a k e f i l e . i n c l u d e
main : $( OFILES )
$(OFILES) : include
include : ../../../include /linux /memblock .h ../../include /linux /*.h \
../../include/asm/*.h
@mkdir -p linux
test -L linux/memblock.h || ln -s ../../../../include/linux/memblock.h linux/memblock.h
memblock tests: Fix compilation error.
Commit cf4694be2b2cf ("tools: Add atomic_test_and_set_bit()") changed
tools/arch/x86/include/asm/atomic.h to include <asm/asm.h>, which causes
'make -C tools/testing/memblock' to fail with:
In file included from ../../include/asm/atomic.h:6,
from ../../include/linux/atomic.h:5,
from ./linux/mmzone.h:5,
from ../../include/linux/mm.h:5,
from ../../include/linux/pfn.h:5,
from ./linux/memory_hotplug.h:6,
from ./linux/init.h:7,
from ./linux/memblock.h:11,
from tests/common.h:8,
from tests/basic_api.h:5,
from main.c:2:
../../include/asm/../../arch/x86/include/asm/atomic.h:11:10: fatal error: asm/asm.h: No such file or directory
11 | #include <asm/asm.h>
| ^~~~~~~~~~~
Create a symlink to asm/asm.h in the same manner as the existing one to
asm/cmpxchg.h.
Signed-off-by: Aaron Thompson <dev@aaront.org>
Link: https://lore.kernel.org/r/010101857c402765-96e2dbc6-b82b-47e2-a437-4834dbe0b96b-000000@us-west-2.amazonses.com
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
2023-01-04 10:07:37 +00:00
test -L asm/asm.h || ln -s ../../../arch/x86/include/asm/asm.h asm/asm.h
2022-02-02 12:03:09 +01:00
test -L asm/cmpxchg.h || ln -s ../../../arch/x86/include/asm/cmpxchg.h asm/cmpxchg.h
memblock.c : $( EXTR_SRC )
test -L memblock.c || ln -s $( EXTR_SRC) memblock.c
clean :
memblock tests: Fix compilation error.
Commit cf4694be2b2cf ("tools: Add atomic_test_and_set_bit()") changed
tools/arch/x86/include/asm/atomic.h to include <asm/asm.h>, which causes
'make -C tools/testing/memblock' to fail with:
In file included from ../../include/asm/atomic.h:6,
from ../../include/linux/atomic.h:5,
from ./linux/mmzone.h:5,
from ../../include/linux/mm.h:5,
from ../../include/linux/pfn.h:5,
from ./linux/memory_hotplug.h:6,
from ./linux/init.h:7,
from ./linux/memblock.h:11,
from tests/common.h:8,
from tests/basic_api.h:5,
from main.c:2:
../../include/asm/../../arch/x86/include/asm/atomic.h:11:10: fatal error: asm/asm.h: No such file or directory
11 | #include <asm/asm.h>
| ^~~~~~~~~~~
Create a symlink to asm/asm.h in the same manner as the existing one to
asm/cmpxchg.h.
Signed-off-by: Aaron Thompson <dev@aaront.org>
Link: https://lore.kernel.org/r/010101857c402765-96e2dbc6-b82b-47e2-a437-4834dbe0b96b-000000@us-west-2.amazonses.com
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
2023-01-04 10:07:37 +00:00
$( RM) $( TARGETS) $( OFILES) linux/memblock.h memblock.c asm/asm.h asm/cmpxchg.h
2022-02-02 12:03:09 +01:00
help :
@echo 'Memblock simulator'
@echo ''
@echo 'Available targets:'
@echo ' main - Build the memblock simulator'
@echo ' clean - Remove generated files and symlinks in the directory'
@echo ''
@echo 'Configuration:'
2022-07-03 23:06:55 -05:00
@echo ' make MEMBLOCK_DEBUG=1 - enable memblock_dbg() messages'
2022-02-02 12:03:09 +01:00
@echo ' make NUMA=1 - simulate enabled NUMA'
@echo ' make 32BIT_PHYS_ADDR_T=1 - Use 32 bit physical addresses'
v p a t h % . c . . / . . / l i b
.PHONY : clean include help