From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id E77283858D20; Thu, 25 Apr 2024 19:13:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E77283858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714072420; bh=qkoNyCEfX64pg9gdo7gtnY4kN+cfEu75pT9D2LUG1WU=; h=From:To:Subject:Date:From; b=op8KXztoDmM5zFbnHC8kwKp9SsqLtFTZCkIBnox0jfKYwe4hUOTL6kZW7/B+qetVB 71esX42+FvE2MNP1y3+ZAmvclWVyR3r2Z5l5GFCB9fvKLGFwiV05e5talAbdzClcC3 pF+1fC0OirFgpDZ1wdKxF3WvlvBItDgw9cx3wn4s= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-11365] Darwin: Match system sections and relocs for exception tables. X-Act-Checkin: gcc X-Git-Author: Iain Sandoe X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: dabd742cc25f8992c24e639510df0965dbf14f21 X-Git-Newrev: 9488ad0d780fae91afa910410cb4e6da8d607fd9 Message-Id: <20240425191340.E77283858D20@sourceware.org> Date: Thu, 25 Apr 2024 19:13:40 +0000 (GMT) List-Id: https://gcc.gnu.org/g:9488ad0d780fae91afa910410cb4e6da8d607fd9 commit r11-11365-g9488ad0d780fae91afa910410cb4e6da8d607fd9 Author: Iain Sandoe Date: Thu Aug 31 19:20:43 2023 +0100 Darwin: Match system sections and relocs for exception tables. System tools from Darwin10 onwards have moved the exceptions tables from the __DATA segment to the __TEXT one. They also revised the relocations used for typeinfo. While Darwin9 was not changed at the time, in fact the tools there are equally happy with the revised scheme - and therefore at present there seems no reason to special-case it. Signed-off-by: Iain Sandoe gcc/ChangeLog: * config/darwin-sections.def (darwin_exception_section): Move to the __TEXT segment. * config/darwin.c (darwin_emit_except_table_label): Align before the exception table label. * config/darwin.h (ASM_PREFERRED_EH_DATA_FORMAT): Use indirect PC- relative 4byte relocs. (cherry picked from commit 0fe7962afc7c01488432b98b6f442b24946a490d) Diff: --- gcc/config/darwin-sections.def | 2 +- gcc/config/darwin.c | 1 + gcc/config/darwin.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/darwin-sections.def b/gcc/config/darwin-sections.def index 8be89624c9c..ed9e058d1d1 100644 --- a/gcc/config/darwin-sections.def +++ b/gcc/config/darwin-sections.def @@ -157,7 +157,7 @@ DEF_SECTION (machopic_picsymbol_stub3_section, SECTION_NO_ANCHOR, /* Exception-related. */ DEF_SECTION (darwin_exception_section, SECTION_NO_ANCHOR, - ".section __DATA,__gcc_except_tab", 0) + ".section __TEXT,__gcc_except_tab", 0) DEF_SECTION (darwin_eh_frame_section, SECTION_NO_ANCHOR, ".section " EH_FRAME_SECTION_NAME ",__eh_frame" EH_FRAME_SECTION_ATTR, 0) diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 2371816e251..ddbd3943a1d 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -2230,6 +2230,7 @@ darwin_emit_except_table_label (FILE *file) { char section_start_label[30]; + fputs ("\t.p2align\t2\n", file); ASM_GENERATE_INTERNAL_LABEL (section_start_label, "GCC_except_table", except_table_label_num++); ASM_OUTPUT_LABEL (file, section_start_label); diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 5be13293319..9cae0165ae9 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -1098,7 +1098,7 @@ enum machopic_addr_class { #undef ASM_PREFERRED_EH_DATA_FORMAT #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ - (((CODE) == 2 && (GLOBAL) == 1) \ + (((CODE) == 2 && (GLOBAL) == 1) || ((CODE) == 0 && (GLOBAL) == 1) \ ? (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4) : \ ((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)