From: Gerald Pfeifer <gerald@pfeifer.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Andreas Tobler <andreast@freebsd.org>,
Lorenzo Salvadore <developer@lorenzosalvadore.it>,
gcc@gcc.gnu.org
Subject: Re: GCC testing on FreeBSD
Date: Sun, 28 Apr 2024 12:24:09 +0200 (CEST) [thread overview]
Message-ID: <866dda5e-c983-ac16-de71-05b685536cd7@pfeifer.com> (raw)
In-Reply-To: <CAH6eHdRgPSYcV3BwRjqNQFhhOu7o1TzOgTJkHEg1U3V1rqy8eQ@mail.gmail.com>
Hi Jonathan,
On Fri, 26 Apr 2024, Jonathan Wakely wrote:
> How are you testing on FreeBSD?
>
> When I build GCC trunk on FreeBSD 14.0 and try to run the libstdc++
> testsuite it fails due to lots of these errors:
>
> Excess errors:
> /usr/local/bin/ld: /tmp//ccev946q.o: relocation R_X86_64_32 against
> symbol `_ZTIN10__cxxabiv115__forced_unwindE@@CXXABI_1.3.2' can not be
> used when making a PDE object; recompile with -fPIE
> /usr/local/bin/ld: failed to set dynamic section sizes: bad value
my first reaction was to recommend using binutils instead of /usr/bin/ld
which is LLD 16.0.6 or similar (since a while ago FreeBSD switched to that
toolchain as part of the base system).
My nightly tester has been using GNU ld since
# 2012-03-11 Configure using --with-as=$localbase/bin/as and
# --with-ld=$localbase/bin/ld on *.freebsd.org.
in the script invoked by cron, even before FreeBSD made that switch.
Seeing /usr/local/bin/ld in the error message it appears you are doing
that already, though?
> Which suggests that -fPIE is missing from the default test flags.
>
> Have you seen this? Do you do something locally to work around it?
All I have in terms of adjustments to the FreeBSD systems I build on via
that script are the following
CONFIGUREFLAGS="--with-gmp=$LOCALBASE --with-as=$LOCALBASE/bin/as $CONFIGUREFLAGS"
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LOCALBASE/lib
PATH=$LOCALBASE/bin:$PATH
where LOCALBASE looks like it would be /usr/local in your case. Nothing
explicit around PIE there.
Looking at the logs of a serialized build I triggered manually where I
remove the --with-ld configure option, I see
checking linker PIE support with copy reloc... no
checking for -fno-PIE option... yes
checking for -no-pie option... yes
and then build invocations like
c++ -std=c++11 -fno-PIE -c ...
during all-stage1-target-libgcc which ultimately fails with - mystery?! -
ld: error: unable to find library -lc
collect2: error: ld returned 1 exit status
gmake[3]: *** [Makefile:1005: libgcc_s.so] Error 1
(Disclaimer: all my tests on FreeBSD 13.2, not FreeBSD 14 as in your
case.)
Looking at the lang/gcc* ports that I maintained for two decades until
Lorenzo (copied now) kindly took them over two years ago I see the
following change among others for newer versions:
% git show b6a5871a0cf40
commit b6a5871a0cf40dfc194217704e2dc03e2e91fb62
Author: Lorenzo Salvadore <salvadore@FreeBSD.org>
Date: Fri Feb 3 20:12:49 2023 +0100
lang/gcc10: Mark PIE_UNSAFE
Building the port with WITH_PIE fails if the BOOTSTRAP option is
enabled. Mark PIE_UNSAFE when this option is enabled until a better
solution is found.
PR: 268901
where https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268901 is the PR
referenced.
PIE_UNSAFE=yes in a port's Makefile (the equivalent to a spec file in RPM
land) is used as follows in ports/Mk/Features/pie.mk:
. if !defined(PIE_UNSAFE)
PIE_CFLAGS?= -fPIE -fPIC
CFLAGS+= ${PIE_CFLAGS}
CXXFLAGS+= ${PIE_CFLAGS}
LDFLAGS+= -pie
STATIC_PIE_ARGS+= -static-pie
. endif
You are not using the Ports Infrastructure, I believe, so the above does
not directly apply, may provide some additional background, though?
Hope this helps - and please chime in Lorenzo and Andreas!
Gerald
next prev parent reply other threads:[~2024-04-28 10:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 11:06 Jonathan Wakely
2024-04-28 10:24 ` Gerald Pfeifer [this message]
2024-04-28 10:32 ` Rainer Orth
2024-04-28 13:39 ` Lorenzo Salvadore
2024-04-28 17:19 ` Rainer Orth
2024-04-28 18:38 ` Lorenzo Salvadore
2024-04-29 12:21 ` Rainer Orth
2024-04-28 16:17 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=866dda5e-c983-ac16-de71-05b685536cd7@pfeifer.com \
--to=gerald@pfeifer.com \
--cc=andreast@freebsd.org \
--cc=developer@lorenzosalvadore.it \
--cc=gcc@gcc.gnu.org \
--cc=jwakely.gcc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).