Skip to content

Tools.gmk: Add annobin GCC plugin #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: devkit
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 40 additions & 5 deletions make/devkit/Tools.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ ifeq ($(GCC_VER), 11.3.0)
gmp_ver := gmp-6.2.1
mpc_ver := mpc-1.2.1
gdb_ver := gdb-11.2
annobin_ver := annobin-12.99
REQUIRED_MIN_MAKE_MAJOR_VERSION := 4
else ifeq ($(GCC_VER), 11.2.0)
gcc_ver := gcc-11.2.0
Expand Down Expand Up @@ -195,6 +196,10 @@ MPFR := https://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2
GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2
MPC := http://ftp.gnu.org/pub/gnu/mpc/${mpc_ver}.tar.gz
GDB := http://ftp.gnu.org/gnu/gdb/${gdb_ver}.tar.xz
ifneq (,$(annobin_ver))
ANNOBIN := https://nickc.fedorapeople.org/$(annobin_ver).tar.xz
gcc_ver_only := $(patsubst gcc-%,%,$(gcc_ver))
endif

# RPMs used by all BASE_OS
RPM_LIST := \
Expand Down Expand Up @@ -280,7 +285,7 @@ define Download
endef

# Download and unpack all source packages
$(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC GDB,$(eval $(call Download,$(p))))
$(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC GDB $(if $(annobin_ver),ANNOBIN),$(eval $(call Download,$(p))))

##########################################################################################
# Unpack RPMS
Expand Down Expand Up @@ -360,7 +365,7 @@ endif
##########################################################################################

# Define marker files for each source package to be compiled
$(foreach t,binutils mpfr gmp mpc gcc ccache gdb,$(eval $(t) = $(TARGETDIR)/$($(t)_ver).done))
$(foreach t,binutils mpfr gmp mpc gcc ccache gdb $(if $(annobin_ver),annobin),$(eval $(t) = $(TARGETDIR)/$($(t)_ver).done))

##########################################################################################

Expand Down Expand Up @@ -432,6 +437,7 @@ $(gcc) \
$(mpfr) \
$(mpc) \
$(bfdmakes) \
$(if $(annobin_ver),$(annobin)) \
$(ccache) : ENVS += $(TOOLS)

# libdir to work around hateful bfd stuff installing into wrong dirs...
Expand Down Expand Up @@ -470,7 +476,7 @@ $(BUILDDIR)/$(binutils_ver)/Makefile \
--enable-multilib \
--enable-threads \
--enable-plugins \
) 2>&1 | tee $(@D)/log.config
) 2>&1 | tee $(@D)/log.config
@echo 'done'

$(BUILDDIR)/$(mpfr_ver)/Makefile \
Expand Down Expand Up @@ -521,6 +527,28 @@ $(BUILDDIR)/$(mpc_ver)/Makefile \
) 2>&1 | tee $(@D)/log.config
@echo 'done'

ifneq (,$(annobin_ver))
$(BUILDDIR)/$(annobin_ver)/Makefile \
: $(ANNOBIN_CFG)
$(info Configuring $@. Log in $(@D)/log.config)
@mkdir -p $(@D)
( \
cd $(@D) ; \
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS) -I$(PREFIX)/include" CXXFLAGS="$(CFLAGS) -I$(PREFIX)/include" \
$(ANNOBIN_CFG) \
$(CONFIG) \
--with-gcc-plugin-dir=$(PREFIX)/lib/gcc/$(TARGET)/$(gcc_ver_only)/plugin \
--without-annocheck \
--without-tests \
--without-docs \
--disable-rpath \
--without-debuginfod \
--without-clang-plugin \
--without-llvm-plugin \
) 2>&1 | tee $(@D)/log.config
@echo 'done'
endif

# Only valid if glibc target -> linux
# proper destructor handling for c++
ifneq (,$(findstring linux,$(TARGET)))
Expand Down Expand Up @@ -575,6 +603,10 @@ $(BUILDDIR)/$(gcc_ver)/Makefile : $(gmp) $(mpfr) $(mpc)
$(mpfr) : $(gmp)
$(mpc) : $(gmp) $(mpfr)

ifneq (,$(annobin_ver))
$(annobin) : $(gcc) $(gmp)
endif

################################################################################
# Build gdb but only where host and target match
ifeq ($(HOST), $(TARGET))
Expand Down Expand Up @@ -718,10 +750,13 @@ libs : $(libs)
sysroot : rpms libs
gcc : sysroot $(gcc) $(gccpatch)
gdb : $(gdb)
ifneq (,$(annobin_ver))
annobin : $(annobin)
endif
all : binutils gcc bfdlib $(PREFIX)/devkit.info $(missing-links) $(SYSROOT_LINKS) \
$(THESE_MAKEFILES) gdb
$(THESE_MAKEFILES) gdb $(if $(annobin_ver),annobin)

# this is only built for host. so separate.
ccache : $(ccache)

.PHONY : gcc all binutils bfdlib link_libs rpms libs sysroot
.PHONY : gcc all binutils bfdlib link_libs rpms libs sysroot $(if $(annobin_ver),annobin)