From 8103659e35edffe864ad49ac4be3a40dae0785a0 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sat, 12 Oct 2019 19:20:43 +0000 Subject: [Darwin] Suppress emitting empty ctor/dtor sections. Older versions of GCC emit empty .constructor/.destructor sections whenever building for C++. In fact, these sections are only used for kernel mode code - so don't emit them unless that's what we're building. gcc/ChangeLog: 2019-10-12 Iain Sandoe * config/darwin.c (darwin_file_end): Only emit empty CTOR/DTOR sections when building kernel extension code. From-SVN: r276923 --- gcc/config/darwin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 539ef75..ddce9f8 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -2931,8 +2931,9 @@ darwin_file_end (void) } machopic_finish (asm_out_file); - if (lang_GNU_CXX ()) + if (flag_apple_kext) { + /* These sections are only used for kernel code. */ switch_to_section (darwin_sections[constructor_section]); switch_to_section (darwin_sections[destructor_section]); ASM_OUTPUT_ALIGN (asm_out_file, 1); -- cgit v1.1