Poring to 64 bit

【亲测有效】OpenClaw Gateway 出现 “(no output)“ 卡死问题完整解决指南:从手动重启到 systemd Watchdog 自动恢复 最近在使用 OpenClaw(自托管 AI 助手框架,前身 Clawdbot/Moltbot)时,遇到了一个非常常见的顽疾:TUI(终端界面)或 Telegram 等通道经常显示 "(no output)",消息发出去后机器人完全没反应,看起来像是卡死了。 阅读详情

The following is a choice extract from an article -- "Porting to 64 bit", which is written by Andreas Jaeger(SuSE Linux AG).

I put it here just as a summary. Some section just has a title because the constent is farmiliar to me or too complex.


Abstract:

This paper illustrates some problems on porting an application to 64-bit and also shows how use a 64-bit system as development platform for both 32-bit and 64-bit code. It will give hints especially to application and library developers on writing portable code using the GNU Compiler Collection.

 

1Introduction

The following differences can attribute to port software:

1)     Compiler

2)     ABI

3)     CPU

4)     C Library

5)     Kernel

Application developers will mainly have portability problem due to different CPUs and different ABIs.

 

2 Advantages of 64-bit Programs

1)     Larger address space

2)     Improved performance, due to additional features introduced by 64-bit processors

As a example of point 2, AMD Opteron processor has some architectural improvements, like a memory controller integrated into the processor for faster memory access which eliminates high latency memory structure.

 

3 64-bit and 32-bit Programs on One System

In general, 64-bit CPUs can execute 32-bit code natively without any performance penalty, which can be commonly called “biarch support” or “multi-arch support”.

 

This offers some extra challenges for developers:

1)     The kernel must support 32-bit and 64-bit programs;

2)     The system has to be installed in such a way that 32-bit and 64-bit libraries of the same name can exist on one system;

3)     The tool chain should handle development of both 32-bit and 64-bit programs

3.1 Kernel implications

Requirements:

1)     Starting of programs for every architecture supported by the ABI, bot 32-bit and 64-bit;

2)     System calls should be compatible to the corresponding 32-bit platform.

One problem here is the ioctl() system call.

3.2 Libraries: lib and lib64

Because libraries for 32-bit and 64-bit program have the same name, so we need consider where to install them. A example solution is that put 64-bit libraries into another directory like /usr/lib64. For 32-bit programs, no changes need; for 64-bit, the autoconf scripts should specify the library install path. And the ldconfig should handle all libraries too.

3.3 Development for Different ABIs

Compilers like GCC encapsulate almost all of the differences between ABIs.

Toolchains are also needed for development.

3.4 Development

Compiler option and library path.

 

4 64-bit Porting: Hints and Pitfalls

Using the same C library means: the same usage of functions and a different layout of structures.

Different program language has some specific problems.

The sizes of fundamental types on different platforms may be different.

4.1 “Portable” x86/AMD64 Inline Assembler

4.2 Sizes and Alignment of Fundamental Datatypes and  Structure Layout

According to LP64 model, pointers and “long” have a size of 64bits while “int” uses 32 bits in 64-bit platform.

Besides this, different ABIs specify also different alignments. A double variable is aligned on x86 to 4 bytes but aligned to 8 bytes on AMD 64 despite having the same size of 8 bytes. Structures will therefore have a different layout on different platforms.

It is therefore not to hardcode any size and offsets.

4.2.1 int vs. long

1) pointer’s size

2) untyped integral constants are of type int

3) the type of identifiers of an enumeration is implementation defined but all constants get the same type, GCC by default gives them type int, unless any of the enumeration constants needs a larger type

4.3 Function Prototypes

When missing function prototypes, the return value is int and for arguments, integral promotions are performed and arguments of type float are promoted to double.

This may cause some fatal problems, like malloc and memcpy.

4.4 Variable argument Lists

Calling and called function do their job.

Va_lists and some function-like macro like va_copy to manipulate the variable parameters.

4.5 Function Pointers

4.6 Using Bitwidth-dependent types portably

4.7 Using printf and scanf

4.8 Unsigned and Signed Chars

4.9 Evaluation of Floating-point Arithmetic

4.10 Shared Libraries

-fPIC—compiler options forced by some archits

