diff options
author | Stefan Liebler <stli@linux.ibm.com> | 2023-11-21 13:33:03 +0100 |
---|---|---|
committer | Stefan Liebler <stli@linux.ibm.com> | 2023-11-30 13:31:23 +0100 |
commit | 807849965bbdeaa9b0a8f675d098efc520eeaaa8 (patch) | |
tree | 3438d290535be05ecdee893072c1fe790a9105f2 /sysdeps/s390/s390-64/crtn.S | |
parent | 7b12776584c51dbecb1033e107f6b9f45de47a1b (diff) | |
download | glibc-807849965bbdeaa9b0a8f675d098efc520eeaaa8.tar.gz glibc-807849965bbdeaa9b0a8f675d098efc520eeaaa8.tar.xz glibc-807849965bbdeaa9b0a8f675d098efc520eeaaa8.zip |
Avoid padding in _init and _fini. [BZ #31042]
The linker just concatenates the .init and .fini sections which results in the complete _init and _fini functions. If needed the linker adds padding bytes due to an alignment. GNU ld is adding NOPs, which is fine. But e.g. mold is adding traps which results in broken _init and _fini functions. Thus this patch removes the alignment in .init and .fini sections in crtn.S files. We keep the 4 byte function alignment in crti.S files. As the assembler now also outputs the start of _init and _fini functions as multiples of 4 byte, it perhaps has to fill it. Although GNU as is using NOPs here, to be sure, we just keep the alignment with 0x07 (=NOPs) at the end of crti.S. In order to avoid an obvious NOP slide in _fini, this patch also uses an lg instead of lgr instruction. Then the emitted instructions needs a multiple of 4 bytes.
Diffstat (limited to 'sysdeps/s390/s390-64/crtn.S')
-rw-r--r-- | sysdeps/s390/s390-64/crtn.S | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/sysdeps/s390/s390-64/crtn.S b/sysdeps/s390/s390-64/crtn.S index 0eabcb346c..6bb1bc9dcf 100644 --- a/sysdeps/s390/s390-64/crtn.S +++ b/sysdeps/s390/s390-64/crtn.S @@ -37,13 +37,11 @@ corresponding to the prologues in crti.S. */ .section .init - .align 4 lg %r4,272(%r15) lmg %r6,%r15,208(%r15) br %r4 .section .fini - .align 4 lg %r4,272(%r15) lmg %r6,%r15,208(%r15) br %r4 |