From: Jose E. Marchesi Date: Wed, 2 Sep 2020 07:12:21 +0000 (+0200) Subject: bpf: use elfos.h X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c9d440223594cbf955177628d62a667727a1780a;p=gcc.git bpf: use elfos.h BPF is an ELF-based target, so it definitely benefits from using elfos.h. This patch makes the target to use it, and removes superfluous definitions from bpf.h which are better defined in elfos.h. Note that BPF, despite being an ELF target, doesn't use DWARF. At some point it will generate DWARF when generating xBPF (-mxbpf) and BTF when generating plain eBPF, but for the time being it just generates stabs. 2020-09-02 Jose E. Marchesi gcc/ * config.gcc: Use elfos.h in bpf-*-* targets. * config/bpf/bpf.h (MAX_OFILE_ALIGNMENT): Remove definition. (COMMON_ASM_OP): Likewise. (INIT_SECTION_ASM_OP): Likewise. (FINI_SECTION_ASM_OP): Likewise. (ASM_OUTPUT_SKIP): Likewise. (ASM_OUTPUT_ALIGNED_COMMON): Likewise. (ASM_OUTPUT_ALIGNED_LOCAL): Likewise. --- diff --git a/gcc/config.gcc b/gcc/config.gcc index 23703681deb..797f0ad5edd 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1491,6 +1491,7 @@ bfin*-*) use_gcc_stdint=wrap ;; bpf-*-*) + tm_file="elfos.h ${tm_file}" tmake_file="${tmake_file} bpf/t-bpf" use_collect2=no extra_headers="bpf-helpers.h" diff --git a/gcc/config/bpf/bpf.h b/gcc/config/bpf/bpf.h index 08ecd1164cd..940029ba606 100644 --- a/gcc/config/bpf/bpf.h +++ b/gcc/config/bpf/bpf.h @@ -50,11 +50,6 @@ M = DImode; \ } while (0) -/* Biggest alignment supported by the object file format of this - machine. In this case this is ELF. Use the same definition than - in elfos.h */ -#define MAX_OFILE_ALIGNMENT (((unsigned int) 1 << 28) * 8) - /* Align argument parameters on the stack to 64-bit, at a minimum. */ #define PARM_BOUNDARY 64 @@ -241,6 +236,15 @@ enum reg_class /**** Debugging Info ****/ /* We cannot support DWARF2 because of the limitations of eBPF. */ + +/* elfos.h insists in using DWARF. Undo that here. */ +#ifdef DWARF2_DEBUGGING_INFO +# undef DWARF2_DEBUGGING_INFO +#endif +#ifdef PREFERRED_DEBUGGING_TYPE +# undef PREFERRED_DEBUGGING_TYPE +#endif + #define DBX_DEBUGGING_INFO /**** Stack Layout and Calling Conventions. */ @@ -387,7 +391,6 @@ enum reg_class #define TEXT_SECTION_ASM_OP "\t.text" #define DATA_SECTION_ASM_OP "\t.data" #define BSS_SECTION_ASM_OP "\t.bss" -#define COMMON_ASM_OP "\t.common\t" /**** Defining the Output Assembler Language. */ @@ -413,18 +416,6 @@ enum reg_class /*** Output of Uninitialized Variables. */ -/* How to output an assembler line to define a local common - symbol. */ - -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ - do \ - { \ - fprintf ((FILE), "%s", COMMON_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u,%u\n", (int)(SIZE), (ALIGN) / (BITS_PER_UNIT)); \ - } \ - while (0) - /* A C statement (sans semicolon) to output to the stdio stream FILE the assembler definition of uninitialized global DECL named NAME whose size is SIZE bytes and alignment is ALIGN bytes. @@ -435,15 +426,6 @@ enum reg_class ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \ } while (0) -/* This says how to output an assembler line to define a local common - symbol. */ - -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE,NAME,SIZE,ALIGN) \ - ( fputs ("\t.lcomm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED "\n", \ - (SIZE), ((ALIGN) / BITS_PER_UNIT))) - /*** Output and Generation of Labels. */ /* Globalizing directive for a label. */ @@ -458,11 +440,6 @@ enum reg_class #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ sprintf ((LABEL), "*%s%s%ld", (LOCAL_LABEL_PREFIX), (PREFIX), (long)(NUM)) -/*** Macros Controlling Initialization Routines. */ - -#define INIT_SECTION_ASM_OP "\t.init" -#define FINI_SECTION_ASM_OP "\t.fini" - /*** Output of Assembler Instructions. */ #define REGISTER_NAMES \ @@ -488,11 +465,6 @@ enum reg_class #define ASM_OUTPUT_ALIGN(STREAM,LOG) \ fprintf (STREAM, "\t.align\t%d\n", (LOG)) -/* This is how to output an assembler line - that says to advance the location counter by SIZE bytes. */ -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t.skip\t" HOST_WIDE_INT_PRINT_UNSIGNED "\n", (SIZE)) - /**** Miscellaneous Parameters. */ /* Specify the machine mode that this machine uses for the index in