This aligns legacy gcc with the changes to gcc4 committed in 4192115 and
the two subsequent commits. It also disables legacy ld's default
behaviour of recursively resolving shared-library dependencies at link
time, preventing missing-library warnings during the build and aligning
ld's behaviour with that of more recent versions.
gcc2:
* CPP_SPEC: Replace non-existent command-line options with valid
equivalents.
* CC1_SPEC: Remove non-existent "no-fpic" option; add "fno-pic" and
"fno-PIC" as options that disable the generation of
position-independent code; use "-fPIC" by default.
* LINK_SPEC: Pass "-shared" to the linker only if it was passed to gcc;
output position-independent executables by default, exporting all
symbols to match the behaviour of "-shared"; when building a
dynamically linked executable, do not recursively add shared libraries
as dependencies but do allow unresolved symbols in them; specify
"-Bsymbolic" only when building a shared library.
* All: Wrap lines at 80 columns; use more compact notation where
available.
ld:
* Do not recursively resolve shared-library dependencies when building
an executable if the "--no-add-needed" and "--allow-shlib-undefined"
options are in effect. This effectively backports binutils commits
8fbb09e and 4706eab.
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
For x86_64 this includes defining a new linker emulation, "elf_x86_64_haiku"
(to match the existing "elf_i386_haiku") and updating gcc accordingly.
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
Update LINK_SPEC (for arm, i386, x86_64 and ppc) with more compact but
functionally equivalent sequences.
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
* CC1_SPEC: Remove non-existent "no-fpic" command-line option; add
"fno-PIC" and "fno-PIE" as options that disable the generation of
position-independent code; use "-fPIC" by default.
* LINK_SPEC: Pass "-shared" to the linker only if it was passed to gcc; output
position-independent executables by default; when linking executables, allow
undefined symbols in shared libraries and export all symbols (to match the
behaviour of "-shared").
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
Works around "relocation truncated to fit: R_PPC_GOT16 against symbol" issue
mentioned in #10240. PIC uses a larger GOT which doesn't overflow, unlike pic.
Simplify haiku-specific ppc emulation script, and reuse
common code, which seems to fix the linker issue mentioned
in #10240:
_GLOBAL_OFFSET_TABLE_ not defined in linker created .got
While the union trick used there gave the correct results, it made the
defines non-constants so they couldn't be used properly in some cases.
In particular, this makes the testsuite for gettext and some other GNU
packages fail as they explicitly test for these being constants.
If setting OPTIM by jam basically makes it impossible for the project that
is using jam to set its own optimization level while still allowing user
to override that in command line. For example in Haiku jam files there is
line like this: "OPTIM ?= -O2", which obviously is meant to set optimization
level to O2 unless user overwrites it. Unfortunately, because Jam have already
set OPTIM to -O this line never had an intended effect.
After this Jam no longer thinks it knows best what is good for projects
that are using it and Haiku is by default compiled with -O2.
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
* Adjust the libgcc spec to actually link against libgcc explicitly
(it is no longer included in libroot.so on anything except x86_gcc2).
* Apply --as-needed when linking against libgcc_s.so
* Drop search paths that no longer exist (/boot/common/...).
* The glue code files crtbegin.o and crtend.o don't cleanup globals
properly, only the variants with the S suffix do. As executables are
shared on Haiku, we use crtbeginS.o and crtendS.o for those, too.
This fixes crashes on shutdown of Haiku servers that load add-ons (e.g.
Print Server and Media Add-On Server).
* The configure script for libstdc++ contained a couple of duplicate
'haiku*' case entries, where the first would shadow the second.
* Correct several incorrect libtool definitions and paths.
* Gcc will now build libgcc.a, libgcc_eh.a and libgcc_s.so.
* Activate thread support for libgcc.
* Let libgcc use ELF dwarf2 unwinding on Haiku.
* Activate ELF symbol versioning on Haiku.
* Activate use of __cxa_atexit
* Drop fragments of Haiku support for mipsel