* [PATCH] Alpha support for -z combreloc
@ 2001-08-23 10:01 Jakub Jelinek
2001-08-23 14:22 ` Richard Henderson
2001-08-24 6:12 ` Andreas Jaeger
0 siblings, 2 replies; 4+ messages in thread
From: Jakub Jelinek @ 2001-08-23 10:01 UTC (permalink / raw)
To: rth; +Cc: binutils
Hi!
Here is alpha support for -z combreloc, creates no regressions in make check
when -z combreloc is the default. Ok to commit?
Note that -z combreloc is not the default in the patch I've checked in, and
cannot be until all elf backends which use elf32.em are updated at least to
compute DT_TEXTREL differently. Adding *_reloc_type_class is not strictly
necessary, ld will just not set DT_REL{,A}COUNT if it is not defined and
might sort relocs against the same symbol less efficiently (but that's just
optimization).
2001-08-23 Jakub Jelinek <jakub@redhat.com>
* elf64-alpha.c (struct alpha_elf_link_hash_entry): Add reltext flag.
(elf64_alpha_check_relocs): Set it if section this reloc is against
is read-only. Set DF_TEXTREL if a RELATIVE reloc is needed against
read-only section.
(elf64_alpha_calc_dynrel_sizes): Set DF_TEXTREL flag if relocation
is is against read-only section.
(elf64_alpha_size_dynamic_sections): Use DF_TEXTREL flag, don't
check section names.
(elf64_alpha_reloc_type_class): New.
(elf_backend_reloc_type_class): Define.
--- bfd/elf64-alpha.c.jj Wed Aug 22 23:16:28 2001
+++ bfd/elf64-alpha.c Wed Aug 22 23:27:26 2001
@@ -133,6 +133,8 @@ static boolean elf64_alpha_merge_ind_sym
PARAMS((struct alpha_elf_link_hash_entry *, PTR));
static Elf_Internal_Rela * elf64_alpha_find_reloc_at_ofs
PARAMS ((Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_vma, int));
+static enum elf_reloc_type_class elf64_alpha_reloc_type_class
+ PARAMS ((int));
\f
struct alpha_elf_link_hash_entry
{
@@ -182,7 +184,10 @@ struct alpha_elf_link_hash_entry
asection *srel;
/* what kind of relocation? */
- unsigned long rtype;
+ unsigned int rtype;
+
+ /* is this against read-only section? */
+ unsigned int reltext : 1;
/* how many did we find? */
unsigned long count;
@@ -2627,6 +2632,7 @@ elf64_alpha_check_relocs (abfd, info, se
rent->srel = sreloc;
rent->rtype = r_type;
rent->count = 1;
+ rent->reltext = (sec->flags & SEC_READONLY) != 0;
rent->next = h->reloc_entries;
h->reloc_entries = rent;
@@ -2639,6 +2645,8 @@ elf64_alpha_check_relocs (abfd, info, se
/* If this is a shared library, and the section is to be
loaded into memory, we need a RELATIVE reloc. */
sreloc->_raw_size += sizeof (Elf64_External_Rela);
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
break;
}
@@ -3181,6 +3189,8 @@ elf64_alpha_calc_dynrel_sizes (h, info)
{
relent->srel->_raw_size +=
sizeof (Elf64_External_Rela) * relent->count;
+ if (relent->reltext)
+ info->flags |= DT_TEXTREL;
}
dynobj = elf_hash_table(info)->dynobj;
@@ -3214,7 +3224,6 @@ elf64_alpha_size_dynamic_sections (outpu
{
bfd *dynobj;
asection *s;
- boolean reltext;
boolean relplt;
dynobj = elf_hash_table(info)->dynobj;
@@ -3263,7 +3272,6 @@ elf64_alpha_size_dynamic_sections (outpu
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
memory for them. */
- reltext = false;
relplt = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
@@ -3293,19 +3301,6 @@ elf64_alpha_size_dynamic_sections (outpu
if (!strip)
{
- const char *outname;
- asection *target;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL entry. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
-
if (strcmp(name, ".rela.plt") == 0)
relplt = true;
@@ -3361,11 +3356,10 @@ elf64_alpha_size_dynamic_sections (outpu
sizeof (Elf64_External_Rela)))
return false;
- if (reltext)
+ if (info->flags & DF_TEXTREL)
{
if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
return false;
- info->flags |= DF_TEXTREL;
}
}
@@ -4650,6 +4644,23 @@ elf64_alpha_final_link (abfd, info)
return true;
}
+
+static enum elf_reloc_type_class
+elf64_alpha_reloc_type_class (type)
+ int type;
+{
+ switch (type)
+ {
+ case R_ALPHA_RELATIVE:
+ return reloc_class_relative;
+ case R_ALPHA_JMP_SLOT:
+ return reloc_class_plt;
+ case R_ALPHA_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
\f
/* ECOFF swapping routines. These are used when dealing with the
.mdebug section, which is in the ECOFF debugging format. Copied
@@ -4777,6 +4788,8 @@ const struct elf_size_info alpha_elf_siz
elf64_alpha_finish_dynamic_sections
#define bfd_elf64_bfd_final_link \
elf64_alpha_final_link
+#define elf_backend_reloc_type_class \
+ elf64_alpha_reloc_type_class
#define elf_backend_ecoff_debug_swap \
&elf64_alpha_ecoff_debug_swap
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Alpha support for -z combreloc
2001-08-23 10:01 [PATCH] Alpha support for -z combreloc Jakub Jelinek
@ 2001-08-23 14:22 ` Richard Henderson
2001-08-24 6:12 ` Andreas Jaeger
1 sibling, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2001-08-23 14:22 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: binutils
On Thu, Aug 23, 2001 at 07:04:25PM +0200, Jakub Jelinek wrote:
> * elf64-alpha.c (struct alpha_elf_link_hash_entry): Add reltext flag.
> (elf64_alpha_check_relocs): Set it if section this reloc is against
> is read-only. Set DF_TEXTREL if a RELATIVE reloc is needed against
> read-only section.
> (elf64_alpha_calc_dynrel_sizes): Set DF_TEXTREL flag if relocation
> is is against read-only section.
> (elf64_alpha_size_dynamic_sections): Use DF_TEXTREL flag, don't
> check section names.
> (elf64_alpha_reloc_type_class): New.
> (elf_backend_reloc_type_class): Define.
Ok.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Alpha support for -z combreloc
2001-08-23 10:01 [PATCH] Alpha support for -z combreloc Jakub Jelinek
2001-08-23 14:22 ` Richard Henderson
@ 2001-08-24 6:12 ` Andreas Jaeger
2001-08-24 7:46 ` Andreas Schwab
1 sibling, 1 reply; 4+ messages in thread
From: Andreas Jaeger @ 2001-08-24 6:12 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: binutils
Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> Here is alpha support for -z combreloc, creates no regressions in make check
> when -z combreloc is the default. Ok to commit?
>
> Note that -z combreloc is not the default in the patch I've checked in, and
> cannot be until all elf backends which use elf32.em are updated at least to
> compute DT_TEXTREL differently. Adding *_reloc_type_class is not strictly
> necessary, ld will just not set DT_REL{,A}COUNT if it is not defined and
> might sort relocs against the same symbol less efficiently (but that's just
> optimization).
Checking ld/Makefile.am, the following 61 elf backends (which share
bfd elf backends) use elf32.em:
To Do:
earmelf.c
earmelf_linux.c
ecriself.c
ecrislinux.c
ed10velf.c
eelf32fr30.c
eelf32mcore.c
em32relf.c
eelf32_i860.c
eelf32_i960.c
eelf32b4300.c
eelf32bmip.c
eelf32bsmip.c
eelf32btsmip.c
eelf32ltsmip.c
eelf32ebmip.c
eelf32elmip.c
eelf32bmipn32.c
eelf32l4300.c
eelf32lmip.c
eelf32lppc.c
eelf32lppcsim.c
eelf32lsmip.c
eelf32openrisc.c
eelf32ppc.c
eelf32ppcsim.c
eelf32ppclinux.c
eelf32i370.c
eelf64hppa.c
eelf64_aix.c
eelf64_s390.c
eelf64bmip.c
eelf64btsmip.c
eelf64ltsmip.c
eelf_s390.c
ehppaelf.c
ehppalinux.c
ehppa64linux.c
em68kelf.c
em68kpsos.c
emn10300.c
emn10200.c
epjelf.c
epjlelf.c
eppcnw.c
eshelf.c
eshelf_linux.c
eshlelf_linux.c
eshlelf.c
ev850.c
Done already (AFAIK):
eelf32_sparc.c
eelf_i386.c
eelf_x86_64.c
eelf_i386_be.c
eelf_i386_chaos.c
eelf_i386_ldso.c
ei386moss.c
ei386nw.c
eelf64alpha.c
eelf64_ia64.c
eelf64_sparc.c
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Alpha support for -z combreloc
2001-08-24 6:12 ` Andreas Jaeger
@ 2001-08-24 7:46 ` Andreas Schwab
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2001-08-24 7:46 UTC (permalink / raw)
To: Andreas Jaeger; +Cc: Jakub Jelinek, binutils
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]
Andreas Jaeger <aj@suse.de> writes:
|> Jakub Jelinek <jakub@redhat.com> writes:
|>
|> > Hi!
|> >
|> > Here is alpha support for -z combreloc, creates no regressions in make check
|> > when -z combreloc is the default. Ok to commit?
|> >
|> > Note that -z combreloc is not the default in the patch I've checked in, and
|> > cannot be until all elf backends which use elf32.em are updated at least to
|> > compute DT_TEXTREL differently. Adding *_reloc_type_class is not strictly
|> > necessary, ld will just not set DT_REL{,A}COUNT if it is not defined and
|> > might sort relocs against the same symbol less efficiently (but that's just
|> > optimization).
|>
|> Checking ld/Makefile.am, the following 61 elf backends (which share
|> bfd elf backends) use elf32.em:
|>
|> To Do:
[...]
|> em68kelf.c
I'm currently working on it.
Andreas.
--
Andreas Schwab "And now for something
SuSE Labs completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-08-24 7:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-23 10:01 [PATCH] Alpha support for -z combreloc Jakub Jelinek
2001-08-23 14:22 ` Richard Henderson
2001-08-24 6:12 ` Andreas Jaeger
2001-08-24 7:46 ` Andreas Schwab
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).