4.11 How to Check for 64-bit

4.12 Optimized Functions, Macros, and Builtins

4.13 Useful Compiler Flags

 

 

Avalonia 项目结构说明 Avalonia UI 阅读详情

相关推荐

MTK Audio驱动Poring

Audio设计如果使用MTK参考设计,Audio驱动相对简单,只需要基于MTK portingGuide就可以完成Porting。但是如果自己外接Codec,需要改变参考设计就需要对Audio框架有一些基本的了解,也要对MTK的代码架构有些了解。下面记录一下MTK Audio的移植心得。 ALSA架构驱动需要关注的三个部分 Platform drivers,提供了配置/使能 SoC audio interface (或称 CPU DAI) 的能力; Codec drivers,提供了配置/使能 Cod

u013463707的专栏 2811

Porting to 64-bit ARM

arm官方文档,64bit ARM程序的移植和开发指南

PoringWorldBot:仙境传说M Snappening机器人

PoringWorldBot 这是一个快照机器人,每六分钟从poring.world查询前60个受欢迎的快照,并将该项目通知用户所订阅的任何请求。 免责声明:我不是poring.world的开发人员。 您可以在以不和谐的方式与我联系。 邀请链接 您可以使用将我托管的机器人添加到您的服务器。 我的机器人是从我的Raspberry Pi托管在我的公寓中,因此我无法保证它的正常运行时间,因为我的Spectrum互联网喜欢废话。 权限 查看审核日志:这是必需的权限。 该机器人在内部权限级别系统上运行。 该漫游器使用审核日志来查找添加了该漫游器的用户,并使其成为管理员,以便他们可以告诉该漫游器在频道中进行监听。 阅读消息:这是必需的权限。 发送消息:这是必需的权限。 嵌入链接:强烈建议这样做。 没有此许可,您将看不到库存,买家和剩余时间。 提及@所有人,@这里和所有角色:这不是必需的。 但

windows下部署qor

依赖环境1、git 2、mysql获取源码go get -u github.com/qor/qor-example golang的有些源码下载不了,需要手动下载。创建db表mysql -uroot -p mysql> CREATE DATABASE qor_example;运行qorcd $GOPATH/src/github.com/qor/qor-example go run main.g

pplin的专栏 2856

The Codeless Code: Case 18-19 Necessary Features(必要的特性)、By any other name(用其他名字)

case18启示:抓住必要的特征 case19启示:最好的解决方案也许是你现在还不知道的

恋蛩音的博客 811

【PAT B1019/A1069】 The Black Hole of Numbers

For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by taking the second number from the first one. Repeat in this m

zxc0074869的博客 1万+

Cytochalasin D (Zygosporin A) 是一种有效的肌动蛋白聚合抑制剂 | MedChemExpress (MCE)

细胞松弛素D是一种有效的肌动蛋白聚合抑制剂,具有细胞渗透活性,可与G-肌动蛋白结合抑制相互作用。它还抑制cofilin与F-肌动蛋白的结合,降低肌动蛋白聚合和解聚的速率。细胞松弛素D可减少外泌体的释放,减少肿瘤环境中存活蛋白的数量,并诱导Yap磷酸化和细胞质滞留。

mmmm12134的博客 993

POJ 1159 Palindrome

L(longest)C(common)S(sequence)经典问题,要用滚动数组,不然会爆内存。 #include #include #include #include using namespace std; int dp[2][5005]; int main() { string s1, s2; int n; while (cin >> n) {

mayer314的专栏 2707

Skia4Dephi 的 Demo 程序界面架构分析

虽然 Skia4Delphi 的 Demo 程序中,运行在 Windows 上的 VCL 程序以及可以运行在手机上的 FMX 程序,都采用了相同的类似手机 APP 的层叠界面的设计模式,但最实用的还是手机 APP,因为屏幕太小,不可能一屏里面还划分几个区域,只能是一层一层的界面叠加。因此,这样的设计模式,在做手机 APP 的时候非常值得学习。实际上它的 FMX 的 Demo 程序的框架,可以直接用于我们自己开发的手机 APP。......

pcplayer的博客 5688

Having retired from the porn

The gambling reportedly were not happy about the Summer of Gronk, Asking their as good tight end Fiesta to to...

