Skip to contentSkip to conversation

src/rtld: Add MicroBlaze support based on glibc-2.24

PATCH Mark Hatle 2 participants 4 messages Jun 19, 2017 – Jun 20, 2017 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Mark Hatle

author
#1 lore raw

I've merged this to the cross_prelink_staging (and master_staging, even though it's a no-op there). The change seems fairly obvious to me.

Can you verify it is working properly as merged into cross_prelink_staging, then I'll move it to the full cross_prelink and master.

--Mark

Quoted 63 lines · Nathan Rossi

Add definitions/config to support MicroBlaze, using glibc-2.24 as reference.

---
 src/rtld/dl-tls.c |  5 +++++
 src/rtld/rtld.c   | 12 ++++++++++++
 2 files changed, 17 insertions(+)
src/rtld/dl-tls.c +5 -0
index 8b972ff126..2da6bc5c66 100644
@@ -133,6 +133,11 @@ rtld_determine_tlsoffsets (int e_machine, struct r_scope_elem *search_list)
       tls_tcb_size = 0;
       break;
 
+    case EM_MICROBLAZE:
+      tls_dtv_at_tp = 1;
+      tls_tcb_size = 8;
+      break;
+
     default:
       /* Hope there's no TLS!  */
       for (i = 0; i < search_list->r_nlist; i++)
src/rtld/rtld.c +12 -0
index 8d7d760a57..3196981247 100644
@@ -215,6 +215,15 @@ parse_opt (int key, char *arg, struct argp_state *state)
    | (((type) == R_NIOS2_COPY) * ELF_RTYPE_CLASS_COPY)          \
    | (((type) == R_NIOS2_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(EM_ALTERA_NIOS2)))
 
+/* From glibc-2.24: sysdeps/microblaze/dl-machine.h */
+# define microblaze_elf_machine_type_class(type) \
+  (((type) == R_MICROBLAZE_JUMP_SLOT || \
+    (type) == R_MICROBLAZE_TLSDTPREL32 || \
+    (type) == R_MICROBLAZE_TLSDTPMOD32 || \
+    (type) == R_MICROBLAZE_TLSTPREL32) \
+    * ELF_RTYPE_CLASS_PLT \
+   | ((type) == R_MICROBLAZE_COPY) * ELF_RTYPE_CLASS_COPY)
+
 int
 elf_machine_type_class (int type, int machine)
 {
@@ -243,6 +252,8 @@ elf_machine_type_class (int type, int machine)
 	return sparc64_elf_machine_type_class(type);
     case EM_ALTERA_NIOS2:
 	return nios2_elf_machine_type_class(type);
+    case EM_MICROBLAZE:
+	return microblaze_elf_machine_type_class(type);
 
     default:
       printf ("Unknown architecture!\n");
@@ -284,6 +295,7 @@ machine_no_rela (int machine)
     case EM_SPARC32PLUS:
     case EM_SPARCV9:
     case EM_ALTERA_NIOS2:
+    case EM_MICROBLAZE:
       return 0;
     default:
       return 1;
#2 lore raw
Quoted 5 lines · Mark Hatle

I've merged this to the cross_prelink_staging (and master_staging, even though it's a no-op there). The change seems fairly obvious to me.

Can you verify it is working properly as merged into cross_prelink_staging, then I'll move it to the full cross_prelink and master.

Tested the cross_prelink_staging branch and verified that it behaves as expected.

Sorry I forgot to add the ChangeLog entry. However when you added it you used 2016 for the year.

On a side note, once merged into the cross_prelink branch do you see any issues with updating the SRCREV in oe-core?

Thanks,
Nathan

Quoted 68 lines

--Mark

Quoted 63 lines · Nathan Rossi

Add definitions/config to support MicroBlaze, using glibc-2.24 as reference.

---
 src/rtld/dl-tls.c |  5 +++++
 src/rtld/rtld.c   | 12 ++++++++++++
 2 files changed, 17 insertions(+)
src/rtld/dl-tls.c +5 -0
index 8b972ff126..2da6bc5c66 100644
@@ -133,6 +133,11 @@ rtld_determine_tlsoffsets (int e_machine, struct r_scope_elem *search_list)
       tls_tcb_size = 0;
       break;
 
+    case EM_MICROBLAZE:
+      tls_dtv_at_tp = 1;
+      tls_tcb_size = 8;
+      break;
+
     default:
       /* Hope there's no TLS!  */
       for (i = 0; i < search_list->r_nlist; i++)
