Skip to content

Commit

Permalink
dc-chain: adding sh_force_libbfd_installation flag.
Browse files Browse the repository at this point in the history
This flag could be used if you want to force the installation of `libbfd` for the SH toolchain.
This is required for MinGW/MSYS and can't be disabled in this scenario. This option is here mainly if you want to force the installation of `libbfd` under other environments; but this won't be necessary in most cases, as `libelf` is used almost everywhere.
This flag has been tested for building static binaries of GCC 12.2.0 using MinGW-w64 environment.
  • Loading branch information
sizious committed Feb 27, 2023
1 parent 9bc4588 commit 4932ff9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
9 changes: 9 additions & 0 deletions utils/dc-chain/config.mk.legacy.sample
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,12 @@ install_mode=install-strip
# also disable the 'kos' thread model. Don't mess with that flag unless you know
# exactly what you are doing.
#auto_fixup_sh4_newlib=0

# Force installation of BFD for SH (1|0)
# Uncomment this if you want to force the installation of 'libbfd' for the SH
# toolchain. This is required for MinGW/MSYS and can't be disabled in this
# scenario. This option is here mainly if you want to force the installation of
# 'libbfd' under other environments; but this won't be necessary in most cases,
# as 'libelf' is used almost everywhere. Don't mess with that flag unless you
# know exactly what you are doing.
#sh_force_libbfd_installation=1
9 changes: 9 additions & 0 deletions utils/dc-chain/config.mk.stable.sample
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,12 @@ install_mode=install-strip
# also disable the 'kos' thread model. Don't mess with that flag unless you know
# exactly what you are doing.
#auto_fixup_sh4_newlib=0

# Force installation of BFD for SH (1|0)
# Uncomment this if you want to force the installation of 'libbfd' for the SH
# toolchain. This is required for MinGW/MSYS and can't be disabled in this
# scenario. This option is here mainly if you want to force the installation of
# 'libbfd' under other environments; but this won't be necessary in most cases,
# as 'libelf' is used almost everywhere. Don't mess with that flag unless you
# know exactly what you are doing.
#sh_force_libbfd_installation=1
9 changes: 9 additions & 0 deletions utils/dc-chain/config.mk.testing.sample
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,12 @@ install_mode=install-strip
# also disable the 'kos' thread model. Don't mess with that flag unless you know
# exactly what you are doing.
#auto_fixup_sh4_newlib=0

# Force installation of BFD for SH (1|0)
# Uncomment this if you want to force the installation of 'libbfd' for the SH
# toolchain. This is required for MinGW/MSYS and can't be disabled in this
# scenario. This option is here mainly if you want to force the installation of
# 'libbfd' under other environments; but this won't be necessary in most cases,
# as 'libelf' is used almost everywhere. Don't mess with that flag unless you
# know exactly what you are doing.
#sh_force_libbfd_installation=1
2 changes: 1 addition & 1 deletion utils/dc-chain/scripts/binutils.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $(build_binutils): logdir
$(to_log)
$(MAKE) $(makejobs) -C $(build) DESTDIR=$(DESTDIR) $(to_log)
$(MAKE) -C $(build) $(install_mode) DESTDIR=$(DESTDIR) $(to_log)
# MinGW/MSYS
# MinGW/MSYS or 'sh_force_libbfd_installation=1'
# This part is about BFD for sh-elf target.
# It will move sh-elf libbfd into a nicer place, as our cross-compiler is made
# by us for our usage... so no problems about system libbfd conflicts!
Expand Down
8 changes: 7 additions & 1 deletion utils/dc-chain/scripts/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ $(build_sh4_targets): extra_configure_args = --with-multilib-list=m4-single-only
$(build_sh4_targets): gcc_ver = $(sh_gcc_ver)
$(build_sh4_targets): binutils_ver = $(sh_binutils_ver)

ifdef MINGW
# MinGW/MSYS or 'sh_force_libbfd_installation=1': install BFD if required.
# To compile dc-tool, we need to install libbfd for sh-elf.
# This is done when making build-sh4-binutils.
ifdef sh_force_libbfd_installation
ifneq (0,$(sh_force_libbfd_installation))
do_sh_force_libbfd_installation := 1
endif
endif
ifneq ($(or $(MINGW),$(do_sh_force_libbfd_installation)),)
$(build_sh4_targets): libbfd_install_flag = -enable-install-libbfd -enable-install-libiberty
$(build_sh4_targets): libbfd_src_bin_dir = $(sh_prefix)/$(host_triplet)/$(sh_target)
endif
Expand Down

0 comments on commit 4932ff9

Please sign in to comment.