diff options
author | Clément Chigot <clement.chigot@atos.net> | 2021-10-14 09:03:13 +0200 |
---|---|---|
committer | Clément Chigot <clement.chigot@atos.net> | 2021-10-19 14:42:45 +0200 |
commit | e3ef92e79f9f1c4275a9e19652439089a310627d (patch) | |
tree | 3fa516ed866cb9b61b3f30d61085ed5a52beac6e /gcc | |
parent | 6b34f5c5ec75823d656b6882f12d46248402a2aa (diff) | |
download | gcc-e3ef92e79f9f1c4275a9e19652439089a310627d.zip gcc-e3ef92e79f9f1c4275a9e19652439089a310627d.tar.gz gcc-e3ef92e79f9f1c4275a9e19652439089a310627d.tar.bz2 |
aix: ensure reference to __tls_get_addr is in text section.
The garbage collector of AIX linker might remove the reference to
__tls_get_addr if it's added inside an unused csect, which can be
the case of .data with very simple programs.
gcc/ChangeLog:
2021-10-19 Clément Chigot <clement.chigot@atos.net>
* config/rs6000/rs6000.c (rs6000_xcoff_file_end): Move
__tls_get_addr reference to .text csect.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 68111c3..bac959f 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -21626,17 +21626,17 @@ static void rs6000_xcoff_file_end (void) { switch_to_section (text_section); + if (xcoff_tls_exec_model_detected) + { + /* Add a .ref to __tls_get_addr to force libpthread dependency. */ + fputs ("\t.extern __tls_get_addr\n\t.ref __tls_get_addr\n", asm_out_file); + } fputs ("_section_.text:\n", asm_out_file); switch_to_section (data_section); fputs (TARGET_32BIT ? "\t.long _section_.text\n" : "\t.llong _section_.text\n", asm_out_file); - if (xcoff_tls_exec_model_detected) - { - /* Add a .ref to __tls_get_addr to force libpthread dependency. */ - fputs ("\t.extern __tls_get_addr\n\t.ref __tls_get_addr\n", asm_out_file); - } } struct declare_alias_data |