Bug 17996 – [Reg 2.077] don't build libphobos2.a with PIC for i386
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86
OS
FreeBSD
Creation time
2017-11-20T11:16:23Z
Last change time
2017-11-21T16:56:42Z
Assigned to
No Owner
Creator
Martin Nowak
Comments
Comment #0 by code — 2017-11-20T11:16:23Z
cat > bug.d << CODE
import std.getopt;
void main(string[] args)
{
string extras;
getopt(args, "extras", &extras);
}
CODE
dmd bug
./bug --extras=foobar
==========
std.getopt.GetOptException@/home/vagrant/dlang/dmd-2.077.0/freebsd/bin32/../../src/phobos/std/getopt.d(789): Unrecognized option --extras=foobar
----------------
??:? @safe void std.getopt.getoptImpl!().getoptImpl(ref immutable(char)[][], ref std.getopt.configuration, ref std.getopt.GetoptResult, ref std.getopt.GetOptException, void[][immutable(char)[]], void[][immutable(char)[]]) [0x807b950]
??:? @safe void std.getopt.getoptImpl!(immutable(char)[], immutable(char)[]*).getoptImpl(ref immutable(char)[][], ref std.getopt.configuration, ref std.getopt.GetoptResult, ref std.getopt.GetOptException, void[][immutable(char)[]], void[][immutable(char)[]], immutable(char)[], immutable(char)[]*) [0x8079eed]
??:? @safe std.getopt.GetoptResult std.getopt.getopt!(immutable(char)[], immutable(char)[]*).getopt(ref immutable(char)[][], immutable(char)[], immutable(char)[]*) [0x8079942]
??:? _Dmain [0x80798db]
==========
I've debugged this until a failing optMatch call with seemingly correct arguments.
https://github.com/dlang/phobos/blob/7a2732e4b06d6684a717a756c20e271e9ede2812/std/getopt.d#L842
When converting optMatch to a template the bug goes away, so it might be some incompatibilities with the pre-compiled binary function shipped with phobos-2.077.0.
Comment #1 by code — 2017-11-20T11:33:49Z
Apparently happens due to usage of -fPIC when compiling phobos. While this is a bug with the PIC code generation, the 32-bit libphobos2.a should not use PIC.
Introduced by https://github.com/dlang/phobos/pull/5586
Comment #2 by github-bugzilla — 2017-11-20T14:30:28Z