Module Name:    src
Committed By:   rin
Date:           Sat Oct  7 12:02:50 UTC 2023

Modified Files:
        src/external/gpl3/binutils/dist/gas/config: tc-vax.c tc-vax.h

Log Message:
binutils/gas: vax: PR port-vax/57646 patch provided by Kalvis Duckmanton [10/21]

Try not to emit relocations in the .eh_frame section


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
    src/external/gpl3/binutils/dist/gas/config/tc-vax.c
cvs rdiff -u -r1.9 -r1.10 src/external/gpl3/binutils/dist/gas/config/tc-vax.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/gas/config/tc-vax.c
diff -u src/external/gpl3/binutils/dist/gas/config/tc-vax.c:1.16 src/external/gpl3/binutils/dist/gas/config/tc-vax.c:1.17
--- src/external/gpl3/binutils/dist/gas/config/tc-vax.c:1.16	Sat Oct  7 11:26:09 2023
+++ src/external/gpl3/binutils/dist/gas/config/tc-vax.c	Sat Oct  7 12:02:50 2023
@@ -282,6 +282,29 @@ md_apply_fix (fixS *fixP, valueT *valueP
   if (fixP->fx_subsy != (symbolS *) NULL)
     as_bad_subtract (fixP);
 
+  if (fixP->fx_pcrel)
+    {
+      switch (fixP->fx_r_type)
+	{
+	case BFD_RELOC_32:
+	  /* change the relocation type to 32 bit PC-relative */
+	  fixP->fx_r_type = BFD_RELOC_32_PCREL;
+	  if (fixP->fx_addsy != NULL)
+	    {
+	      /* Hack around bfd_install_relocation brain damage.  */
+	      value += fixP->fx_frag->fr_address + fixP->fx_where;
+	    }
+	  if (fixP->fx_addsy == abs_section_sym)
+	    fixP->fx_done = 1;
+	  break;
+	default:
+	  break;
+	}
+    }
+
+  /*
+   * Common code for pc-relative and non-pc-relative cases
+   */
   if (fixP->fx_addsy == NULL)
     fixP->fx_done = 1;
 
@@ -3524,6 +3547,11 @@ tc_vax_regname_to_dw2regnum (char *regna
 void
 vax_cfi_emit_pcrel_expr (expressionS *expP, unsigned int nbytes)
 {
+  expressionS tmp = *expP;
+
+  tmp.X_op = O_subtract;
+  tmp.X_op_symbol = symbol_temp_new_now ();
+  expP = &tmp;
   expP->X_add_number += nbytes;
   emit_expr (expP, nbytes);
 }

Index: src/external/gpl3/binutils/dist/gas/config/tc-vax.h
diff -u src/external/gpl3/binutils/dist/gas/config/tc-vax.h:1.9 src/external/gpl3/binutils/dist/gas/config/tc-vax.h:1.10
--- src/external/gpl3/binutils/dist/gas/config/tc-vax.h:1.9	Sat Dec 24 20:17:06 2022
+++ src/external/gpl3/binutils/dist/gas/config/tc-vax.h	Sat Oct  7 12:02:50 2023
@@ -37,6 +37,8 @@
 
 #ifdef OBJ_ELF
 #define TARGET_FORMAT "elf32-vax"
+#define DIFF_EXPR_OK 1
+#define CFI_DIFF_EXPR_OK 0
 #endif
 
 #define TARGET_ARCH	bfd_arch_vax

Reply via email to