From dfdd11f7777557e4540f3319ff8b5f8ddf82bf19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=BCxen?= Date: Thu, 11 Jun 2020 17:57:14 +0200 Subject: [PATCH] sys/targets: use a different SYZ_DATA_OFFSET for 32-bit FreeBSD (#1809) * sys/targets: use a different SYZ_DATA_OFFSET for 32-bit FreeBSD It seems that the value used on all platforms (512 << 20) does not work on 32-bit FreeBSD when using the clang tools. Try (256 << 20) instead. * sys/targets: add comment why a non-default value is needed --- sys/targets/targets.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/targets/targets.go b/sys/targets/targets.go index f362577735aa..bd1f5fc26915 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -203,9 +203,12 @@ var List = map[string]map[string]*Target{ NeedSyscallDefine: dontNeedSyscallDefine, }, "386": { - VMArch: "amd64", - PtrSize: 4, - PageSize: 4 << 10, + VMArch: "amd64", + PtrSize: 4, + PageSize: 4 << 10, + // The default DataOffset doesn't work with 32-bit + // FreeBSD and using ld.lld due to collisions. + DataOffset: 256 << 20, Int64Alignment: 4, CCompiler: "clang", CFlags: []string{"-m32"}, @@ -447,7 +450,9 @@ func initTarget(target *Target, OS, arch string) { if target.NeedSyscallDefine == nil { target.NeedSyscallDefine = needSyscallDefine } - target.DataOffset = 512 << 20 + if target.DataOffset == 0 { + target.DataOffset = 512 << 20 + } target.NumPages = (16 << 20) / target.PageSize sourceDir := os.Getenv("SOURCEDIR_" + strings.ToUpper(OS)) if sourceDir == "" {