From: Daniel Kiper <daniel.kiper@oracle.com>
To: grub-devel@gnu.org
Cc: development@efficientek.com, rharwood@redhat.com
Subject: [PATCH 4/6] conf/i386-cygwin-img-ld: Do not discard .data and .edata sections
Date: Fri, 11 Mar 2022 00:35:58 +0100 [thread overview]
Message-ID: <20220310233600.25910-5-daniel.kiper@oracle.com> (raw)
In-Reply-To: <20220310233600.25910-1-daniel.kiper@oracle.com>
$ ./configure --target=i686-w64-mingw32 --with-platform=efi --host=i686-w64-mingw32
[...]
checking if __bss_start is defined by the compiler... no
checking if edata is defined by the compiler... no
checking if _edata is defined by the compiler... no
configure: error: none of __bss_start, edata or _edata is defined
This happens on machines with quite recent ld due to an error:
`edata' referenced in section `.text' of /tmp/cc72w9E4.o: defined in discarded section `.data' of conftest.exe
collect2: error: ld returned 1 exit status
So, we have to tell linker to not discard .data and .edata sections.
The trick comes from ld documentation:
3.6.7 Output Section Discarding
The linker will not normally create output sections with no contents.
This is for convenience when referring to input sections that may or may
not be present in any of the input files. For example:
.foo : { *(.foo) }
will only create a ‘.foo’ section in the output file if there is a
‘.foo’ section in at least one input file, and if the input sections are
not all empty. Other link script directives that allocate space in an
output section will also create the output section. So too will
assignments to dot even if the assignment does not create space, except
for ‘. = 0’, ‘. = . + 0’, ‘. = sym’, ‘. = . + sym’ and ‘. = ALIGN (. !=
0, expr, 1)’ when ‘sym’ is an absolute symbol of value 0 defined in the
script. This allows you to force output of an empty section with ‘. = .’.
This change does not impact generated binaries because the
conf/i386-cygwin-img-ld.sc linker script is used only when
you run configure.
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
conf/i386-cygwin-img-ld.sc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/conf/i386-cygwin-img-ld.sc b/conf/i386-cygwin-img-ld.sc
index 3ac26fcce..578da91b0 100644
--- a/conf/i386-cygwin-img-ld.sc
+++ b/conf/i386-cygwin-img-ld.sc
@@ -14,6 +14,8 @@ SECTIONS
{
__data_start__ = . ;
*(.data)
+ /* Do not discard this section. */
+ . = . ;
__data_end__ = . ;
__rdata_start__ = . ;
*(.rdata)
@@ -34,6 +36,8 @@ SECTIONS
.edata :
{
*(.edata)
+ /* Do not discard this section. */
+ . = . ;
end = . ;
_end = . ;
__end = . ;
--
2.11.0
next prev parent reply other threads:[~2022-03-10 23:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 23:35 [PATCH 0/6] Various fixes and cleanups Daniel Kiper
2022-03-10 23:35 ` [PATCH 1/6] osdep/windows/platform: Disable gcc9 -Waddress-of-packed-member Daniel Kiper
2022-03-11 2:24 ` Vladimir 'phcoder' Serbinenko
2022-03-10 23:35 ` [PATCH 2/6] loader/i386/bsd: Initialize ptr variable in grub_bsd_add_meta() Daniel Kiper
2022-03-18 7:57 ` Paul Menzel
2022-03-18 19:21 ` Glenn Washburn
2022-03-24 15:12 ` Daniel Kiper
2022-03-10 23:35 ` [PATCH 3/6] commands/i386/pc/sendkey: Fix "writing 1 byte into a region of size 0" build error Daniel Kiper
2022-03-11 17:09 ` Glenn Washburn
2022-03-11 17:23 ` Toomas Soome
2022-03-11 21:37 ` Daniel Kiper
2022-03-11 18:41 ` Vladimir 'phcoder' Serbinenko
2022-03-14 4:16 ` Michael Chang
2022-03-15 13:43 ` Daniel Kiper
2022-03-10 23:35 ` Daniel Kiper [this message]
2022-03-10 23:35 ` [PATCH 5/6] configure: Drop ${grub_coredir} unneeded references Daniel Kiper
2022-03-10 23:36 ` [PATCH 6/6] INSTALL: Add more cross-compiling Debian packages Daniel Kiper
2022-03-17 6:02 ` Paul Menzel
2022-03-17 22:07 ` Daniel Kiper
2022-03-11 18:51 ` [PATCH 0/6] Various fixes and cleanups Robbie Harwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220310233600.25910-5-daniel.kiper@oracle.com \
--to=daniel.kiper@oracle.com \
--cc=development@efficientek.com \
--cc=grub-devel@gnu.org \
--cc=rharwood@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.