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

TWiL 23 and more #94

Merged
merged 12 commits into from
Nov 6, 2023
Merged

TWiL 23 and more #94

merged 12 commits into from
Nov 6, 2023

Conversation

xen0n
Copy link
Member

@xen0n xen0n commented Nov 5, 2023

No description provided.

@xen0n xen0n merged commit 6c3d18d into loongson-community:main Nov 6, 2023
1 check passed
@xen0n xen0n deleted the twil branch November 6, 2023 10:38
两三周前,笔者的 GCC 14 就无法自举了,踩上了 binutils linker relaxation 的坑;
不过在笔者找到时间写 bug 报告并上报之前,
五天前,专攻 GNU 工具链的 xry111 也被坑到了,并且在上游[建立了](https://gcc.gnu.org/PR112330)这个 bug。
目前的发现是只要搭配最新 binutils 就会自举失败,体现为汇编器或者链接器崩溃(视你拣取的后续修复提交多少而不定);
Copy link
Member

@xry111 xry111 Nov 6, 2023

Choose a reason for hiding this comment

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

最新 (主分支) Binutils 没事,用 2.41 有事,用 2.40 以下没事。

原因是开了 relax 的 as 在看到 .align x 的时候会直接插入 (1 << x) - 1 个 nop,但是 GCC 会真的去算这里要插多少 nop 然后判定条件跳转能否直接用一条 bne/beq 指令 (不能就展开成跳一条指令的 beq/bne 和一条 bb 再不行就得命令行改 code model 了)。通常来说 GCC 算的 nop 数会小于等于 (1 << x) - 1,所以在碰巧的情况下会出现试图用 beq/bne 跳到插入 nop 后过不去的地方。

最新的 as (Binutils 2.41.50.202311xx) 在这种情况下会替编译器把这个 bne/beq 展开成 beq/bne + b,就避免了这个问题。

目前我提交的解决方案就是在 as 不支持这种展开的时候直接把 relax 默认关掉,反正 2.41 的 relax 实现问题多了去了 (当时 GCC 13 还默认 -mexplicit-relocs 所以测不出来这些问题),直接关了一了百了。

Copy link
Member Author

Choose a reason for hiding this comment

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

奇怪,上次我把能拣的修复提交都拣进 binutils 2.41,编译,然后 gcc 在 stage2 链接时候报了匪夷所思的链接错误:Success。。。

看起来我得更深度艹艹 nanmen2 的工具链了(

Copy link
Member

Choose a reason for hiding this comment

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

我觉得咱们可能是时候做个 Binutils+GCC+Glibc 的 git 主分支的连续集成测试了……

Copy link
Contributor

Choose a reason for hiding this comment

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

我觉得咱们可能是时候做个 Binutils+GCC+Glibc 的 git 主分支的连续集成测试了……

等有构建机接入 freedesktop-sdk 后,可以通过 freedesktop-sdk 来做 CI

我们在周报第 14 期[整理过了](./2023-09-04-this-week-in-loongarch-14.md#linux-6.6-loongarch-changes)
Linux 6.6 的龙架构相关变更,可方便跳转阅读。

除此之外值得一提的是:从该版本开始,Linux 的默认调度算法从 CFS(completely fair scheduler;完全公平调度器)
Copy link
Member

Choose a reason for hiding this comment

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

我看了一下,CFS 是直接被鲨掉了,所以可以删去“默认”两字:

    EEVDF is a better defined scheduling policy, as a result it has less
    heuristics/tunables. There is no compelling reason to keep CFS around.


笔者印象中 2022 年以来,至少有 3 位开发者没看懂这句话:如果「触发(的)指令」「不存在」例外,那哪些指令存在呢?

对比《手册》英文版对这句话的翻译(有删改;[原文](https://github.com/loongson/LoongArch-Documentation/blob/f05f84435aca5e4d166ed0f147d8e9e9cb30911c/docs/LoongArch-Vol1-EN/basic-integer-instructions/overview-of-basic-integer-instructions/atomic-memory-access-instructions.adoc#L74)有语法错误):
Copy link
Member

Choose a reason for hiding this comment

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

翻译一开始也是错的:loongson/LoongArch-Documentation#15

我当时应该是在试图移植 LLVM 罢,读了中文和英文都百思不得其解,最后自己跑了一下出来 SIGILL 才恍然大悟 :)

Copy link
Member Author

Choose a reason for hiding this comment

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

我去,原来如此,待会儿加上这个。。。。。

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.

3 participants