diff options
author | Iain Sandoe <iain@codesourcery.com> | 2016-11-27 14:50:58 +0000 |
---|---|---|
committer | Iain Sandoe <iains@gcc.gnu.org> | 2016-11-27 14:50:58 +0000 |
commit | 03f82a6a634ddfa5828843b647c896968aee3702 (patch) | |
tree | 140872532edd4731db6a4bb484ccd9c91f5cc3e2 /gcc/fortran/module.c | |
parent | 987395fd6592568a578e9906727b3e7b0164bc66 (diff) | |
download | gcc-03f82a6a634ddfa5828843b647c896968aee3702.zip gcc-03f82a6a634ddfa5828843b647c896968aee3702.tar.gz gcc-03f82a6a634ddfa5828843b647c896968aee3702.tar.bz2 |
[Darwin] Fix PR57438 by avoiding empty function bodies and trailing labels.
A.
Empty function bodies causes two problems for Darwin's linker (i) zero-length
FDEs and (ii) coincident label addresses that might point to items of
differing weakness.
B.
Trailing local labels can be problematic when they end a function because
similarly they might apparently point to a following weak function, leading
to the linker concluding that there's a pointer-diff to a weak symbol
(which is not allowed).
Both conditions arise from __builtin_unreachable() lowering to a barrier.
The solution for both is to emit some finite amount of code; in the case of A
a trap is emitted, in the case of B a nop.
gcc/
2016-11-27 Iain Sandoe <iain@codesourcery.com>
PR target/57438
* config/i386/i386.c (ix86_code_end): Note that we emitted code
where the function might otherwise appear empty for picbase thunks.
(ix86_output_function_epilogue): If we find a zero-sized function
assume that reaching it is UB and trap. If we find a trailing label
append a nop.
* config/rs6000/rs6000.c (rs6000_output_function_epilogue): If we
find a zero-sized function assume that reaching it is UB and trap.
If we find a trailing label, append a nop.
gcc/testsuite/
2016-11-27 Iain Sandoe <iain@codesourcery.com>
PR target/57438
* gcc.dg/pr57438-1.c: New Test.
* gcc.dg/pr57438-2.c: New Test.
From-SVN: r242897
Diffstat (limited to 'gcc/fortran/module.c')
0 files changed, 0 insertions, 0 deletions