]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Change code from non-PIC to PIC for ppc64 59558/head
authorSurya Kumari Jangala <surya.kumari.jangala@ibm.com>
Tue, 10 Sep 2024 08:31:50 +0000 (14:01 +0530)
committerSurya Kumari Jangala <surya.kumari.jangala@ibm.com>
Tue, 10 Sep 2024 08:31:50 +0000 (14:01 +0530)
Signed-off-by: SURYA KUMARI JANGALA <surya.kumari.jangala@ibm.com>
src/common/CMakeLists.txt
src/common/crc32c_ppc_fast_zero_asm.S

index c3fd51d26468fdaf348925364e186eb61185afbf..8b9f3339e3885c7018184f2fa4372935518fa06d 100644 (file)
@@ -225,6 +225,7 @@ elseif(HAVE_POWER8)
     list(APPEND crc32_srcs
       crc32c_ppc_asm.S
       crc32c_ppc_fast_zero_asm.S)
+    set_source_files_properties(crc32c_ppc_asm.S PROPERTIES COMPILE_FLAGS -D__ASSEMBLY__)
   endif(HAVE_PPC64LE)
 elseif(HAVE_ARMV8_CRC)
   list(APPEND crc32_srcs
index cff9cce7fd403f19f66716ca97b8a2161c263676..3defa6deca68c806cc59486d95ca9013dacb76de 100644 (file)
 #endif
 #include "ppc-opcode.h"
 
+/*
+ * The following line is required because toc is defined as 2 in
+ * ppc-asm.h. This definition will break @toc in the assembly code,
+ * hence toc should be undefined.
+ */
+#undef toc
+
+/* If we do not define r2 as 2, the assembler throws errors.
+ * This is because the assembler has no builtin support for
+ * registers, and we should either define them ourselves or
+ * use their indexes explicitly like:
+ *       addis   4,2,.bit_reflected_constants@toc@ha
+ */
+#ifndef r2
+#define r2 2
+#endif
+
        .section        .data
 .balign 16
 .constants:
@@ -45,8 +62,8 @@
 
 /* unsigned int barrett_reduction(unsigned long val) */
 FUNC_START(barrett_reduction)
-       lis     r4,.constants@ha
-       la      r4,.constants@l(r4)
+       addis   r4,r2,.constants@toc@ha
+       addi    r4,r4,.constants@toc@l
 
        li      r5,16
        vxor    v1,v1,v1        /* zero v1 */
@@ -83,8 +100,8 @@ FUNC_END(barrett_reduction)
 
 /* unsigned int barrett_reduction_reflected(unsigned long val) */
 FUNC_START(barrett_reduction_reflected)
-       lis     r4,.bit_reflected_constants@ha
-       la      r4,.bit_reflected_constants@l(r4)
+       addis   r4,r2,.bit_reflected_constants@toc@ha
+       addi    r4,r4,.bit_reflected_constants@toc@l
 
        li      r5,16
        vxor    v1,v1,v1        /* zero v1 */