Opened 9 years ago
Closed 9 years ago
#12439 closed bug (fixed)
gcc 2 won't build a non-position-independent executable
Reported by: | simonsouth | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | System | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
(This is the legacy-buildtools equivalent of #12430.)
The attached patches align gcc 2.95 and ld 2.17 with recent changes to their new-world counterparts. With the patches applied
- The default behaviour of gcc and ld is not changed.
- Users can ask gcc to build a non-position-independent executable with the
-fno-pic
option. - Position-independent executables are built by default, using the
-fPIC
compiler setting and by explicitly specifying-pie
to the linker. - An
INTERP
segment is included in every executable with a link to/system/runtime_loader
.
Attachments (2)
Change History (6)
comment:1 by , 9 years ago
patch: | 0 → 1 |
---|
comment:2 by , 9 years ago
by , 9 years ago
Attachment: | 0001-gcc2-Allow-the-user-to-build-non-PI-executables.patch added |
---|
gcc2: Allow the user to build non-PI executables
by , 9 years ago
Attachment: | 0002-binutils-legacy-ld-Set-ELF-interpreter-to-system-run.patch added |
---|
binutils (legacy): ld: Set ELF interpreter to /system/runtime_loader
comment:3 by , 9 years ago
I've updated both patches. The first patch additionally
- Refactors
LINK_SPEC
to pass both the--no-add-needed
and--allow-shlib-undefined
options to the linker whenever a dynamically linked executable is being built. This instructs the linker to not recursively add shared libraries as dependencies but to allow undefined symbols in them (expected for BeOS and Haiku). - Patches the linker to skip recursively resolving the dependencies of a shared library if the
--no-add-needed
and--allow-shlib-undefined
options are set. This was made the default behaviour of ld after binutils 2.17 (which is why this issue doesn't come up when building with gcc 4); effectively this change backports binutils commit 4706eab, which was a refinement of 8fbb09e.
You should find this allows the build to complete without those missing-library warnings.
I've modified the description in the second patch to use a short GUID for the commit it mentions.
comment:4 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Very good! Applied in btrev43111. Thanks!
Linking displays messages now (lib not found).