This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, ld, arm] Fix broken -Bsymbolic-functions


On Fri, Jul 24, 2015 at 10:05 AM, Thomas Preud'homme
<thomas.preudhomme@arm.com> wrote:
> GNU ld generates absolute relocation for non function call references to functions (eg. initialization of function pointer) despite the presence of -Bsymbolic-functions. This issue has already been dealt with in Aarch64 some time ago but although a check for similar issues in other targets was done, it was done incorrectly (probably by looking for the whole condition on a single line instead of just grepping for !.*->dynamic).
>
> Target that appears to be affected:
>
>     arm
>     hppa
>     m68k
>     nios2
>     tic6x
>
> This patch fixes the issue for ARM targets.
>


OK for the ARM backend. I don't mind this going into 2.25 at the least
but Tristan needs to ack that.

Ramana
>
> ChangeLog entries are as follow:
>
> *** bfd/ChangeLog ***
>
> 2015-07-20  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>
>         * elf32-arm.c (elf32_arm_final_link_relocate): Use SYMBOLIC_BIND to
>         check if a symbol should be bound symbolically.
>
> *** ld/testsuite/ChangeLog ***
>
> 2015-07-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>
>         * ld-arm/arm-elf.exp: Added relocs-23-symbolic-func test.
>         * ld-arm/relocs-23-symbolic-func.d: New file.
>         * ld-arm/relocs-23-symbolic-func.s: Likewise.
>
>
> diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
> index 113f4eb..82a5a6f 100644
> --- a/bfd/elf32-arm.c
> +++ b/bfd/elf32-arm.c
> @@ -8449,7 +8449,7 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
>           else if (h != NULL
>                    && h->dynindx != -1
>                    && (!info->shared
> -                      || !info->symbolic
> +                      || !SYMBOLIC_BIND (info, h)
>                        || !h->def_regular))
>             outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
>           else
> diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
> index 28b41ca..8c8fa8f 100644
> --- a/ld/testsuite/ld-arm/arm-elf.exp
> +++ b/ld/testsuite/ld-arm/arm-elf.exp
> @@ -301,6 +301,7 @@ run_dump_test "movw-shared-3"
>  run_dump_test "movw-shared-4"
>  run_dump_test "rel32-reject"
>  run_dump_test "rel32-reject-pie"
> +run_dump_test "relocs-23-symbolic-func"
>
>  # Exclude non-ARM-EABI targets.
>
> diff --git a/ld/testsuite/ld-arm/relocs-23-symbolic-func.d b/ld/testsuite/ld-arm/relocs-23-symbolic-func.d
> new file mode 100644
> index 0000000..c10e291
> --- /dev/null
> +++ b/ld/testsuite/ld-arm/relocs-23-symbolic-func.d
> @@ -0,0 +1,5 @@
> +#source: relocs-23-symbolic-func.s
> +#ld: -shared -Bsymbolic-functions
> +#readelf: -r --wide
> +#...
> +.* +R_ARM_RELATIVE +.*
> diff --git a/ld/testsuite/ld-arm/relocs-23-symbolic-func.s b/ld/testsuite/ld-arm/relocs-23-symbolic-func.s
> new file mode 100644
> index 0000000..1ee50d8
> --- /dev/null
> +++ b/ld/testsuite/ld-arm/relocs-23-symbolic-func.s
> @@ -0,0 +1,11 @@
> +       .text
> +       .global tempy
> +       .type   tempy, %function
> +tempy:
> +       .size   tempy, .-tempy
> +       .section        .data.rel
> +       .align 2
> +       .type   tempy_ptr, %object
> +       .size   tempy_ptr, 4
> +tempy_ptr:
> +       .word   tempy
>
>
> No regression was observed when running testsuite for arm-none-eabi
>
> Is this ok for master as well as 2.24 and 2.25 stable branches?
>
> Best regards,
>
> Thomas
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]