src/rtld/rtld.c +12 -0
index 8d7d760a57..3196981247 100644
@@ -215,6 +215,15 @@ parse_opt (int key, char *arg, struct argp_state *state)
    | (((type) == R_NIOS2_COPY) * ELF_RTYPE_CLASS_COPY)          \
    | (((type) == R_NIOS2_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(EM_ALTERA_NIOS2)))
 
+/* From glibc-2.24: sysdeps/microblaze/dl-machine.h */
+# define microblaze_elf_machine_type_class(type) \
+  (((type) == R_MICROBLAZE_JUMP_SLOT || \
+    (type) == R_MICROBLAZE_TLSDTPREL32 || \
+    (type) == R_MICROBLAZE_TLSDTPMOD32 || \
+    (type) == R_MICROBLAZE_TLSTPREL32) \
+    * ELF_RTYPE_CLASS_PLT \
+   | ((type) == R_MICROBLAZE_COPY) * ELF_RTYPE_CLASS_COPY)
+
 int
 elf_machine_type_class (int type, int machine)
 {
@@ -243,6 +252,8 @@ elf_machine_type_class (int type, int machine)
      return sparc64_elf_machine_type_class(type);
     case EM_ALTERA_NIOS2:
      return nios2_elf_machine_type_class(type);
+    case EM_MICROBLAZE:
+     return microblaze_elf_machine_type_class(type);
 
     default:
       printf ("Unknown architecture!\n");
@@ -284,6 +295,7 @@ machine_no_rela (int machine)
     case EM_SPARC32PLUS:
     case EM_SPARCV9:
     case EM_ALTERA_NIOS2:
+    case EM_MICROBLAZE:
       return 0;
     default:
       return 1;
author
#3 lore raw
Quoted 4 lines · Nathan Rossi
Quoted 3 lines · Mark Hatle

I've merged this to the cross_prelink_staging (and master_staging, even though it's a no-op there). The change seems fairly obvious to me.

Quoted 8 lines
Quoted 2 lines

Can you verify it is working properly as merged into cross_prelink_staging, then I'll move it to the full cross_prelink and master.

Tested the cross_prelink_staging branch and verified that it behaves as expected.

Sorry I forgot to add the ChangeLog entry. However when you added it you used 2016 for the year.

whoops. I'll correct that.

Quoted 2 lines

On a side note, once merged into the cross_prelink branch do you see any issues with updating the SRCREV in oe-core?

I've got a few other patches that I'd forgotten about. Once I merge those (and do some basic validation on them).. I'll send up a request for oe-core. If you don't see it in the next few days, feel free to send up an update yourself.

--Mark

Quoted 71 lines

Thanks,
Nathan

Quoted 68 lines

--Mark

Quoted 63 lines · Nathan Rossi

Add definitions/config to support MicroBlaze, using glibc-2.24 as reference.

---
 src/rtld/dl-tls.c |  5 +++++
 src/rtld/rtld.c   | 12 ++++++++++++
 2 files changed, 17 insertions(+)
src/rtld/dl-tls.c +5 -0
index 8b972ff126..2da6bc5c66 100644
@@ -133,6 +133,11 @@ rtld_determine_tlsoffsets (int e_machine, struct r_scope_elem *search_list)
       tls_tcb_size = 0;
       break;
 
+    case EM_MICROBLAZE:
+      tls_dtv_at_tp = 1;
+      tls_tcb_size = 8;
+      break;
+
     default:
       /* Hope there's no TLS!  */
       for (i = 0; i < search_list->r_nlist; i++)
src/rtld/rtld.c +12 -0
index 8d7d760a57..3196981247 100644
@@ -215,6 +215,15 @@ parse_opt (int key, char *arg, struct argp_state *state)
    | (((type) == R_NIOS2_COPY) * ELF_RTYPE_CLASS_COPY)          \
    | (((type) == R_NIOS2_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(EM_ALTERA_NIOS2)))
 
