Text file src/debug/elf/testdata/multiple-code-sections.c

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Build with:
     6  // gcc -g multiple-code-sections.c -Wl,--emit-relocs -Wl,--discard-none -Wl,-zmax-page-size=1 -fno-asynchronous-unwind-tables -o go-relocation-test-gcc930-ranges-with-rela-x86-64
     7  // gcc -g multiple-code-sections.c -Wl,-zmax-page-size=1 -fno-asynchronous-unwind-tables -o go-relocation-test-gcc930-ranges-no-rela-x86-64
     8  // Strip with:
     9  // strip --only-keep-debug \
    10  //       --remove-section=.eh_frame \
    11  //       --remove-section=.eh_frame_hdr \
    12  //       --remove-section=.shstrtab \
    13  //       --remove-section=.strtab \
    14  //       --remove-section=.symtab \
    15  //       --remove-section=.note.gnu.build-id \
    16  //       --remove-section=.note.ABI-tag \
    17  //       --remove-section=.dynamic \
    18  //       --remove-section=.gnu.hash \
    19  //       --remove-section=.interp \
    20  //       --remove-section=.rodata
    21  __attribute__((section(".separate_section"))) // To get GCC to emit a DW_AT_ranges attribute for the CU.
    22  int func(void) {
    23      return 0;
    24  }
    25  
    26  int main(int argc, char *argv[]) {
    27      return 0;
    28  }
    29  

View as plain text