From: Fangrui Song via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 43195@debbugs.gnu.org
Subject: bug#43195: [PATCH] Remove definitions of UP, BC and PC which should be provided by terminfo
Date: Fri, 4 Sep 2020 08:38:03 -0700 [thread overview]
Message-ID: <20200904153803.esenh3j2af4ymyd7@google.com> (raw)
In-Reply-To: <83wo1at2lu.fsf@gnu.org>
On 2020-09-04, Eli Zaretskii wrote:
>> Cc: Fangrui Song <maskray@google.com>
>> Date: Thu, 3 Sep 2020 17:57:48 -0700
>> From: Fangrui Song via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> Otherwise if terminfo.c is compiled with -fno-common (GCC 10 and clang
>> 11 default) and the archive version of the terminfo library is linked,
>> there will be a multiple definition linker error.
>>
>> * src/terminfo.c (UP, BC, PC): Delete.
>
>Given the comment there, I think this should be conditioned on
>actually using terminfo. Does the following patch work for you?
>
>diff --git a/src/terminfo.c b/src/terminfo.c
>index 51fd32e..0765996 100644
>--- a/src/terminfo.c
>+++ b/src/terminfo.c
>@@ -23,9 +23,12 @@
>
> /* Define these variables that serve as global parameters to termcap,
> so that we do not need to conditionalize the places in Emacs
>- that set them. */
>+ that set them. But don't do that for terminfo, as that could
>+ cause link errors when using -fno-common. */
>
>+#if !TERMINFO
> char *UP, *BC, PC;
>+#endif
>
> /* Interface to curses/terminfo library.
> Turns out that all of the terminfo-level routines look
>
Looks great! Thanks!
One nit,
#if !TERMINFO
probably should be
#ifndef TERMINFO
I don't know whether it is worth mentioning that -fcommon/-fno-common does not
cause a linker error when libtinfo.so is linked (a common/regular definition
preempts a shared definition).
-fno-common + libtinfo.a => multiple definition error
next prev parent reply other threads:[~2020-09-04 15:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 0:57 bug#43195: [PATCH] Remove definitions of UP, BC and PC which should be provided by terminfo Fangrui Song via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-04 7:36 ` Eli Zaretskii
2020-09-04 15:38 ` Fangrui Song via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2020-09-12 7:19 ` Eli Zaretskii
2020-09-12 7:33 ` Unknown
2020-09-12 7:49 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200904153803.esenh3j2af4ymyd7@google.com \
--to=bug-gnu-emacs@gnu.org \
--cc=43195@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=maskray@google.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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).