From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id DC488384B12C for ; Fri, 28 Oct 2022 16:39:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DC488384B12C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x12e.google.com with SMTP id f37so9148523lfv.8 for ; Fri, 28 Oct 2022 09:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=D+5UWEEUHDFQDWG14IV92dXybd6L0yrkkzyjf2ly6ew=; b=goDkzj+LuG6mDdmgOnEatkqVBSbE6NBlQeh2pfliTmJOsG4y1lz1txpeaKAdLtuIMI V734gNhgx3PsZNT+FcjNdabyL1bTI4t1yD03CiNr91XOlTMnpI/uOACFhnLU6CJVT4UO kUJCWTiX4DEajoRukXaGWl2aq52uUtA+oJ8cCSqOIFCNewodQE9Txv8VsWGtjJ1PGN26 4OLqbTKLhKlaTXjsW89ukjpTevo9u0wItGYU5KcBj+U61L+9TpIbd+wj4mzhYDphixid 8qtMcHFrFx3olJPnVC/gBztZMDGvFyyASF6JqrKMSz79ubRV5Grrb3ff9CJyVUZzXdfo IT4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=D+5UWEEUHDFQDWG14IV92dXybd6L0yrkkzyjf2ly6ew=; b=Npuzs5kK9T7omIPddUafaokbho7nzhMA5SosqC4N2xCGFfMcCt0P4CkUSyLxy6UGXT 7wwOGM66u/yvFH/BYSIi7znnIy76jgkn+JLqsFcxJEL87F5RBBA5+V2mVDWNjzP9ud36 4bZ9RLZfwcJ8EAgCnABtmhwL+k7LvQffuixVmzFwwd9WZevjW0qgdEoh/NGlT9h/EUNb Pac8LByb9JFRh4AvZDBs9dWo/ILlg3kIc2fn4gIjY4aIxk3GdPf34MepTDF0tifNX6ce OPUv5QmTb/pjRlni9QtHq/X0F1Es0V4eVKHeisXB8Hh11tRtHK9NUsOqvhsx2EfKUuyz 4tmQ== X-Gm-Message-State: ACrzQf0cwTNuQUylQYp8AhSGG/8p1R42CEin0sB1TSlJevIeEi3aR1wz 1r4mOhlD3h6k1SHEXwaJmHMF76htihI1IHyLeR2V1q3VgMo= X-Google-Smtp-Source: AMsMyM5dKuEBSnUF5ENNCUVreSp8RV+lg5tKzDU+ZJSBPdpeYpRnJN3Ui6ghdDJOU8ArjiQ425PBpNr/g5U5CynMsz4= X-Received: by 2002:a05:6512:138d:b0:4ae:5116:8ddb with SMTP id p13-20020a056512138d00b004ae51168ddbmr85491lfa.558.1666975142999; Fri, 28 Oct 2022 09:39:02 -0700 (PDT) MIME-Version: 1.0 From: Erich Date: Fri, 28 Oct 2022 11:38:56 -0500 Message-ID: Subject: GCOV in standalone env, nostdlib To: gcc-help@gcc.gnu.org Content-Type: multipart/alternative; boundary="0000000000003f7b9805ec1ae5ff" X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000003f7b9805ec1ae5ff Content-Type: text/plain; charset="UTF-8" Hi All, I am trying to understand the limitations (if any libgcc) has concerning embedded targets. In particular I am attempting to follow the instructions here: Freestanding Environments (Using the GNU Compiler Collection (GCC)) to obtain code coverage; I can compile, however I am seeing some linker errors like the following: ```bash /usr/bin/ld: /tmp/ccX2ca3G.ltrans0.ltrans.o:/edk2/OvmfPkg/EmuVariableFvbRuntimeDxe/FvbCov.c:83: undefined reference to `my_info' /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/libgcov.a(_gcov_info_to_gcda.o): in function `__gcov_info_to_gcda': (.text+0x31d): undefined reference to `mmap' /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/libgcov.a(_gcov_info_to_gcda.o): in function `__gcov_info_to_gcda.cold': (.text.unlikely+0x1): undefined reference to `abort' /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status ``` My environment lacks any standard lib and I have the following compiler/linker options: compiler ```bash INFO - "gcc" -MMD -MF /edk2/Build/Ovmf3264/DEBUG_GCC5/X64/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb/OUTPUT/FvbCov.obj.deps -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=EmuVariableFvbRuntimeDxeStrings -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -flto -DUSING_LTO -Os -coverage -mno-mmx -mno-sse -D DISABLE_NEW_DEPRECATED_INTERFACES -D ENABLE_MD5_DEPRECATED_INTERFACES -c -o /edk2/Build/Ovmf3264/DEBUG_GCC5/X64/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb/OUTPUT/./FvbCov.obj -I/edk2/OvmfPkg/EmuVariableFvbRuntimeDxe -I/edk2/Build/Ovmf3264/DEBUG_GCC5/X64/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb/DEBUG -I/edk2/MdePkg -I/edk2/MdePkg/Include -I/edk2/MdePkg/Test/UnitTest/Include -I/edk2/MdePkg/Include/X64 -I/edk2/MdeModulePkg -I/edk2/MdeModulePkg/Include -I/edk2/OvmfPkg -I/edk2/OvmfPkg/Include -I/edk2/OvmfPkg/Csm/Include /edk2/OvmfPkg/EmuVariableFvbRuntimeDxe/FvbCov.c ``` linker ```bash "gcc" -o /edk2/Build/Ovmf3264/DEBUG_GCC5/X64/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb/DEBUG/EmuVariableFvbRuntimeDxe.dll -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40 -Wl,--entry,_ModuleEntryPoint -u _ModuleEntryPoint -Wl,-Map,/edk2/Build/Ovmf3264/DEBUG_GCC5/X64/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb/DEBUG/EmuVariableFvbRuntimeDxe.map,--whole-archive -Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie -flto -Os -fprofile-arcs -ftest-coverage -fprofile-info-section -z common-page-size=0x1000 -Wl,--start-group,@/edk2/Build/Ovmf3264/DEBUG_GCC5/X64/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb/OUTPUT/static_library_files.lst,--end-group -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=EmuVariableFvbRuntimeDxeStrings -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -flto -DUSING_LTO -Os -coverage -mno-mmx -mno-sse -D DISABLE_NEW_DEPRECATED_INTERFACES -D ENABLE_MD5_DEPRECATED_INTERFACES -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 -Wl,--script=/edk2/BaseTools/Scripts/GccBase.lds -Wno-error ``` Let me know if there are additional info, in the meantime I will create a more minimal build environment to try and narrow down the possibilities. Thank you :) --0000000000003f7b9805ec1ae5ff--