Module Name:    src
Committed By:   rin
Date:           Sat Nov 25 12:06:43 UTC 2023

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

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

Try not to emit relocations in the .eh_frame section

Taken from binutils/gas:
https://mail-index.netbsd.org/source-changes/2023/10/07/msg147941.html


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
    src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c
cvs rdiff -u -r1.7 -r1.8 \
    src/external/gpl3/binutils.old/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.old/dist/gas/config/tc-vax.c
diff -u src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c:1.8 src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c:1.9
--- src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c:1.8	Sat Nov 25 12:05:22 2023
+++ src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c	Sat Nov 25 12:06:42 2023
@@ -282,6 +282,29 @@ md_apply_fix (fixS *fixP, valueT *valueP
   if (fixP->fx_subsy != (symbolS *) NULL)
     as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
 
+  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;
 
@@ -3601,6 +3624,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.old/dist/gas/config/tc-vax.h
diff -u src/external/gpl3/binutils.old/dist/gas/config/tc-vax.h:1.7 src/external/gpl3/binutils.old/dist/gas/config/tc-vax.h:1.8
--- src/external/gpl3/binutils.old/dist/gas/config/tc-vax.h:1.7	Fri Dec 23 17:09:22 2022
+++ src/external/gpl3/binutils.old/dist/gas/config/tc-vax.h	Sat Nov 25 12:06:42 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