* 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.
+2011-05-05 Bernd Schmidt <bernds@codesourcery.com>
+
+ * 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.
+
2011-04-28 Tristan Gingold <gingold@adacore.com>
* coff-rs6000.c (_bfd_xcoff_swap_aux_in): Adjust for x_file.
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
}
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:
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
+2011-05-05 Bernd Schmidt <bernds@codesourcery.com>
+
+ * 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.
+
2011-05-03 Paul Brook <paul@codesourcery.com>
#ld: -r -melf32_tic6x_le
#source: attr-pic-0.s
#source: attr-pic-1.s
-#warning: .*differ in position-dependence of code addressing
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
#ld: -r -melf32_tic6x_le
#source: attr-pic-1.s
#source: attr-pic-0.s
-#warning: .*differ in position-dependence of code addressing
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
#ld: -r -melf32_tic6x_le
#source: attr-pid-0.s
#source: attr-pid-1.s
-#warning: .*differ in position-dependence of data addressing
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
+
#ld: -r -melf32_tic6x_le
#source: attr-pid-0.s
#source: attr-pid-2.s
-#warning: .*differ in position-dependence of data addressing
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
+
#ld: -r -melf32_tic6x_le
#source: attr-pid-1.s
#source: attr-pid-0.s
-#warning: .*differ in position-dependence of data addressing
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
+
#ld: -r -melf32_tic6x_le
#source: attr-pid-1.s
#source: attr-pid-2.s
-#warning: .*differ in position-dependence of data addressing
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
+ Tag_ABI_PID: Data addressing position-independent, GOT near DP
+
#ld: -r -melf32_tic6x_le
#source: attr-pid-2.s
#source: attr-pid-0.s
-#warning: .*differ in position-dependence of data addressing
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
#ld: -r -melf32_tic6x_le
#source: attr-pid-2.s
#source: attr-pid-1.s
-#warning: .*differ in position-dependence of data addressing
+#readelf: -A
+
+Attribute Section: c6xabi
+File Attributes
+ Tag_ISA: C674x
+ Tag_ABI_PID: Data addressing position-independent, GOT near DP
#name: C6X GOT relocations, no overflow
-#as: -mlittle-endian -mdsbt
+#as: -mlittle-endian -mdsbt -mpic -mpid=near
#ld: -melf32_tic6x_le -Tdsbt-inrange.ld --dsbt-index 4 -shared
#source: got-reloc-global.s
#objdump: -dr
--- /dev/null
+#name: C6X shared library without PIC code
+#as: -mlittle-endian -mdsbt -mpid=near
+#ld: -melf32_tic6x_le -Tdsbt-inrange.ld --dsbt-index 4 -shared
+#source: got-reloc-global.s
+#warning: non-PIC code
--- /dev/null
+#name: C6X shared library without PIC code
+#as: -mlittle-endian -mdsbt -mpic
+#ld: -melf32_tic6x_le -Tdsbt-inrange.ld --dsbt-index 4 -shared
+#source: got-reloc-global.s
+#warning: non-PID code