[libatomic] : fix building inside the source directory [PR125583]
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
Commit Message
Since the libatomic_asneeded libtool workarounds GCC no longer builds if
./configure is ran inside the source tree.
it fails at building libgomp with
checking whether the C compiler works... no
configure: error: in `/root/gcc-16.1.0/aarch64-unknown-linux-gnu/libgomp':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[2]: *** [Makefile:23007: configure-stage1-target-libgomp] Error 77
This happens because in configure.ac there is
# --srcdir=. covers the toplevel, while "test -d" covers the subdirectories
if ( test $srcdir = . && test -d gcc ) \
|| test -d $srcdir/../host-${host_noncanonical}; then
host_subdir="host-${host_noncanonical}"
else
host_subdir=.
fi
# No prefix.
target_subdir=${target_noncanonical}
which shifts `host_subdir` to `host-${host_noncanonical}`
however the chunks in libatomic assumes that the `host_subdir` is `.` leading to
the builds not working.
This fixes it by passing HOST_SUBDIR down to child Makefiles and then using it
in libatomic. It defaults to . in libatomic if not provided to support
standalone builds.
Bootstrapped Regtested on aarch64-none-linux-gnu,
arm-none-linux-gnueabihf, x86_64-pc-linux-gnu
-m32, -m64 and no issues.
Also tested an in source folder build and that works now too.
Ok for master? and backport to GCC 16 after some stew?
Thanks,
Tamar
ChangeLog:
PR bootstrap/125583
* Makefile.in: Pass HOST_SUBDIR down.
* Makefile.tpl: likewise.
libatomic/ChangeLog:
PR bootstrap/125583
* Makefile.am: Use HOST_SUBDIR in gcc_objdir.
* Makefile.in: Likewise.
---
--
@@ -1111,6 +1111,7 @@ EXTRA_TARGET_FLAGS = \
'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
'LD=$(COMPILER_LD_FOR_TARGET)' \
'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
+ 'HOST_SUBDIR=$(HOST_SUBDIR)' \
'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
'NM=$(COMPILER_NM_FOR_TARGET)' \
@@ -836,6 +836,7 @@ EXTRA_TARGET_FLAGS = \
'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
'LD=$(COMPILER_LD_FOR_TARGET)' \
'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
+ 'HOST_SUBDIR=$(HOST_SUBDIR)' \
'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
'NM=$(COMPILER_NM_FOR_TARGET)' \
@@ -180,7 +180,8 @@ all-multi: $(libatomic_la_LIBADD)
# built after libatomic, which makes RPATH insecure. Removing libatomic.la
# from $gcc_objdir seems to fix the issue.
-gcc_objdir = `pwd`/$(MULTIBUILDTOP)../../gcc/
+HOST_SUBDIR = .
+gcc_objdir = `pwd`/$(MULTIBUILDTOP)../../$(HOST_SUBDIR)/gcc/
all-local: stmp-libatomic
stmp-libatomic: libatomic.la
$(LIBTOOL) --mode=install $(INSTALL_DATA) libatomic.la $(gcc_objdir)$(MULTISUBDIR)/
@@ -486,7 +486,8 @@ libatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD)
# which (somehow) ends up adding $gcc_objdir to RPATH for libraries that get
# built after libatomic, which makes RPATH insecure. Removing libatomic.la
# from $gcc_objdir seems to fix the issue.
-gcc_objdir = `pwd`/$(MULTIBUILDTOP)../../gcc/
+HOST_SUBDIR = .
+gcc_objdir = `pwd`/$(MULTIBUILDTOP)../../$(HOST_SUBDIR)/gcc/
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =