This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Pending SPARC patches for binutils
- To: binutils at sourceware dot cygnus dot com
- Subject: Pending SPARC patches for binutils
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 22 Feb 2000 21:08:24 +0100
Hi!
Attached are SPARC patches which have not made it into binutils yet.
The first one among other things fixes a segfault during linking on
nearly any sparc 64bit object, the latter makes it possible to turn strict
.register checking off if gcc sets it by default in the spec file (via
-Wa,-undeclared-regs). Otherwise the new binutils cannot be used with new
gcc to build e.g. the linux kernel.
Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.47 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________
1999-10-29 Jakub Jelinek <jakub@redhat.com>
* elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Don't bump
architecture if the object causing the bump is dynamic.
* elf64-sparc.c (sparc64_elf_merge_private_bfd_data): Ditto,
neither do it for memory ordering.
(sparc64_elf_write_relocs): Fix relocation when OLO10 comes
into play.
--- binutils/bfd/elf32-sparc.c.jj Sat Sep 4 18:26:08 1999
+++ binutils/bfd/elf32-sparc.c Mon Oct 11 11:15:13 1999
@@ -1871,7 +1871,8 @@ elf32_sparc_merge_private_bfd_data (ibfd
(_("%s: compiled for a 64 bit system and target is 32 bit"),
bfd_get_filename (ibfd));
}
- else if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
+ else if (bfd_get_mach (obfd) < bfd_get_mach (ibfd)
+ && !(ibfd->flags & DYNAMIC))
bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
#endif
--- binutils/bfd/elf64-sparc.c.jj Mon Aug 9 17:07:32 1999
+++ binutils/bfd/elf64-sparc.c Sat Oct 23 22:53:21 1999
@@ -474,7 +474,7 @@ sparc64_elf_write_relocs (abfd, sec, dat
{
boolean *failedp = (boolean *) data;
Elf_Internal_Shdr *rela_hdr;
- Elf64_External_Rela *outbound_relocas;
+ Elf64_External_Rela *outbound_relocas, *src_rela;
unsigned int idx, count;
asymbol *last_sym = 0;
int last_sym_idx = 0;
@@ -534,17 +534,16 @@ sparc64_elf_write_relocs (abfd, sec, dat
/* orelocation has the data, reloc_count has the count... */
outbound_relocas = (Elf64_External_Rela *) rela_hdr->contents;
+ src_rela = outbound_relocas;
for (idx = 0; idx < sec->reloc_count; idx++)
{
Elf_Internal_Rela dst_rela;
- Elf64_External_Rela *src_rela;
arelent *ptr;
asymbol *sym;
int n;
ptr = sec->orelocation[idx];
- src_rela = outbound_relocas + idx;
/* The address of an ELF reloc is section relative for an object
file, and absolute for an executable file or shared library.
@@ -601,7 +600,7 @@ sparc64_elf_write_relocs (abfd, sec, dat
dst_rela.r_info = ELF64_R_INFO (n, ptr->howto->type);
dst_rela.r_addend = ptr->addend;
- bfd_elf64_swap_reloca_out (abfd, &dst_rela, src_rela);
+ bfd_elf64_swap_reloca_out (abfd, &dst_rela, src_rela++);
}
}
@@ -2799,25 +2798,32 @@ sparc64_elf_merge_private_bfd_data (ibfd
{
error = false;
- old_flags |= (new_flags & (EF_SPARC_SUN_US1|EF_SPARC_HAL_R1));
- new_flags |= (old_flags & (EF_SPARC_SUN_US1|EF_SPARC_HAL_R1));
- if ((old_flags & (EF_SPARC_SUN_US1|EF_SPARC_HAL_R1)) ==
- (EF_SPARC_SUN_US1|EF_SPARC_HAL_R1))
- {
- error = true;
- (*_bfd_error_handler)
- (_("%s: linking UltraSPARC specific with HAL specific code"),
- bfd_get_filename (ibfd));
- }
-
- /* Choose the most restrictive memory ordering */
- old_mm = (old_flags & EF_SPARCV9_MM);
- new_mm = (new_flags & EF_SPARCV9_MM);
- old_flags &= ~EF_SPARCV9_MM;
- new_flags &= ~EF_SPARCV9_MM;
- if (new_mm < old_mm) old_mm = new_mm;
- old_flags |= old_mm;
- new_flags |= old_mm;
+ if (ibfd->flags & DYNAMIC) {
+ /* We don't want dynamic objects memory ordering and architecture to
+ have any role. That's what dynamic linker should do. */
+ old_flags &= ~(EF_SPARCV9_MM|EF_SPARC_SUN_US1|EF_SPARC_HAL_R1);
+ old_flags |= (new_flags & (EF_SPARCV9_MM|EF_SPARC_SUN_US1|EF_SPARC_HAL_R1));
+ } else {
+ /* Choose the highest architecture requirements */
+ old_flags |= (new_flags & (EF_SPARC_SUN_US1|EF_SPARC_HAL_R1));
+ new_flags |= (old_flags & (EF_SPARC_SUN_US1|EF_SPARC_HAL_R1));
+ if ((old_flags & (EF_SPARC_SUN_US1|EF_SPARC_HAL_R1)) ==
+ (EF_SPARC_SUN_US1|EF_SPARC_HAL_R1))
+ {
+ error = true;
+ (*_bfd_error_handler)
+ (_("%s: linking UltraSPARC specific with HAL specific code"),
+ bfd_get_filename (ibfd));
+ }
+ /* Choose the most restrictive memory ordering */
+ old_mm = (old_flags & EF_SPARCV9_MM);
+ new_mm = (new_flags & EF_SPARCV9_MM);
+ old_flags &= ~EF_SPARCV9_MM;
+ new_flags &= ~EF_SPARCV9_MM;
+ if (new_mm < old_mm) old_mm = new_mm;
+ old_flags |= old_mm;
+ new_flags |= old_mm;
+ }
/* Warn about any other mismatches */
if (new_flags != old_flags)
1999-12-13 Jakub Jelinek <jakub@redhat.com>
* config/tc-sparc.c (OPTION_UNDECLARED_REGS): New option.
(md_parse_option): Handle it.
(md_show_usage): Document it.
--- binutils/gas/config/tc-sparc.c.jj Tue Nov 30 11:31:11 1999
+++ binutils/gas/config/tc-sparc.c Mon Dec 13 09:09:19 1999
@@ -413,6 +413,8 @@ struct option md_longopts[] = {
#ifdef OBJ_ELF
#define OPTION_NO_UNDECLARED_REGS (OPTION_MD_BASE + 12)
{"no-undeclared-regs", no_argument, NULL, OPTION_NO_UNDECLARED_REGS},
+#define OPTION_UNDECLARED_REGS (OPTION_MD_BASE + 13)
+ {"undeclared-regs", no_argument, NULL, OPTION_UNDECLARED_REGS},
#endif
{NULL, no_argument, NULL, 0}
};
@@ -568,6 +570,10 @@ md_parse_option (c, arg)
case OPTION_NO_UNDECLARED_REGS:
no_undeclared_regs = 1;
break;
+
+ case OPTION_UNDECLARED_REGS:
+ no_undeclared_regs = 0;
+ break;
#endif
default:
@@ -621,6 +627,10 @@ md_show_usage (stream)
fprintf (stream, _("\
-KPIC generate PIC\n\
-V print assembler version number\n\
+-undeclared-regs ignore application global register usage without\n\
+ appropriate .register directive (default)\n\
+-no-undeclared-regs force error on application global register usage\n\
+ without appropriate .register directive\n\
-q ignored\n\
-Qy, -Qn ignored\n\
-s ignored\n"));