"* LINK_SPEC: Pass "-shared" to the linker only if it was passed to gcc; output
position-independent executables by default;" is reverted to workaround a
link failure on gcc4 with binutils 2.26: add-ons objects would fail to link
against an executable (being no more a shared object). This is possibly temporary
until the need for executable as shared objects is fully reviewed.
Correct LINK_SPEC so it
* Sets appropriate dynamic-link options for any type of dynamically
linked executable, not only position-independent ones.
* Does not omit these options if "-pie" is specified by the user.
* Recognizes the "-static" option.
* Includes a hyphen previously missing from "--no-undefined".
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
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>