This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Darwin] Patch: enable hidden visibility

This patch enables hidden visibility for Darwin.  Example:
   __attribute__ ((__visibility__("hidden")))
   void foo() { }

Note that only "hidden" visibility is supported, not "internal"
or "protected": those are ELF features that don't have direct
equivalents in MACH-O.

Note also that the feature gives us slightly weird assembly
code: for the example program above, we get:
        .align 2
        .globl _foo
        .private_extern _foo
        stmw r30,-8(r1)
        stwu r1,-48(r1)
        mr r30,r1
        lwz r1,0(r1)
        lmw r30,-8(r1)

That is, we get both ".globl" and ".private_extern".  This is
redundant: .private_extern alone would be enough.  On
the other hand, I have been assured by our linker/
assembler expert that the redundancy is harmless.  And
getting rid of it would require more invasive changes in
varasm.c, probably involving a new target hook.  This way
I'm able to confine the changes to Darwin alone.

Bootstrapped and tested on Mac OS X 10.3, no regressions.

OK to commit to mainline?


Attachment: pepatch.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]