summaryrefslogtreecommitdiff
path: root/bfd/elf32-tic6x.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2011-05-05 16:05:16 +0000
committerBernd Schmidt <bernd.schmidt@analog.com>2011-05-05 16:05:16 +0000
commit9c701ec0d2cf0ffa826cabe13867696e0cfacf65 (patch)
tree282d2ec663116e6f8f56f5f102b52a628e924486 /bfd/elf32-tic6x.c
parent47ad50797d503377b85c006b39f3a107d0186ab9 (diff)
downloadbinutils-redhat-9c701ec0d2cf0ffa826cabe13867696e0cfacf65.tar.gz
bfd/
* elf32-tic6x.c (elf32_tic6x_final_link): New function. (elf32_tic6x_merge_attributes): Do not warn for PID or PIC mismatch. Choose the lower of the two values. (bfd_elf32_bfd_final_link): New macro. ld/testsuite/ * ld-tic6x/shared-nopic.d: New test. * ld-tic6x/shared-nopid.d: New test. * ld-tic6x/attr-pid-21.d: Don't expect a warning; check readelf output instead. * ld-tic6x/attr-pid-12.d: Likewise. * ld-tic6x/attr-pic-01.d: Likewise. * ld-tic6x/attr-pic-10.d: Likewise. * ld-tic6x/attr-pid-01.d: Likewise. * ld-tic6x/attr-pid-10.d: Likewise. * ld-tic6x/attr-pid-02.d: Likewise. * ld-tic6x/attr-pid-20.d: Likewise. * ld-tic6x/got-reloc-inrange.d: Pass -mpic and -mpid options to gas.
Diffstat (limited to 'bfd/elf32-tic6x.c')
-rw-r--r--bfd/elf32-tic6x.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index 8b5f5cb418..909225a5c3 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -1519,6 +1519,31 @@ elf32_tic6x_link_hash_table_create (bfd *abfd)
return &ret->elf.root;
}
+static bfd_boolean
+elf32_tic6x_final_link (bfd *abfd, struct bfd_link_info *info)
+{
+ if (info->shared)
+ {
+ obj_attribute *out_attr;
+ out_attr = elf_known_obj_attributes_proc (abfd);
+ if (out_attr[Tag_ABI_PIC].i == 0)
+ {
+ _bfd_error_handler (_("warning: generating a shared library "
+ "containing non-PIC code"));
+ }
+ if (out_attr[Tag_ABI_PID].i == 0)
+ {
+ _bfd_error_handler (_("warning: generating a shared library "
+ "containing non-PID code"));
+ }
+ }
+ /* Invoke the regular ELF backend linker to do all the work. */
+ if (!bfd_elf_final_link (abfd, info))
+ return FALSE;
+
+ return TRUE;
+}
+
/* Destroy a C6X ELF linker hash table. */
static void
@@ -3764,24 +3789,10 @@ elf32_tic6x_merge_attributes (bfd *ibfd, bfd *obfd)
}
break;
- case Tag_ABI_PID:
- if (out_attr[i].i != in_attr[i].i)
- {
- _bfd_error_handler
- (_("warning: %B and %B differ in position-dependence of "
- "data addressing"),
- obfd, ibfd);
- }
- break;
-
case Tag_ABI_PIC:
- if (out_attr[i].i != in_attr[i].i)
- {
- _bfd_error_handler
- (_("warning: %B and %B differ in position-dependence of "
- "code addressing"),
- obfd, ibfd);
- }
+ case Tag_ABI_PID:
+ if (out_attr[i].i > in_attr[i].i)
+ out_attr[i].i = in_attr[i].i;
break;
case Tag_ABI_array_object_alignment:
@@ -3944,6 +3955,8 @@ elf32_tic6x_copy_private_data (bfd * ibfd, bfd * obfd)
elf32_tic6x_size_dynamic_sections
#define elf_backend_finish_dynamic_sections \
elf32_tic6x_finish_dynamic_sections
+#define bfd_elf32_bfd_final_link \
+ elf32_tic6x_final_link
#define elf_info_to_howto elf32_tic6x_info_to_howto
#define elf_info_to_howto_rel elf32_tic6x_info_to_howto_rel