loongson-community / discussions

Cross-community issue tracker & discussions / 跨社区工单追踪 & 讨论场所
7 stars 0 forks source link

[ABI] Default to the medium code model across the board #43

Open xen0n opened 5 months ago

xen0n commented 5 months ago

Large apps, such as Chromium, and potentially in-house services that are written in C++ and/or Rust and featuring huge polymorphic business logic, are going to have text sections larger than 256MiB, that the current default code model of normal cannot handle.

We could ask such devs to manually add -mcmodel=medium or even extreme to their projects, but the problem is: users rarely are aware of their own software's growth, and arguably they shouldn't care, and (IMO) it's definitely not the users' fault if their project suddenly fails to link just because one more feature is added that pushed the text section size over the tipping point.

Instead, I'd like to propose that we allow and implement the relaxation of call36 to bl, then effectively merge the normal and medium code models:

This way, small programs' performance should stay the same thanks to relaxation, and larger programs should get transparently supported. And all of this without any user intervention. The 256GiB text section and 4GiB data access range allowed by the medium code model should be enough for the foreseeable future; the extreme code model should be required only for advanced use cases and/or supercomputing.

xry111 commented 5 months ago

The 256GiB text section and 4GiB data access range allowed by the medium code model should be enough for the foreseeable future

Still 4GiB text section because when you take a function pointer it's still pcalau12i + addi.d. My mistake writing the NEWS for Binutils.

xen0n commented 5 months ago

The 256GiB text section and 4GiB data access range allowed by the medium code model should be enough for the foreseeable future

Still 4GiB text section because when you take a function pointer it's still pcalau12i + addi.d. My mistake writing the NEWS for Binutils.

Oh heck, asymmetry. (And it's not your fault because that sentence is most likely written by me and you merely took my suggestion...)

xen0n commented 5 months ago

Alternatively we could also implement range extension thunks for LoongArch, that should hopefully allow linking of existing object code. This is orthogonal to the medium code model support though.