diff options
author | Xi Ruoyao <xry111@xry111.site> | 2022-07-29 21:45:40 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2022-08-25 19:00:41 +0800 |
commit | 362749184c4fa67ea0b2135d4cae8f1a13208b9d (patch) | |
tree | 1bd015b41d3e2da7a4edf6a6e3c7303eecd2e145 /libiberty | |
parent | a45b7b19e1364dd7b0066df49d458b05ba3c72d1 (diff) | |
download | gcc-362749184c4fa67ea0b2135d4cae8f1a13208b9d.zip gcc-362749184c4fa67ea0b2135d4cae8f1a13208b9d.tar.gz gcc-362749184c4fa67ea0b2135d4cae8f1a13208b9d.tar.bz2 |
LoongArch: add model attribute
A linker script and/or a section attribute may locate some object
specially, so we need to handle the code model for such objects
differently than the -mcmodel setting. This happens when the Linux
kernel loads a module with per-CPU variables.
Add an attribute to override the code model for a specific variable.
gcc/ChangeLog:
* config/loongarch/loongarch-protos.h (loongarch_symbol_type):
Add SYMBOL_PCREL64 and change the description for SYMBOL_PCREL.
* config/loongarch/loongarch.cc (loongarch_attribute_table):
New attribute table.
(TARGET_ATTRIBUTE_TABLE): Define the target hook.
(loongarch_handle_model_attribute): New static function.
(loongarch_classify_symbol): Take TARGET_CMODEL_EXTREME and the
model attribute of SYMBOL_REF_DECL into account returning
SYMBOL_PCREL or SYMBOL_PCREL64.
(loongarch_use_anchors_for_symbol_p): New static function.
(TARGET_USE_ANCHORS_FOR_SYMBOL_P): Define the target hook.
(loongarch_symbol_extreme_p): New static function.
(loongarch_symbolic_constant_p): Handle SYMBOL_PCREL64.
(loongarch_symbol_insns): Likewise.
(loongarch_split_symbol_type): Likewise.
(loongarch_split_symbol): Check SYMBOL_PCREL64 instead of
TARGET_CMODEL_EXTREME for PC-relative addressing.
(loongarch_print_operand_reloc): Likewise.
* doc/extend.texi (Variable Attributes): Document new
LoongArch specific attribute.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/attr-model-test.c: New test.
* gcc.target/loongarch/attr-model-1.c: New test.
* gcc.target/loongarch/attr-model-2.c: New test.
* gcc.target/loongarch/attr-model-diag.c: New test.
Diffstat (limited to 'libiberty')
0 files changed, 0 insertions, 0 deletions