My OpenADK config
вс, 11 февр. 2024 г. в 09:34, Dmitry Chestnykh <dm.chestnykh(a)gmail.com>om>:
The goal of this change is to fix FDPIC toolchain
compilation.
Previous implementation had the issue that `make oldconfig`
destroyed the effect of `echo` and `sed` executing to write
BINFMT-related lines into .config.
Note that we have to use `echo UCLIBC_FORMAT_*=y` instead of sed
because in the original file `UCLIBC_FORMAT_*` line may not exist.
Sed just replaces text in lines, so if the line doesn't exist sed will do
nothing.
To have the proper `UCLIBC_FORMAT_*=y` in the .config I've changed
some `sed`s to `echo`s.
Without this change the compilation of FDPIC toolchain fails
because UCLIBC_FORMAT_FDPIC_ELF is not defined, it leads to miss
of `-mfdpic` compilation flag and to the absense of crtreloc.o object
that needs during utilities linking and the linking process fails.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh(a)gmail.com>
---
toolchain/uclibc-ng/Makefile | 71 ++++++++++++++++++------------------
1 file changed, 35 insertions(+), 36 deletions(-)
diff --git a/toolchain/uclibc-ng/Makefile b/toolchain/uclibc-ng/Makefile
index 6b1fd31ce..cabac310d 100644
--- a/toolchain/uclibc-ng/Makefile
+++ b/toolchain/uclibc-ng/Makefile
@@ -85,42 +85,6 @@ ifeq ($(ADK_TARGET_HARD_FLOAT_DP),y)
$(SED) 's/.*\(UCLIBC_HAS_FPU\).*/\1=y/' ${WRKBUILD}/.config
$(SED) 's/.*\(UCLIBC_HAS_SOFT_FLOAT\).*/# \1 is not set/'
${WRKBUILD}/.config
endif
-ifeq ($(ADK_TARGET_BINFMT_ELF),y)
- $(SED) 's/.*\(UCLIBC_FORMAT_ELF\).*/\1=y/' ${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FDPIC_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT_SEP_DATA\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_SHARED_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
-endif
-ifeq ($(ADK_TARGET_BINFMT_FDPIC),y)
- $(SED) 's/.*\(UCLIBC_FORMAT_FDPIC_ELF\).*/\1=y/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT_SEP_DATA\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_SHARED_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
-endif
-ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
- echo '# UCLIBC_FORMAT_FLAT is not set' >> ${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT\).*/\1=y/' ${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT_SEP_DATA\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_SHARED_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FDPIC_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
-ifeq ($(ADK_TARGET_BINFMT_FLAT_SEP_DATA),y)
- echo '# UCLIBC_FORMAT_FLAT_SEP_DATA is not set' >>
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT_SEP_DATA\).*/\1=y/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT \).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_SHARED_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FDPIC_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
-endif
-ifeq ($(ADK_TARGET_BINFMT_FLAT_SHARED),y)
- echo '# UCLIBC_FORMAT_SHARED_FLAT is not set' >>
${WRKBUILD}/.config
- echo '# HAVE_NO_SHARED is not set' >> ${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_SHARED_FLAT\).*/\1=y/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT \).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FLAT_SEP_DATA\).*/# \1 is not set/'
${WRKBUILD}/.config
- $(SED) 's/.*\(UCLIBC_FORMAT_FDPIC_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
-endif
-endif
ifeq ($(ADK_TARGET_LIBC_WITH_LIBICONV),y)
$(SED) 's/.*\(UCLIBC_HAS_LIBICONV\).*/\1=y/' ${WRKBUILD}/.config
endif
@@ -344,6 +308,41 @@ endif
UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
oldconfig
+
+ifeq ($(ADK_TARGET_BINFMT_ELF),y)
+ echo 'UCLIBC_FORMAT_ELF=y' >> ${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FDPIC_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FLAT_SEP_DATA\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_SHARED_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
+endif
+ifeq ($(ADK_TARGET_BINFMT_FDPIC),y)
+ echo 'UCLIBC_FORMAT_FDPIC_ELF=y' >> ${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FLAT_SEP_DATA\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_SHARED_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
+endif
+ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
+ echo 'UCLIBC_FORMAT_FLAT=y' >> ${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FLAT_SEP_DATA\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_SHARED_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FDPIC_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
+ifeq ($(ADK_TARGET_BINFMT_FLAT_SEP_DATA),y)
+ echo 'UCLIBC_FORMAT_FLAT_SEP_DATA=y' >> ${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FLAT \).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_SHARED_FLAT\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FDPIC_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
+endif
+ifeq ($(ADK_TARGET_BINFMT_FLAT_SHARED),y)
+ echo '# HAVE_NO_SHARED is not set' >> ${WRKBUILD}/.config
+ echo 'UCLIBC_FORMAT_SHARED_FLAT=y' >> ${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FLAT \).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FLAT_SEP_DATA\).*/# \1 is not set/'
${WRKBUILD}/.config
+ $(SED) 's/.*\(UCLIBC_FORMAT_FDPIC_ELF\).*/# \1 is not set/'
${WRKBUILD}/.config
+endif
+endif
+
ifeq ($(ADK_TARGET_LIBC_WITH_LOCALE),y)
$(SED)
's/.*\(UCLIBC_BUILD_MINIMAL_LOCALES\).*/\1="$(ADK_RUNTIME_DEFAULT_LOCALE)"/'
${WRKBUILD}/.config
endif
--
2.43.0