cjo9257的博客 13万+

signature=a00773d7f566f5da56760799656d9913,Frontiers | Identification of a Novel Glycolysis-Related ...

IntroductionCancer is a global public health problem and the second most important cause of death in America (1). The global cancer burden is estimated every year by the American Cancer Society. Accor...

weixin_39894233的博客 3201

【❌❌vectorの奇技淫巧⭕⭕】C++ vector 如何正确处理动态申请内存的元素

C++ vector 插入动态内存(new、malloc申请的内存)及销毁动态内存 (delete 、free)demo demo示例: #include <vector> #include <iostream> #include <cstring> using namespace std; int main() { vector<char *> obj; //vector中插入动态内存 for(int i=0;i&lt.

谁吃薄荷糖 11万+

嵌入式学习文章推荐+资料下载

2121

E - Find The Multiple (POJ - 1426)

Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there...

Spidy_harker的博客 1万+

流氓软件综述篇:安全史上“最牛钉子户”

我不是流氓   流氓软件又是一个中国特色的产物,在外国没有对应的名词,不过,在流氓软件的名称正式出现之前,国外早已经出现了各种跟今天流氓软件相似的恶意程序,由于它与如今国内的流氓软件无论在功能上还是复杂程度上,都无法相比拟,因此姑且称它们为类流氓软件。   这些类流氓软件,又被细分为若干个类,它们是广告件(ADWare)、色情件(PornWare)、间谍件(SpyWare)、行为记录件(T

蓄势待发 4405

ARM linunx文档

Porting to ARM 64-bit ARMv8_white_paper ARMv8_Architecture Introducing the 64-bit ARMv8 Architecture(http://andrew.wafaa.eu/files/EuroBSDConARMv8.pdf) Linux on AArch64 ARM 64-bit Architectur

ldinvicible的专栏 1159

活性氧7-Hydroxyflavone,CAS No. 6665-86-7,7-hydroxy-2-Phenylchromone

产品名称:活性氧7-Hydroxyflavone,CAS No. 6665-86-7,7-hydroxy-2-Phenylchromone。活性氧Cytochalasin H,CAS No. 53760-19-3,17-Deoxo-21-acetylzygosporin D。活性氧7-Hydroxyflavone,CAS No. 6665-86-7,7-hydroxy-2-Phenylchromone。说明:提供使用说明,核磁图谱,包装,价格,产地,制备方法,应用,稳定性,溶解度,简单合成等各种信息。

weixin_56446298的博客 137

Redis学习手册19—集群

Redis集群 Redis集群是从Redis 3.0版本开始正式引入的功能,它给用户带来了在线扩展Redis系统读写性能的能力,而Redis 5.0更是在集群原有功能的基础上,进一步添加了更多新功能,并且对原有功能做了相当多的优化,使得整个集群系统更简单、易用和高效。 基本特性 Redis集群提供了非常丰富的特性供用户使用,下面逐个介绍。 复制与高可用 Redis集群与单机版的Redis服务器一样,也提供了主从复制功能。在Redis集群中,各个Redis服务器成为节点(node),其中主节点(master

程序员客栈 1503

Testing Davison's MonoSLAM

Testing Davison's MonoSLAM 半个月前从Davison的主页上下载了monoSLAM的源码,在ubuntu 6.10(gcc 4.1.2)上编译通过,并运行正常,最近又将它移植到windows平台,主要是考虑以后的兼容使用。其中有一些心得和经验,记录于此。 1. support usb camera under linux Davison的代码只支

peterli_xue的专栏 2753

13 Free Windows and Linux VPS Providers 2017

13 Free Windows and Linux VPS Providers 2017 After surfing many days, I finally found some VPS providers that give us vps server with free of charge without having to pay anything. 1. DeskTone – VMw...

lwc_321的博客 11万+

最新完整版标准 ISO IEC 29147:2018 信息技术 - 安全技术 - 漏洞披露 - 完整英文版(41页).pdf

最新完整版标准 ISO IEC 29147:2018 信息技术 - 安全技术 - 漏洞披露 - 完整英文版(41页).pdf

上一篇: 一点C++技巧
下一篇: [_数据挖掘_] python实践之1
firePhoenix1981
博客等级 码龄20年 17粉丝 67原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值