(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
darwin-weakimport-3.c
       1  /* { dg-do compile { target *-*-darwin* } } */
       2  
       3  /* Here we want to test if "foo" gets placed into a coalesced
       4     section (it should not).
       5  
       6     However, for i386, and PIC code we have a "get_pc thunk" that
       7     is (correctly) placed in a coalesced section when using an older
       8     linker - also unwind tables are emitted into coalesced.
       9  
      10     With modern linkers this is moot, since even weak symbols
      11     are emitted into the regular sections.
      12  
      13     To avoid the unwind tables -fno-asynchronous-unwind-tables.
      14     To ensure that we emit code for an older linker -mtarget-linker
      15     To avoid the get_pc thunk optimise at least O1.  */
      16  
      17  /* { dg-options "-fno-asynchronous-unwind-tables -O1 -mtarget-linker 85.2" } */
      18  /* { dg-require-weak "" } */
      19  
      20  /* { dg-final { scan-assembler-not "coalesced" } } */
      21  
      22  extern void foo(void) __attribute__((weak_import));
      23  
      24  void foo(void)
      25  {
      26  }