From 42f8e80eeaca27952af165076c5ce921bb7b3f45 Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 16 May 2025 05:28:15 +0000 Subject: midipix targets: utilize the framework-specific .symattr section to mark hidden symbols. --- gcc/config/i386/midipix.c | 16 ++++++++++++++++ gcc/config/i386/midipix.h | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/gcc/config/i386/midipix.c b/gcc/config/i386/midipix.c index 4d511722f..ca571049c 100644 --- a/gcc/config/i386/midipix.c +++ b/gcc/config/i386/midipix.c @@ -185,6 +185,22 @@ static void midipix_pe_create_got_entry(FILE * stream, const char * name, tree d fputs("\n",stream); fputs(TARGET_64BIT ? "\t.long\t" "0" "\n" : "",stream); fputs("\n\n",stream); + + /* default visilbity? */ + if (visibility == VISIBILITY_DEFAULT) + return; + + /* .symattr section */ + fputs("\n",stream); + fputs(GAS_SECTION,stream); + fputs(SYMATTR_SECTION_NAME,stream); + fputs(SYMATTR_SECTION_ATTR,stream); + + /* .symattr.hidden. */ + fputs("\n.symattr.hidden.",stream); + assemble_name(stream,name); + fputs(":\n",stream); + fputs("\t.linkonce discard\n\n",stream); } diff --git a/gcc/config/i386/midipix.h b/gcc/config/i386/midipix.h index 73d5a3a62..dd23327ab 100644 --- a/gcc/config/i386/midipix.h +++ b/gcc/config/i386/midipix.h @@ -193,6 +193,9 @@ #undef GOTSYMS_SECTION_NAME #define GOTSYMS_SECTION_NAME ".dsosyms" +#undef SYMATTR_SECTION_NAME +#define SYMATTR_SECTION_NAME ".symattr" + #undef GOTSTRS_SECTION_NAME #define GOTSTRS_SECTION_NAME ".gotstrs" @@ -202,6 +205,9 @@ #undef GOT_SECTION_ATTR #define GOT_SECTION_ATTR ",\"r\"" +#undef SYMATTR_SECTION_ATTR +#define SYMATTR_SECTION_ATTR ",\"r\"" + #undef GAS_PE_ASM_SET_OP #define GAS_PE_ASM_SET_OP "\t.set\t" -- cgit v1.2.3