Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new triplets for loongarch64 #1

Closed
wants to merge 1 commit into from
Closed

Conversation

loongson-zn
Copy link
Collaborator

# install the Makefile of the shared python build
sed -e 's,gcc-8,gcc,;s,g++-8,g++,'  -e '/^OPT/s,-O3,-O2,' -e 's/-O3/-O2/g' -e 's/-fprofile-use *-fprofile-correction//g' -e 's/-fstack-protector /-fstack-protector-strong /g' -e 's/-specs=[^ ]*//g' -e 's/-fdebug-prefix-map=[^ ]*//g' -e 's,^RUNSHARED *=.*,RUNSHARED=,' -e '/BLDLIBRARY/s/-L\. //' \
	/home/loongson/zhangna/python3.9/python3.9-3.9.2/build-shared/Makefile \
	> debian/tmp/usr/lib/python3.9/config-3.9-loongarch64-linux-gnu/Makefile
/bin/bash: debian/tmp/usr/lib/python3.9/config-3.9-loongarch64-linux-gnu/Makefile: No such file or directory
make: *** [debian/rules:865:stamps/stamp-install] 错误 1
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2

最近在debian上编译python3.9 有个报错,发现configure/configure.ac 中没有loongarch64 platform triplet, 因此加了这个patch。请review @loongarch64/dev-team
其次,在我刚才创建PR的时候,是要求在https://bugs.python.org/ 先有一个issue

@loongson-zn
Copy link
Collaborator Author

@loongson-zn loongson-zn changed the title add loongarch64 support in configure.ac and configure Add new triplets for loongarch64 Jan 25, 2022
@huolinjue
Copy link

我觉得configure不应该手动修改,该文件由configure.ac经由autoconf(或autoreconf)生成。

@loongson-zn
Copy link
Collaborator Author

好提议

@zhuyaliang
Copy link

我认为既然上游包含configure 这个文件,那么这个文件也需要修改.再来看看 README.rst

    ./configure
    make
    make test
    sudo make install

也是直接运行configure,所以我同意这个PR

Copy link

@zhuyaliang zhuyaliang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

Copy link

@sulit sulit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看着没什么问题

Copy link

@fangyaling fangyaling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve

@@ -5993,6 +5993,8 @@ cat >> conftest.c <<EOF
hppa-linux-gnu
# elif defined(__ia64__)
ia64-linux-gnu
# elif defined(__loongarch64)
loongarch64-linux-gnu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这处是手工改出来的吗?我印象中 autotools 生成 configure 都会带上大量行号,没道理一个都没变。

请确认一下,确认好之前我先 block merge 了 ;-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff -Naur cpython.orj/configure cpython/configure
 --- cpython.orj/configure   2022-01-25 20:30:55.729798466 +0800
 +++ cpython/configure   2022-01-25 20:32:47.137824831 +0800
 @@ -5993,6 +5993,8 @@
          hppa-linux-gnu
  # elif defined(__ia64__)
          ia64-linux-gnu
 +# elif defined(__loongarch64)
 +        loongarch64-linux-gnu
  # elif defined(__m68k__) && !defined(__mcoldfire__)
          m68k-linux-gnu
  # elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) &&              defined(_MIPSEL)
 diff -Naur cpython.orj/configure.ac cpython/configure.ac
 --- cpython.orj/configure.ac    2022-01-25 20:30:55.733798324 +0800
 +++ cpython/configure.ac    2022-01-25 20:32:40.146074156 +0800
 @@ -884,6 +884,8 @@
          hppa-linux-gnu
  # elif defined(__ia64__)
          ia64-linux-gnu
 +# elif defined(__loongarch64)
 +        loongarch64-linux-gnu
  # elif defined(__m68k__) && !defined(__mcoldfire__)
          m68k-linux-gnu
  # elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) &&              defined(_MIPSEL)

执行autoconf 生成的diff 如上述,autom4te.cache除外

@xen0n
Copy link
Member

xen0n commented Jan 25, 2022

我重新看了下,除了生成代码的疑问之外(我还没有自己验证),这里的 loongarch64-linux-gnu 也是旧世界写法:Python 此处的三元组大体上是跟随 Debian multiarch tuples 的(从 MIPS 的 ABI 写法可以看出),而 Debian multiarch tuples 按照规范 Table 12 的规定,大概是要像下面这样改的:

diff --git a/configure.ac b/configure.ac
index a0fbe41..c4fe61b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -884,6 +884,20 @@ cat >> conftest.c <<EOF
         hppa-linux-gnu
 # elif defined(__ia64__)
         ia64-linux-gnu
+# elif defined(__loongarch__)
+#  if defined(__loongarch64)
+#   if defined(__loongarch_soft_float)
+        loongarch64-linux-gnusf
+#   elif defined(__loongarch_single_float)
+        loongarch64-linux-gnuf32
+#   elif defined(__loongarch_double_float)
+        loongarch64-linux-gnuf64
+#   else
+#    error unknown platform triplet
+#   endif
+#  else
+#   error unknown platform triplet
+#  endif
 # elif defined(__m68k__) && !defined(__mcoldfire__)
         m68k-linux-gnu
 # elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL)

你们看下?

@loongson-zn
Copy link
Collaborator Author

新世界的事情一直没怎么关注,以为只是内核和C库结构体的一些变化,这个事情会尽快去确认、处理,多谢提示。 @xen0n

@loongson-zn
Copy link
Collaborator Author

已经找编译器组的同事确认,以后按照新世界的标准提交,我将重新提交

@loongson-zn
Copy link
Collaborator Author

#2 (comment)
上游更新速度较快,更新git仓库后,创建一个新的分支提交

@xen0n
Copy link
Member

xen0n commented Jan 26, 2022

可,那这个先 close 了哈

@xen0n xen0n closed this Jan 26, 2022
yetist pushed a commit that referenced this pull request Apr 28, 2022
)

Fix test_gdb.test_pycfunction() for Python built with clang -Og.
Tolerate inlined functions in the gdb traceback.

When _testcapimodule.c is built by clang -Og, _null_to_none() is
inlined in meth_varargs() and so gdb returns _null_to_none() as
the frame #1. If it's not inlined, meth_varargs() is the frame #1.
yetist pushed a commit that referenced this pull request Apr 28, 2022
…python#91466)

Fix an uninitialized bool in exception print context.
    
`struct exception_print_context.need_close` was uninitialized.
    
Found by oss-fuzz in a test case running under the undefined behavior sanitizer.
    
https://oss-fuzz.com/testcase-detail/6217746058182656
    
```
Python/pythonrun.c:1241:28: runtime error: load of value 253, which is not a valid value for type 'bool'
    #0 0xbf2203 in print_chained cpython3/Python/pythonrun.c:1241:28
    #1 0xbea4bb in print_exception_cause_and_context cpython3/Python/pythonrun.c:1320:19
    #2 0xbea4bb in print_exception_recursive cpython3/Python/pythonrun.c:1470:13
    python#3 0xbe9e39 in _PyErr_Display cpython3/Python/pythonrun.c:1517:9
```
    
Pretty obvious what the ommission was upon code inspection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants