File: sysmsg.makefile

package info (click to toggle)
golang-gvisor-gvisor 0.0~20240729.0-4~bpo12%2B2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 21,296 kB
  • sloc: asm: 3,361; ansic: 1,197; cpp: 348; makefile: 92; python: 89; sh: 83
file content (47 lines) | stat: -rw-r--r-- 1,143 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Ubuntu unconditionally add ELF_PACKAGE_METADATA in dpkg-buildpacakge,
# which causes ld to add extra .note.package sections.
unexport ELF_PACKAGE_METADATA

ARCH := amd64

# sync with pkg/sentry/platform/systrap/sysmsg/build.bzl

CFLAGS := -Wall -Wno-unused-command-line-argument
CFLAGS += -fpie

ifeq ($(ARCH),amd64)
	CFLAGS += -O2
endif
ifeq ($(ARCH),arm64)
	CFLAGS += -O1 -mno-outline-atomics
endif
CFLAGS += -fno-builtin
CFLAGS += -ffreestanding
CFLAGS += -mgeneral-regs-only
CFLAGS += -g
CFLAGS += -Wa,--noexecstack
CFLAGS += -fno-asynchronous-unwind-tables
CFLAGS += -fno-stack-protector

%.o: %.S
	$(CC) $(CFLAGS) -c $^ -o $@

%.o: %.c
	$(CC) $(CFLAGS) -c $^ -o $@

sighandler.built-in.bin.o: sighandler_$(ARCH).o syshandler_$(ARCH).o sigrestorer_$(ARCH).o sysmsg_lib.o
	$(LD) -pie -z noexecstack -T pie.lds.S $^ -o $@

sighandler_$(ARCH).go: sighandler.built-in.bin.o
	bash gen_offsets_go.sh sighandler Sighandler $^ > $@

sighandler.built-in.$(ARCH).bin: sighandler.built-in.bin.o
	 objcopy -O binary $^ $@

all: sighandler.built-in.$(ARCH).bin sighandler_$(ARCH).go

clean:
	$(RM) *.o

distclean: clean
	$(RM) *.bin sighandler_*.go