public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ld: microblaze: Add error detail for mxl-gp-opt flag
@ 2023-09-27 13:48 Neal Frager
  2023-09-28 19:47 ` Michael Eager
  0 siblings, 1 reply; 2+ messages in thread
From: Neal Frager @ 2023-09-27 13:48 UTC (permalink / raw)
  To: binutils
  Cc: ibai.erkiaga-elorza, nagaraju.mekala, mark.hatle,
	sadanand.mutyala, appa.rao.nali, vidhumouli.hunsigida,
	luca.ceresoli, Neal Frager

Compiler will give error messages in more detail
for microblaze mxl-gp-opt flag.

This patch has been tested for years of AMD Xilinx Yocto
releases as part of the following patch set:

https://github.com/Xilinx/meta-xilinx/tree/master/meta-microblaze/recipes-devtools/binutils/binutils

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
 ld/ldmain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ld/ldmain.c b/ld/ldmain.c
index 06ac2c64fa8..aca3d84ccf1 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -1575,6 +1575,16 @@ reloc_overflow (struct bfd_link_info *info,
 	  break;
 	case bfd_link_hash_defined:
 	case bfd_link_hash_defweak:
+	  if((strcmp(reloc_name,"R_MICROBLAZE_SRW32") == 0) &&  entry->type == bfd_link_hash_defined)
+	  {
+	  einfo (_(" relocation truncated to fit: don't enable small data pointer optimizations[mxl-gp-opt] if extern or multiple declarations used: "
+		 "%s against symbol `%T' defined in %A section in %B"),
+		 reloc_name, entry->root.string,
+		 entry->u.def.section,
+		 entry->u.def.section == bfd_abs_section_ptr
+		 ? info->output_bfd : entry->u.def.section->owner);
+	  break;
+	  }	
 	  einfo (_(" relocation truncated to fit: "
 		   "%s against symbol `%pT' defined in %pA section in %pB"),
 		 reloc_name, entry->root.string,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] ld: microblaze: Add error detail for mxl-gp-opt flag
  2023-09-27 13:48 [PATCH v1 1/1] ld: microblaze: Add error detail for mxl-gp-opt flag Neal Frager
@ 2023-09-28 19:47 ` Michael Eager
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Eager @ 2023-09-28 19:47 UTC (permalink / raw)
  To: Neal Frager, binutils
  Cc: ibai.erkiaga-elorza, nagaraju.mekala, mark.hatle,
	sadanand.mutyala, appa.rao.nali, vidhumouli.hunsigida,
	luca.ceresoli

On 9/27/23 06:48, Neal Frager via Binutils wrote:
> Compiler will give error messages in more detail
> for microblaze mxl-gp-opt flag.
> 
> This patch has been tested for years of AMD Xilinx Yocto
> releases as part of the following patch set:
> 
> https://github.com/Xilinx/meta-xilinx/tree/master/meta-microblaze/recipes-devtools/binutils/binutils
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
>   ld/ldmain.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/ld/ldmain.c b/ld/ldmain.c
> index 06ac2c64fa8..aca3d84ccf1 100644
> --- a/ld/ldmain.c
> +++ b/ld/ldmain.c
> @@ -1575,6 +1575,16 @@ reloc_overflow (struct bfd_link_info *info,
>   	  break;
>   	case bfd_link_hash_defined:
>   	case bfd_link_hash_defweak:
> +	  if((strcmp(reloc_name,"R_MICROBLAZE_SRW32") == 0) &&  entry->type == bfd_link_hash_defined)
> +	  {
> +	  einfo (_(" relocation truncated to fit: don't enable small data pointer optimizations[mxl-gp-opt] if extern or multiple declarations used: "
> +		 "%s against symbol `%T' defined in %A section in %B"),
> +		 reloc_name, entry->root.string,
> +		 entry->u.def.section,
> +		 entry->u.def.section == bfd_abs_section_ptr
> +		 ? info->output_bfd : entry->u.def.section->owner);
> +	  break;
> +	  }	
>   	  einfo (_(" relocation truncated to fit: "
>   		   "%s against symbol `%pT' defined in %pA section in %pB"),
>   		 reloc_name, entry->root.string,

Hi Neal --

It would be better if the patch were moved after the 
bfd_link_hash_defined case and the (then redundant) test for 
entry->type removed.  Add a /* FALL THROUGH */ notation.

ldmain.c is generic code.  There are no tests for any other 
architecture.  I'm reluctant to add target-dependent tests in generic 
code.  Perhaps one of the linker maintainers can comment on this.

If this additional diagnostic information is useful for MicroBlaze, 
perhaps it would be useful for all other architectures (without the 
MB-specific option, of course).


-- 
Michael Eager


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-28 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27 13:48 [PATCH v1 1/1] ld: microblaze: Add error detail for mxl-gp-opt flag Neal Frager
2023-09-28 19:47 ` Michael Eager

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).