diff mbox

[ARM] Suppress the dynamic linker commands for statically linked programs

Message ID CAPk6zkDPWzr7evw72upaHS=txQ=8S8fJei1oxxPW0qXfpZNfoA@mail.gmail.com
State New
Headers show

Commit Message

Ben Cheng Sept. 14, 2012, 8:34 p.m. UTC
Hi,

Recently we found out that the .interp section starts to show up in
ARM executables compiled with "-shared -static" and the gold linker
from binutils 2.22. We tracked down the origin of the dynamic linker
commands and they are always explicitly specified in
config/arm/linux-elf.h. We tested the following simple patch to
suppress the dynamic linker options for statically linked programs on
Android's AOSP tree. Everything builds fine and the unneeded .interp
section is gone.

Thanks,
-Ben

==

gcc/ChangeLog
2012-09-14 Ben Cheng <bccheng@google.com>
    * config/arm/linux-elf.h: Suppress the dynamic linker commands for
    statically linked programs.

Comments

Richard Earnshaw Sept. 17, 2012, 10:13 a.m. UTC | #1
On 14/09/12 21:34, Ben Cheng wrote:
> Hi,
> 
> Recently we found out that the .interp section starts to show up in
> ARM executables compiled with "-shared -static" and the gold linker
> from binutils 2.22. We tracked down the origin of the dynamic linker
> commands and they are always explicitly specified in
> config/arm/linux-elf.h. We tested the following simple patch to
> suppress the dynamic linker options for statically linked programs on
> Android's AOSP tree. Everything builds fine and the unneeded .interp
> section is gone.
> 
> Thanks,
> -Ben
> 
> ==
> 
> gcc/ChangeLog
> 2012-09-14 Ben Cheng <bccheng@google.com>
>     * config/arm/linux-elf.h: Suppress the dynamic linker commands for
>     statically linked programs.
> 
> Index: config/arm/linux-elf.h
> ===================================================================
> --- config/arm/linux-elf.h	(revision 191198)
> +++ config/arm/linux-elf.h	(working copy)
> @@ -65,8 +65,9 @@
>     %{static:-Bstatic} \
>     %{shared:-shared} \
>     %{symbolic:-Bsymbolic} \
> -   %{rdynamic:-export-dynamic} \
> -   -dynamic-linker " GNU_USER_DYNAMIC_LINKER " \
> +   %{!static: \
> +     %{rdynamic:-export-dynamic} \
> +     -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
>     -X \
>     %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
>     SUBTARGET_EXTRA_LINK_SPEC
> 

OK.

R.
diff mbox

Patch

Index: config/arm/linux-elf.h
===================================================================
--- config/arm/linux-elf.h	(revision 191198)
+++ config/arm/linux-elf.h	(working copy)
@@ -65,8 +65,9 @@ 
    %{static:-Bstatic} \
    %{shared:-shared} \
    %{symbolic:-Bsymbolic} \
-   %{rdynamic:-export-dynamic} \
-   -dynamic-linker " GNU_USER_DYNAMIC_LINKER " \
+   %{!static: \
+     %{rdynamic:-export-dynamic} \
+     -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
    -X \
    %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    SUBTARGET_EXTRA_LINK_SPEC