[Bug 1907789] Re: 2.35.50 breaks ld -no-pie
Bug Watch Updater
1907789 at bugs.launchpad.net
Mon Dec 14 15:20:44 UTC 2020
Launchpad has imported 11 comments from the remote bug at
https://sourceware.org/bugzilla/show_bug.cgi?id=27050.
If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.
------------------------------------------------------------------------
On 2020-12-11T10:05:19+00:00 Matthias Klose wrote:
works with the 2.35 branch, fails with the trunk:
$ ld.gold -pie
ld.gold: fatal error: no input files
$ ld.gold -no-pie
ld.gold: fatal error: no input files
$ ld.bfd -pie
ld.bfd: no input files
$ ld.bfd -no-pie
ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/3
------------------------------------------------------------------------
On 2020-12-11T13:13:48+00:00 Hjl-tools wrote:
It is caused by
commit 983d925db6a09ac90f6bed90be16eb69267b58e0
Author: Nick Clifton <nickc at redhat.com>
Date: Mon Oct 5 13:53:59 2020 +0100
Update the BFD linker so that it deprecates grouped short options.
* lexsup.c (parse_args): Generate an error or warning message when
multiple short options are used together.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/4
------------------------------------------------------------------------
On 2020-12-11T13:18:48+00:00 Hjl-tools wrote:
$ valgrind ./ld/ld-new -no-pie
==290969== Memcheck, a memory error detector
==290969== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==290969== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==290969== Command: ./ld/ld-new -no-pie
==290969==
==290969== Conditional jump or move depends on uninitialised value(s)
==290969== at 0x409A96: parse_args (lexsup.c:749)
==290969== by 0x403DC6: main (ldmain.c:370)
==290969==
./ld/ld-new: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
==290969==
==290969== HEAP SUMMARY:
==290969== in use at exit: 21,161 bytes in 10 blocks
==290969== total heap usage: 72 allocs, 62 frees, 43,232 bytes allocated
==290969==
==290969== LEAK SUMMARY:
==290969== definitely lost: 0 bytes in 0 blocks
==290969== indirectly lost: 0 bytes in 0 blocks
==290969== possibly lost: 0 bytes in 0 blocks
==290969== still reachable: 21,161 bytes in 10 blocks
==290969== suppressed: 0 bytes in 0 blocks
==290969== Rerun with --leak-check=full to see details of leaked memory
==290969==
==290969== Use --track-origins=yes to see where uninitialised values come from
==290969== For lists of detected and suppressed errors, rerun with: -s
==290969== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 0 from 0)
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/5
------------------------------------------------------------------------
On 2020-12-11T13:48:11+00:00 Hjl-tools wrote:
longind may not be set by getopt_long_only:
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 0d10bc6fba..60e3f7d8b5 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -735,6 +735,7 @@ parse_args (unsigned argc, char **argv)
/* getopt_long_only is like getopt_long, but '-' as well as '--'
can indicate a long option. */
opterr = 0;
+ longind = -1;
last_optind = optind;
optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
if (optc == '?')
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/6
------------------------------------------------------------------------
On 2020-12-11T13:55:31+00:00 Hjl-tools wrote:
LONGIND returns the index in LONGOPT of the long-named option found.
It is only valid when a long-named option has been found by the most
recent call.
Since the long option isn't found, LONGIND is undefined.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/7
------------------------------------------------------------------------
On 2020-12-11T15:26:17+00:00 Nickc wrote:
Not to be facetious but did we ever really support -no-pie ?
It does not appear to be documented, and it looks like it is treated
internally as two options: -n and -o-pie.
I have a patch that fixes the uninitialised memory problem detected
by valgrind, but I am wondering whether it is better to add explicit
support for -no-pie as an option to turn off -pie, or else keep the
linker's error message, and maybe add a --no-pie option instead.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/8
------------------------------------------------------------------------
On 2020-12-11T15:44:44+00:00 Hjl-tools wrote:
(In reply to Nick Clifton from comment #5)
> Not to be facetious but did we ever really support -no-pie ?
>
ld/testsuite/config/default.exp: set NOPIE_LDFLAGS "-no-pie"
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/9
------------------------------------------------------------------------
On 2020-12-11T15:53:22+00:00 Matthias Klose wrote:
that was reported for qemu:
./configure:# Check we support --no-pie first; we will need this for building ROMs.
./configure:if compile_prog "-Werror -fno-pie" "-no-pie"; then
./configure: LDFLAGS_NOPIE="-no-pie"
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/10
------------------------------------------------------------------------
On 2020-12-11T15:57:31+00:00 Andreas Schwab wrote:
That's the *compiler* flag.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/11
------------------------------------------------------------------------
On 2020-12-14T12:40:48+00:00 Cvs-commit wrote:
The master branch has been updated by Nick Clifton
<nickc at sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-
gdb.git;h=3991c7acb29aa8d7d52150695eb3efa03a08dd50
commit 3991c7acb29aa8d7d52150695eb3efa03a08dd50
Author: Nick Clifton <nickc at redhat.com>
Date: Mon Dec 14 12:40:13 2020 +0000
Fix a use of an uninitialised variable in the bfd linker.
PR 27050
* lexsup.c (parse_args): Ensure that the longind local variable is
set.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/12
------------------------------------------------------------------------
On 2020-12-14T12:43:14+00:00 Nickc wrote:
Right - I have checked in the patch to fix the use of an unitialised
variable.
Frankly I do not see any need to go any further. The linker does not
have a -no-pie or a --no-pie command line option, so the error message
is correct. Hence I am going to close this PR. If anyone has any
strong objections they can reopen it and tell us what they think.
Cheers
Nick
Reply at:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789/comments/13
** Changed in: binutils
Status: Unknown => Fix Released
** Changed in: binutils
Importance: Unknown => Medium
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to binutils in Ubuntu.
https://bugs.launchpad.net/bugs/1907789
Title:
2.35.50 breaks ld -no-pie
Status in binutils:
Fix Released
Status in binutils package in Ubuntu:
Fix Committed
Status in qemu package in Ubuntu:
In Progress
Bug description:
The qemu build reaches (and always did) a step where it tries to link some
img files. That is done via the command:
$ ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie -s -o multiboot.img multiboot.o
Recently that still works in Debian [1] but no more in Ubuntu [2].
I think that the new binutils broke me.
In hirsute proposed those are at 2.35.50.20201210-0ubuntu1
The issue is easily isolated, and by copying the two files around I
found the following:
Hirsute: 2.35.50.20201210-0ubuntu1 - bad
Hirsute: 2.35.50.20201207-0ubuntu1 - bad
Sid: 2.35.1-4 - good
Groovy: 2.35.1-1ubuntu1 - good
Focal: 2.34-6ubuntu1 - good
I'll attach these two files to the bug, just thro them into a directory and
run the command:
$ ld -m elf_i386 -T ./flat.lds -no-pie -s -o linuxboot.img linuxboot.o
If that is an intentional change please guide how this is now supposed
to work.
[1]: https://buildd.debian.org/status/fetch.php?pkg=qemu&arch=amd64&ver=1%3A5.2%2Bdfsg-2&stamp=1607598738&raw=1
[2]: https://launchpadlibrarian.net/510801929/buildlog_ubuntu-hirsute-amd64.qemu_1%3A5.2+dfsg-2ubuntu1~ppa2_BUILD
To manage notifications about this bug go to:
https://bugs.launchpad.net/binutils/+bug/1907789/+subscriptions
More information about the foundations-bugs
mailing list