Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
From 5885ed8e6db7648e6842d9811aace7edc4e8aba7 Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Wed, 20 Apr 2022 11:16:52 +0200
|
||||
Subject: [PATCH] buildtools/wafsamba: add --disable-stack-protector option
|
||||
|
||||
Allow the user to disable stack-protector through
|
||||
--disable-stack-protector to avoid the following build failure with
|
||||
libtalloc on embedded toolchains which don't support stack-protector:
|
||||
|
||||
/home/autobuild/autobuild/instance-5/output-1/host/lib/gcc/i686-buildroot-linux-musl/9.4.0/../../../../i686-buildroot-linux-musl/bin/ld: talloc.c.5.o: in function `_vasprintf_tc':
|
||||
talloc.c:(.text+0x427d): undefined reference to `__stack_chk_fail_local'
|
||||
|
||||
This build failure is raised since
|
||||
https://gitlab.com/ffontaine/samba/-/commit/38e97f8b52e85bdfcf2d74a4fb3c848fa46ba371
|
||||
because stack-protector is enabled on libtalloc despite the fact that
|
||||
libssp is not available:
|
||||
|
||||
Checking if compiler accepts -fstack-protector-strong : yes
|
||||
|
||||
Fixes:
|
||||
- http://autobuild.buildroot.org/results/e221bde25c7622db99761d0adcd56663296beb15
|
||||
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
[Upstream status:
|
||||
https://gitlab.com/samba-team/samba/-/merge_requests/2493]
|
||||
---
|
||||
buildtools/wafsamba/samba_autoconf.py | 49 ++++++++++++++-------------
|
||||
buildtools/wafsamba/wscript | 3 ++
|
||||
2 files changed, 28 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
|
||||
index 78927d85193..23a995e1c34 100644
|
||||
--- a/buildtools/wafsamba/samba_autoconf.py
|
||||
+++ b/buildtools/wafsamba/samba_autoconf.py
|
||||
@@ -703,9 +703,28 @@ def SAMBA_CONFIG_H(conf, path=None):
|
||||
if not IN_LAUNCH_DIR(conf):
|
||||
return
|
||||
|
||||
- # we need to build real code that can't be optimized away to test
|
||||
- stack_protect_list = ['-fstack-protector-strong', '-fstack-protector']
|
||||
- for stack_protect_flag in stack_protect_list:
|
||||
+ if not Options.options.disable_stack_protector:
|
||||
+ # we need to build real code that can't be optimized away to test
|
||||
+ stack_protect_list = ['-fstack-protector-strong', '-fstack-protector']
|
||||
+ for stack_protect_flag in stack_protect_list:
|
||||
+ flag_supported = conf.check(fragment='''
|
||||
+ #include <stdio.h>
|
||||
+
|
||||
+ int main(void)
|
||||
+ {
|
||||
+ char t[100000];
|
||||
+ while (fgets(t, sizeof(t), stdin));
|
||||
+ return 0;
|
||||
+ }
|
||||
+ ''',
|
||||
+ execute=0,
|
||||
+ cflags=[ '-Werror', '-Wp,-D_FORTIFY_SOURCE=2', stack_protect_flag],
|
||||
+ mandatory=False,
|
||||
+ msg='Checking if compiler accepts %s' % (stack_protect_flag))
|
||||
+ if flag_supported:
|
||||
+ conf.ADD_CFLAGS('%s' % (stack_protect_flag))
|
||||
+ break
|
||||
+
|
||||
flag_supported = conf.check(fragment='''
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -717,29 +736,11 @@ def SAMBA_CONFIG_H(conf, path=None):
|
||||
}
|
||||
''',
|
||||
execute=0,
|
||||
- cflags=[ '-Werror', '-Wp,-D_FORTIFY_SOURCE=2', stack_protect_flag],
|
||||
+ cflags=[ '-Werror', '-fstack-clash-protection'],
|
||||
mandatory=False,
|
||||
- msg='Checking if compiler accepts %s' % (stack_protect_flag))
|
||||
+ msg='Checking if compiler accepts -fstack-clash-protection')
|
||||
if flag_supported:
|
||||
- conf.ADD_CFLAGS('%s' % (stack_protect_flag))
|
||||
- break
|
||||
-
|
||||
- flag_supported = conf.check(fragment='''
|
||||
- #include <stdio.h>
|
||||
-
|
||||
- int main(void)
|
||||
- {
|
||||
- char t[100000];
|
||||
- while (fgets(t, sizeof(t), stdin));
|
||||
- return 0;
|
||||
- }
|
||||
- ''',
|
||||
- execute=0,
|
||||
- cflags=[ '-Werror', '-fstack-clash-protection'],
|
||||
- mandatory=False,
|
||||
- msg='Checking if compiler accepts -fstack-clash-protection')
|
||||
- if flag_supported:
|
||||
- conf.ADD_CFLAGS('-fstack-clash-protection')
|
||||
+ conf.ADD_CFLAGS('-fstack-clash-protection')
|
||||
|
||||
if Options.options.debug:
|
||||
conf.ADD_CFLAGS('-g', testflags=True)
|
||||
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
|
||||
index 8729b0829da..d75bb3b1c0c 100644
|
||||
--- a/buildtools/wafsamba/wscript
|
||||
+++ b/buildtools/wafsamba/wscript
|
||||
@@ -165,6 +165,9 @@ Currently the only tested value is 'smbtorture,smbd/smbd' for Samba'''),
|
||||
gr.add_option('--disable-warnings-as-errors',
|
||||
help=("Do not treat all warnings as errors (disable -Werror)"),
|
||||
action="store_true", dest='disable_warnings_as_errors', default=False)
|
||||
+ gr.add_option('--disable-stack-protector',
|
||||
+ help=("Disable stack-protector"),
|
||||
+ action="store_true", dest='disable_stack_protector', default=False)
|
||||
opt.add_option('--enable-coverage',
|
||||
help=("enable options necessary for code coverage "
|
||||
"reporting on selftest (default=no)"),
|
||||
--
|
||||
2.35.1
|
||||
|
||||
14
package/libtalloc/Config.in
Normal file
14
package/libtalloc/Config.in
Normal file
@@ -0,0 +1,14 @@
|
||||
config BR2_PACKAGE_LIBTALLOC
|
||||
bool "libtalloc"
|
||||
depends on BR2_USE_MMU
|
||||
depends on !BR2_STATIC_LIBS
|
||||
help
|
||||
talloc is a hierarchical, reference counted memory pool
|
||||
system with destructors. It is the core memory allocator
|
||||
used in Samba.
|
||||
|
||||
https://talloc.samba.org/talloc/doc/html/index.html
|
||||
|
||||
comment "libtalloc needs a toolchain w/ dynamic library"
|
||||
depends on BR2_USE_MMU
|
||||
depends on BR2_STATIC_LIBS
|
||||
42
package/libtalloc/libtalloc-cache.txt
Normal file
42
package/libtalloc/libtalloc-cache.txt
Normal file
@@ -0,0 +1,42 @@
|
||||
Checking simple C program: OK
|
||||
rpath library support: OK
|
||||
-Wl,--version-script support: OK
|
||||
Checking getconf LFS_CFLAGS: NO
|
||||
Checking for large file support without additional flags: OK
|
||||
Checking for -D_LARGE_FILES: OK
|
||||
Checking correct behavior of strtoll: NO
|
||||
Checking for working strptime: OK
|
||||
Checking for C99 vsnprintf: OK
|
||||
Checking for HAVE_SHARED_MMAP: OK
|
||||
Checking for HAVE_MREMAP: OK
|
||||
Checking for HAVE_INCOHERENT_MMAP: NO
|
||||
Checking for HAVE_SECURE_MKSTEMP: OK
|
||||
Checking for HAVE_IFACE_GETIFADDRS: OK
|
||||
Checking for kernel change notify support: OK
|
||||
Checking for Linux kernel oplocks: OK
|
||||
Checking for kernel share modes: OK
|
||||
Checking if can we convert from CP850 to UCS-2LE: OK
|
||||
Checking if can we convert from UTF-8 to UCS-2LE: OK
|
||||
Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK
|
||||
Checking whether we can use Linux thread-specific credentials: OK
|
||||
Checking whether setreuid is available: OK
|
||||
Checking whether setresuid is available: OK
|
||||
Checking whether seteuid is available: OK
|
||||
Checking whether fcntl locking is available: OK
|
||||
Checking whether fcntl lock supports open file description locks: OK
|
||||
Checking for the maximum value of the 'time_t' type: OK
|
||||
Checking whether the realpath function allows a NULL argument: OK
|
||||
Checking whether POSIX capabilities are available: OK
|
||||
Checking for ftruncate extend: OK
|
||||
vfs_fileid checking for statfs() and struct statfs.f_fsid: OK
|
||||
getcwd takes a NULL argument: OK
|
||||
Checking uname sysname type: "Linux"
|
||||
Checking uname release type: "5.4.0"
|
||||
Checking uname version type: "#1 Tue Oct 1 00:00:00 UTC 2020"
|
||||
Checking value of NSIG: "65"
|
||||
Checking value of _NSIG: "65"
|
||||
Checking value of SIGRTMAX: "64"
|
||||
Checking value of SIGRTMIN: "34"
|
||||
Checking errno of iconv for illegal multibyte sequence: "0"
|
||||
checking for clnt_create(): OK
|
||||
Checking for a 64-bit host to support lmdb: NO
|
||||
3
package/libtalloc/libtalloc.hash
Normal file
3
package/libtalloc/libtalloc.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# Locally calculated
|
||||
sha256 55e47994018c13743485544e7206780ffbb3c8495e704a99636503e6e77abf59 talloc-2.4.4.tar.gz
|
||||
sha256 da7eabb7bafdf7d3ae5e9f223aa5bdc1eece45ac569dc21b3b037520b4464768 LICENSE
|
||||
58
package/libtalloc/libtalloc.mk
Normal file
58
package/libtalloc/libtalloc.mk
Normal file
@@ -0,0 +1,58 @@
|
||||
################################################################################
|
||||
#
|
||||
# libtalloc
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBTALLOC_VERSION = 2.4.4
|
||||
LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
|
||||
LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
|
||||
LIBTALLOC_LICENSE = LGPL-3.0+
|
||||
LIBTALLOC_LICENSE_FILES = LICENSE
|
||||
LIBTALLOC_INSTALL_STAGING = YES
|
||||
|
||||
# libtalloc is extracted from the samba source tree, and that has a workaround
|
||||
# that requires PYTHONHASHSEED to be set, and to be set to 1.
|
||||
# See https://gitlab.com/samba-team/samba/-/commit/420bbb1d92fd2a28725b53f425ba3d214831b660
|
||||
LIBTALLOC_CONF_ENV = PYTHONHASHSEED=1
|
||||
LIBTALLOC_MAKE_ENV = PYTHONHASHSEED=1
|
||||
|
||||
# --with-libiconv= is unconditionally passed, even if libiconv is not
|
||||
# present. Indeed, waf will search for libiconv by default in
|
||||
# /usr/local. Because of a bug in some waf python script, /usr/local
|
||||
# is then used in many subsequent and unrelated checks, which
|
||||
# ultimately causes a failure when BR2_COMPILER_PARANOID_UNSAFE_PATH
|
||||
# is set. However no need to set libiconv as a dependency of
|
||||
# libtalloc since it's optional.
|
||||
LIBTALLOC_CONF_OPTS += --cross-compile \
|
||||
--cross-answers=$(@D)/cache.txt \
|
||||
--disable-stack-protector \
|
||||
--hostcc=gcc \
|
||||
--with-libiconv=$(STAGING_DIR)/usr
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
|
||||
LIBTALLOC_DEPENDENCIES += libtirpc host-pkgconf
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_PYTHON3),y)
|
||||
LIBTALLOC_DEPENDENCIES += host-python3 python3
|
||||
LIBTALLOC_CONF_ENV += \
|
||||
PYTHON="$(HOST_DIR)/bin/python3" \
|
||||
PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
|
||||
# There isn't any --enable-python configuration option
|
||||
else
|
||||
LIBTALLOC_CONF_OPTS += --disable-python
|
||||
endif
|
||||
|
||||
LIBTALLOC_WAF = ./buildtools/bin/waf
|
||||
|
||||
# like samba4, libtalloc uses the waf build system which requires a
|
||||
# proper answers file to configure package before build
|
||||
define LIBTALLOC_POPULATE_WAF_CACHE
|
||||
$(INSTALL) -m 0644 package/libtalloc/libtalloc-cache.txt $(@D)/cache.txt
|
||||
echo 'Checking uname machine type: $(BR2_ARCH)' >> $(@D)/cache.txt
|
||||
endef
|
||||
|
||||
LIBTALLOC_PRE_CONFIGURE_HOOKS += LIBTALLOC_POPULATE_WAF_CACHE
|
||||
|
||||
$(eval $(waf-package))
|
||||
Reference in New Issue
Block a user