+/* From glibc-2.24: sysdeps/microblaze/dl-machine.h */
+# define microblaze_elf_machine_type_class(type) \
+  (((type) == R_MICROBLAZE_JUMP_SLOT || \
+    (type) == R_MICROBLAZE_TLSDTPREL32 || \
+    (type) == R_MICROBLAZE_TLSDTPMOD32 || \
+    (type) == R_MICROBLAZE_TLSTPREL32) \
+    * ELF_RTYPE_CLASS_PLT \
+   | ((type) == R_MICROBLAZE_COPY) * ELF_RTYPE_CLASS_COPY)
+
 int
 elf_machine_type_class (int type, int machine)
 {
@@ -243,6 +252,8 @@ elf_machine_type_class (int type, int machine)
      return sparc64_elf_machine_type_class(type);
     case EM_ALTERA_NIOS2:
      return nios2_elf_machine_type_class(type);
+    case EM_MICROBLAZE:
+     return microblaze_elf_machine_type_class(type);
 
     default:
       printf ("Unknown architecture!\n");
@@ -284,6 +295,7 @@ machine_no_rela (int machine)
     case EM_SPARC32PLUS:
     case EM_SPARCV9:
     case EM_ALTERA_NIOS2:
+    case EM_MICROBLAZE:
       return 0;
     default:
       return 1;
author
#4 lore raw

Ok, I've verify this is working properly (not on MicroBlaze, but on other architectures).

One observation, recent gcc appears to have changed something in CXX (at least on x86-64), and I'm now getting:

../src/prelink: /home/root/prelink-cross/testsuite/cxx1: COPY relocations don't point into .bss or .sbss section

when running the testsuite....

Anyway, what is there is now usable. I've got a small number of x32 patches that need to be merged.. (that will come next.)

--Mark

Quoted 97 lines · Mark Hatle
Quoted 4 lines · Nathan Rossi
Quoted 3 lines · Mark Hatle

I've merged this to the cross_prelink_staging (and master_staging, even though it's a no-op there). The change seems fairly obvious to me.

Quoted 8 lines
Quoted 2 lines

Can you verify it is working properly as merged into cross_prelink_staging, then I'll move it to the full cross_prelink and master.

Tested the cross_prelink_staging branch and verified that it behaves as expected.

Sorry I forgot to add the ChangeLog entry. However when you added it you used 2016 for the year.

whoops. I'll correct that.

Quoted 2 lines

On a side note, once merged into the cross_prelink branch do you see any issues with updating the SRCREV in oe-core?

I've got a few other patches that I'd forgotten about. Once I merge those (and do some basic validation on them).. I'll send up a request for oe-core. If you don't see it in the next few days, feel free to send up an update yourself.

--Mark

Quoted 71 lines

Thanks,
Nathan

Quoted 68 lines

--Mark

Quoted 63 lines · Nathan Rossi

Add definitions/config to support MicroBlaze, using glibc-2.24 as reference.

---
 src/rtld/dl-tls.c |  5 +++++
 src/rtld/rtld.c   | 12 ++++++++++++
 2 files changed, 17 insertions(+)
src/rtld/dl-tls.c +5 -0
index 8b972ff126..2da6bc5c66 100644
@@ -133,6 +133,11 @@ rtld_determine_tlsoffsets (int e_machine, struct r_scope_elem *search_list)
       tls_tcb_size = 0;
       break;
 
+    case EM_MICROBLAZE:
+      tls_dtv_at_tp = 1;
+      tls_tcb_size = 8;
+      break;
+
     default:
       /* Hope there's no TLS!  */
       for (i = 0; i < search_list->r_nlist; i++)
src/rtld/rtld.c +12 -0
index 8d7d760a57..3196981247 100644
@@ -215,6 +215,15 @@ parse_opt (int key, char *arg, struct argp_state *state)
    | (((type) == R_NIOS2_COPY) * ELF_RTYPE_CLASS_COPY)          \
    | (((type) == R_NIOS2_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(EM_ALTERA_NIOS2)))
 
+/* From glibc-2.24: sysdeps/microblaze/dl-machine.h */
+# define microblaze_elf_machine_type_class(type) \
+  (((type) == R_MICROBLAZE_JUMP_SLOT || \
+    (type) == R_MICROBLAZE_TLSDTPREL32 || \
+    (type) == R_MICROBLAZE_TLSDTPMOD32 || \
+    (type) == R_MICROBLAZE_TLSTPREL32) \
+    * ELF_RTYPE_CLASS_PLT \
+   | ((type) == R_MICROBLAZE_COPY) * ELF_RTYPE_CLASS_COPY)
+
 int
 elf_machine_type_class (int type, int machine)
 {
@@ -243,6 +252,8 @@ elf_machine_type_class (int type, int machine)
      return sparc64_elf_machine_type_class(type);
     case EM_ALTERA_NIOS2:
      return nios2_elf_machine_type_class(type);
+    case EM_MICROBLAZE:
+     return microblaze_elf_machine_type_class(type);
 
     default:
       printf ("Unknown architecture!\n");
@@ -284,6 +295,7 @@ machine_no_rela (int machine)
     case EM_SPARC32PLUS:
     case EM_SPARCV9:
     case EM_ALTERA_NIOS2:
+    case EM_MICROBLAZE:
       return 0;
     default:
       return 1;