aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@codesourcery.com>2011-05-05 16:05:19 +0000
committerBernd Schmidt <bernds@codesourcery.com>2011-05-05 16:05:19 +0000
commitc6a8f6e0ed6e27fff6f17d373d628fe3cce49345 (patch)
treeede8b1283802db9025891810a59c135e0f1e8465
parenta3fcb948d3897e47ad7e952297ba61422757997b (diff)
downloadgdb-c6a8f6e0ed6e27fff6f17d373d628fe3cce49345.zip
gdb-c6a8f6e0ed6e27fff6f17d373d628fe3cce49345.tar.gz
gdb-c6a8f6e0ed6e27fff6f17d373d628fe3cce49345.tar.bz2
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.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf32-tic6x.c47
-rw-r--r--ld/testsuite/ChangeLog15
-rw-r--r--ld/testsuite/ld-tic6x/attr-pic-01.d6
-rw-r--r--ld/testsuite/ld-tic6x/attr-pic-10.d6
-rw-r--r--ld/testsuite/ld-tic6x/attr-pid-01.d7
-rw-r--r--ld/testsuite/ld-tic6x/attr-pid-02.d7
-rw-r--r--ld/testsuite/ld-tic6x/attr-pid-10.d7
-rw-r--r--ld/testsuite/ld-tic6x/attr-pid-12.d8
-rw-r--r--ld/testsuite/ld-tic6x/attr-pid-20.d6
-rw-r--r--ld/testsuite/ld-tic6x/attr-pid-21.d7
-rw-r--r--ld/testsuite/ld-tic6x/got-reloc-inrange.d2
-rw-r--r--ld/testsuite/ld-tic6x/shared-nopic.d5
-rw-r--r--ld/testsuite/ld-tic6x/shared-nopid.d5
14 files changed, 109 insertions, 26 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7af29f0..89547c0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+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.
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index 8b5f5cb..909225a 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
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 6433199..2278360 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,18 @@
+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>
diff --git a/ld/testsuite/ld-tic6x/attr-pic-01.d b/ld/testsuite/ld-tic6x/attr-pic-01.d
index a04713f..91fb599 100644
--- a/ld/testsuite/ld-tic6x/attr-pic-01.d
+++ b/ld/testsuite/ld-tic6x/attr-pic-01.d
@@ -3,4 +3,8 @@
#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
diff --git a/ld/testsuite/ld-tic6x/attr-pic-10.d b/ld/testsuite/ld-tic6x/attr-pic-10.d
index bc781c4..ff52a7a 100644
--- a/ld/testsuite/ld-tic6x/attr-pic-10.d
+++ b/ld/testsuite/ld-tic6x/attr-pic-10.d
@@ -3,4 +3,8 @@
#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
diff --git a/ld/testsuite/ld-tic6x/attr-pid-01.d b/ld/testsuite/ld-tic6x/attr-pid-01.d
index 5c32e15..a5449dc 100644
--- a/ld/testsuite/ld-tic6x/attr-pid-01.d
+++ b/ld/testsuite/ld-tic6x/attr-pid-01.d
@@ -3,4 +3,9 @@
#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
+
diff --git a/ld/testsuite/ld-tic6x/attr-pid-02.d b/ld/testsuite/ld-tic6x/attr-pid-02.d
index d155b56..2a7bfd1 100644
--- a/ld/testsuite/ld-tic6x/attr-pid-02.d
+++ b/ld/testsuite/ld-tic6x/attr-pid-02.d
@@ -3,4 +3,9 @@
#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
+
diff --git a/ld/testsuite/ld-tic6x/attr-pid-10.d b/ld/testsuite/ld-tic6x/attr-pid-10.d
index edb8a65..a421d40 100644
--- a/ld/testsuite/ld-tic6x/attr-pid-10.d
+++ b/ld/testsuite/ld-tic6x/attr-pid-10.d
@@ -3,4 +3,9 @@
#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
+
diff --git a/ld/testsuite/ld-tic6x/attr-pid-12.d b/ld/testsuite/ld-tic6x/attr-pid-12.d
index 138ae88..af7a765 100644
--- a/ld/testsuite/ld-tic6x/attr-pid-12.d
+++ b/ld/testsuite/ld-tic6x/attr-pid-12.d
@@ -3,4 +3,10 @@
#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
+
diff --git a/ld/testsuite/ld-tic6x/attr-pid-20.d b/ld/testsuite/ld-tic6x/attr-pid-20.d
index ce319bd..e2cd0bc 100644
--- a/ld/testsuite/ld-tic6x/attr-pid-20.d
+++ b/ld/testsuite/ld-tic6x/attr-pid-20.d
@@ -3,4 +3,8 @@
#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
diff --git a/ld/testsuite/ld-tic6x/attr-pid-21.d b/ld/testsuite/ld-tic6x/attr-pid-21.d
index 7097db6..c0f71df 100644
--- a/ld/testsuite/ld-tic6x/attr-pid-21.d
+++ b/ld/testsuite/ld-tic6x/attr-pid-21.d
@@ -3,4 +3,9 @@
#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
diff --git a/ld/testsuite/ld-tic6x/got-reloc-inrange.d b/ld/testsuite/ld-tic6x/got-reloc-inrange.d
index e4fed04..4260444 100644
--- a/ld/testsuite/ld-tic6x/got-reloc-inrange.d
+++ b/ld/testsuite/ld-tic6x/got-reloc-inrange.d
@@ -1,5 +1,5 @@
#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
diff --git a/ld/testsuite/ld-tic6x/shared-nopic.d b/ld/testsuite/ld-tic6x/shared-nopic.d
new file mode 100644
index 0000000..8748f10
--- /dev/null
+++ b/ld/testsuite/ld-tic6x/shared-nopic.d
@@ -0,0 +1,5 @@
+#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
diff --git a/ld/testsuite/ld-tic6x/shared-nopid.d b/ld/testsuite/ld-tic6x/shared-nopid.d
new file mode 100644
index 0000000..7f366f3
--- /dev/null
+++ b/ld/testsuite/ld-tic6x/shared-nopid.d
@@ -0,0 +1,5 @@
+#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