On 20.03.2012 09:56, Andreas Bießmann wrote:
> The 'warn-on-all-TEXTRELs.patch' produces warnings on some embedded projects:
>
> ---8<---
> arm-v5te-linux-gnueabi-ld: warning: creating a DT_TEXTREL in object.
> text data bss dec hex filename
> 423076 7480 305016 735572 b3954 /tmp/build_arm_at91/u-boot
> --->8---
>
> This renders this toolchain nearly un-usable for this use-case. If one will
> see these warnings he can always use the '--warn-shared-textrel' switch so
> this patch will only revert the 'default to warn' to 'default to ignore
> warning' which is in fact the default for GNU linker.
>
> Another point is that even crosstool-ng has switched back and removed this
> patch, it seems there are some other users bothered by that warning.
>
> Signed-off-by: Andreas Bießmann <[email protected]>
> ---
Any comment on that patch?
> ...1-05-31-Paul-Brook-paul-codesourcery.com.patch} | 0
> .../0002-warn-on-all-TEXTRELs.patch | 80
> --------------------
> patches/binutils-2.21.1a/series | 5 +-
> 3 files changed, 2 insertions(+), 83 deletions(-)
> rename
> patches/binutils-2.21.1a/{0003-2011-05-31-Paul-Brook-paul-codesourcery.com.patch
> => 0002-2011-05-31-Paul-Brook-paul-codesourcery.com.patch} (100%)
> delete mode 100644 patches/binutils-2.21.1a/0002-warn-on-all-TEXTRELs.patch
>
> diff --git
> a/patches/binutils-2.21.1a/0003-2011-05-31-Paul-Brook-paul-codesourcery.com.patch
>
> b/patches/binutils-2.21.1a/0002-2011-05-31-Paul-Brook-paul-codesourcery.com.patch
> similarity index 100%
> rename from
> patches/binutils-2.21.1a/0003-2011-05-31-Paul-Brook-paul-codesourcery.com.patch
> rename to
> patches/binutils-2.21.1a/0002-2011-05-31-Paul-Brook-paul-codesourcery.com.patch
> diff --git a/patches/binutils-2.21.1a/0002-warn-on-all-TEXTRELs.patch
> b/patches/binutils-2.21.1a/0002-warn-on-all-TEXTRELs.patch
> deleted file mode 100644
> index 3be8fae..0000000
> --- a/patches/binutils-2.21.1a/0002-warn-on-all-TEXTRELs.patch
> +++ /dev/null
> @@ -1,80 +0,0 @@
> -From: unknown author <[email protected]>
> -Date: Tue, 1 Nov 2011 16:44:50 +0100
> -Subject: [PATCH] warn on all TEXTRELs
> -
> -textrels are bad for forcing copy-on-write (this affects everyone),
> -and for security/runtime code generation, this affects security ppl.
> -But in either case, it doesn't matter who needs textrels, it's
> -the very fact that they're needed at all.
> -
> -2006-06-10 Ned Ludd <[email protected]>, Mike Frysinger <[email protected]>
> -
> - * bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs.
> - * ld/ldmain.c (main): Change textrel warning default to true.
> - * ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL
> - warnings from ld output.
> -
> -Original patch from gentoo. Also used by crosstool-ng (binutils-2.20.1a).
> ----
> - bfd/elflink.c | 8 +++-----
> - ld/ldmain.c | 1 +
> - ld/testsuite/lib/ld-lib.exp | 4 ++++
> - 3 files changed, 8 insertions(+), 5 deletions(-)
> -
> -diff --git a/bfd/elflink.c b/bfd/elflink.c
> -index 9e69ec6..0396659 100644
> ---- a/bfd/elflink.c
> -+++ b/bfd/elflink.c
> -@@ -11114,14 +11114,12 @@ bfd_elf_final_link (bfd *abfd, struct
> bfd_link_info *info)
> - goto error_return;
> -
> - /* Check for DT_TEXTREL (late, in case the backend removes it). */
> -- if (info->warn_shared_textrel && info->shared)
> -+ o = bfd_get_section_by_name (dynobj, ".dynamic");
> -+ if (info->warn_shared_textrel && o != NULL)
> - {
> - bfd_byte *dyncon, *dynconend;
> -
> - /* Fix up .dynamic entries. */
> -- o = bfd_get_section_by_name (dynobj, ".dynamic");
> -- BFD_ASSERT (o != NULL);
> --
> - dyncon = o->contents;
> - dynconend = o->contents + o->size;
> - for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
> -@@ -11133,7 +11131,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info
> *info)
> - if (dyn.d_tag == DT_TEXTREL)
> - {
> - info->callbacks->einfo
> -- (_("%P: warning: creating a DT_TEXTREL in a shared
> object.\n"));
> -+ (_("%P: warning: creating a DT_TEXTREL in object.\n"));
> - break;
> - }
> - }
> -diff --git a/ld/ldmain.c b/ld/ldmain.c
> -index 96f3bda..9f88cc4 100644
> ---- a/ld/ldmain.c
> -+++ b/ld/ldmain.c
> -@@ -287,6 +287,7 @@ main (int argc, char **argv)
> - emulation = get_emulation (argc, argv);
> - ldemul_choose_mode (emulation);
> - default_target = ldemul_choose_target (argc, argv);
> -+ link_info.warn_shared_textrel = TRUE;
> - config.maxpagesize = bfd_emul_get_maxpagesize (default_target);
> - config.commonpagesize = bfd_emul_get_commonpagesize (default_target);
> - lang_init ();
> -diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
> -index f444da7..f935f12 100644
> ---- a/ld/testsuite/lib/ld-lib.exp
> -+++ b/ld/testsuite/lib/ld-lib.exp
> -@@ -206,6 +206,10 @@ proc default_ld_simple_link { ld target objects } {
> - # symbol, since the default linker script might use ENTRY.
> - regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry
> symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
> -
> -+ # Gentoo tweak:
> -+ # We want to ignore TEXTREL warnings since we force enable them by
> default
> -+ regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\."
> $exec_output "\\1" exec_output
> -+
> - if [string match "" $exec_output] then {
> - return 1
> - } else {
> diff --git a/patches/binutils-2.21.1a/series b/patches/binutils-2.21.1a/series
> index bab2133..f0d739a 100644
> --- a/patches/binutils-2.21.1a/series
> +++ b/patches/binutils-2.21.1a/series
> @@ -1,6 +1,5 @@
> # generated by git-ptx-patches
> #tag:base --start-number 1
> 0001-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch
> -0002-warn-on-all-TEXTRELs.patch
> -0003-2011-05-31-Paul-Brook-paul-codesourcery.com.patch
> -# df7383a34a1fb7245bbcc4a517757b0a - git-ptx-patches magic
> +0002-2011-05-31-Paul-Brook-paul-codesourcery.com.patch
> +# ab44a8a2deb9ac0a004704a7638a046e - git-ptx-patches magic
>
--
ptxdist mailing list
[email protected]