From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nPZID-0003yS-Oj for mharc-grub-devel@gnu.org; Wed, 02 Mar 2022 19:26:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPZIC-0003yK-NN for grub-devel@gnu.org; Wed, 02 Mar 2022 19:26:04 -0500 Received: from [2607:f8b0:4864:20::834] (port=40707 helo=mail-qt1-x834.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPZIA-0005OZ-VB for grub-devel@gnu.org; Wed, 02 Mar 2022 19:26:04 -0500 Received: by mail-qt1-x834.google.com with SMTP id t28so3269403qtc.7 for ; Wed, 02 Mar 2022 16:26:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AqWKVRh3d4A+9RV3ZVsGKQWAkPcApGnm6ceIKKo5His=; b=eAORSWLgwazfYbndzisAtkWdR/P+3gcVR2zafcj6sKmooQxdosxF1JalfKr+MBqSKR AV5eogEJwlJns+E9tEM59dAkE/ezPdfjR2SdnC5hTxwtkrDmFmep2LhwvaPbR6Hym+0w mzuMIMxHoK8wRqMYPQBiCxUDa1mIAKjORf6GoJjPGmtRx+XiThB4zN7c197u4rtsV8XT cmAUjSmTQP8YH1QA5Kxwv1x60JLjaEyW6n8oqxx6DUcY0TtwobRdkXuG+ZcQiuAdA6Os s7cR58OeDftTcPCXOHweNuJqnbUDHNrGoneafPv18u4YpRTg+HY6qO9VQ7MspW/5ZsEs OoHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AqWKVRh3d4A+9RV3ZVsGKQWAkPcApGnm6ceIKKo5His=; b=yiayS0RKkzt0FjrPX0P/xOqNmddmRTfHXTLt6f0/ciG+m2FipO+TRqeWWc93J2BAhB wHJRHuW4Sc3c12XvMur4lQ077vl1sdHnDywkLzcohg0XOhGXCgLz4C0e/mM/EKgKgkx+ vhFJjw2yTdIkIDhiaHk2gNKQHMew/OF5zrHDMP/bzF8rL6zUlrOJB3t7GWSVl+Un2lDq XIbW6PaWNKf4HhK7Rmwa2r3RNJF5f0mXwIL16v8hfd0WI0ezNeBK8Xq8GSD+T9ytb93A IoOVa0f+kuwdxvfsx6/2OZSJo8yxUrCiefbzxkveEl+B9x+pbfI04zk97zhNF06TreGO K8Jg== X-Gm-Message-State: AOAM532L4+GY02bHaEhCWn/ohOFxpoKVfzaCJYq7Y8JkbtkgoUbpJuGo 6ya89LsKrXXB+GSJpeGSL2oewVEjwiIAOw== X-Google-Smtp-Source: ABdhPJzg8CniUYKP8VTtFkYYBSuDN91fqew9rjm3MWtypAdt5QvhFmvPgjZjbG3Y70uuR/eFQrT0YQ== X-Received: by 2002:ac8:7d42:0:b0:2de:4d3b:11cf with SMTP id h2-20020ac87d42000000b002de4d3b11cfmr25486628qtb.415.1646267161521; Wed, 02 Mar 2022 16:26:01 -0800 (PST) Received: from localhost.localdomain (garza.riseup.net. [198.252.153.109]) by smtp.gmail.com with ESMTPSA id b17-20020ae9eb11000000b0064917bda713sm281431qkg.85.2022.03.02.16.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 16:26:01 -0800 (PST) From: Glenn Washburn To: Daniel Kiper , grub-devel@gnu.org Cc: Glenn Washburn Subject: [PATCH] gdb: Add malloc and free symbols to kernel.exec to improve gdb functionality Date: Wed, 2 Mar 2022 18:25:12 -0600 Message-Id: <20220303002512.10596-1-development@efficientek.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::834 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::834; envelope-from=development@efficientek.com; helo=mail-qt1-x834.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2022 00:26:04 -0000 Add linker flags when linking kernel.exec to have malloc and free point to grub_malloc and grub_free respectively. Some gdb functionality depends on gdb locating the symbols "malloc" and "free", such as dynamically creating strings for arguments to injected function calls. A trivial example would the gdb command 'p strlen("astring")'. Signed-off-by: Glenn Washburn --- This should have been included in the gdb patch series I recently sent, although its not required by nor requires any of those patches. Glenn --- conf/Makefile.common | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/Makefile.common b/conf/Makefile.common index f0bb6e160a..069b428c1a 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -36,6 +36,7 @@ BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT) CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) +LDFLAGS_KERNEL += -Wl,--defsym=malloc=grub_malloc -Wl,--defsym=free=grub_free CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -- 2.27.0