FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 07-01-2011, 12:15 PM
Dan Horák
 
Default relro and precompiled headers

Hello,

when I'm building Code::Block in rawhide I'm getting into troubles with
the "relro" feature when combined with pre-compiled headers.

with default flags I get:
...
g++ -DHAVE_CONFIG_H -I/usr/lib64/wx/include/gtk2-unicode-release-2.8
-I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__
-pthread -I../../src/include -I../../src/sdk/wxscintilla/include
-I../../src/include/scripting/include
-I../../src/include/scripting/sqplus -I../../src/include/mozilla_chardet
-Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -Wl,-z,relro -m64 -mtune=generic -DCB_PRECOMP
-Winvalid-pch -fPIC -DPIC -fexceptions -o ../../src/include/sdk.h.gch
-xc++-header ./sdk.h
In file included from ./sdk_common.h:40:0,
from ./sdk_precomp.h:13,
from ./sdk.h:17:
./prep.h:32:1: warning: identifier ‘nullptr’ will become a keyword in C
++0x [-Wc++0x-compat]
In file included from ./sdk_common.h:40:0,
from ./sdk_precomp.h:13,
from ./sdk.h:17:
./prep.h: In member function ‘ID:perator void*() const’:
./prep.h:333:45: warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/crt1.o: In
function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status


and with "relro" removed the headers are pre-compiled as are in F<=15

Is it a bug or feature in g++ or somewhere else?


Dan


--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 07-01-2011, 12:15 PM
Dan Horák
 
Default relro and precompiled headers

Hello,

when I'm building Code::Block in rawhide I'm getting into troubles with
the "relro" feature when combined with pre-compiled headers.

with default flags I get:
...
g++ -DHAVE_CONFIG_H -I/usr/lib64/wx/include/gtk2-unicode-release-2.8
-I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__
-pthread -I../../src/include -I../../src/sdk/wxscintilla/include
-I../../src/include/scripting/include
-I../../src/include/scripting/sqplus -I../../src/include/mozilla_chardet
-Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -Wl,-z,relro -m64 -mtune=generic -DCB_PRECOMP
-Winvalid-pch -fPIC -DPIC -fexceptions -o ../../src/include/sdk.h.gch
-xc++-header ./sdk.h
In file included from ./sdk_common.h:40:0,
from ./sdk_precomp.h:13,
from ./sdk.h:17:
./prep.h:32:1: warning: identifier ‘nullptr’ will become a keyword in C
++0x [-Wc++0x-compat]
In file included from ./sdk_common.h:40:0,
from ./sdk_precomp.h:13,
from ./sdk.h:17:
./prep.h: In member function ‘ID:perator void*() const’:
./prep.h:333:45: warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/crt1.o: In
function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status


and with "relro" removed the headers are pre-compiled as are in F<=15

Is it a bug or feature in g++ or somewhere else?


Dan


--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 07-07-2011, 02:44 PM
Adam Jackson
 
Default relro and precompiled headers

On Fri, 2011-07-01 at 14:15 +0200, Dan Horák wrote:

> g++ -DHAVE_CONFIG_H -I/usr/lib64/wx/include/gtk2-unicode-release-2.8
> -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__
> -pthread -I../../src/include -I../../src/sdk/wxscintilla/include
> -I../../src/include/scripting/include
> -I../../src/include/scripting/sqplus -I../../src/include/mozilla_chardet
> -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -O2 -g -pipe -Wall
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -Wl,-z,relro -m64 -mtune=generic -DCB_PRECOMP
> -Winvalid-pch -fPIC -DPIC -fexceptions -o ../../src/include/sdk.h.gch
> -xc++-header ./sdk.h
> In file included from ./sdk_common.h:40:0,
> from ./sdk_precomp.h:13,
> from ./sdk.h:17:
> ./prep.h:32:1: warning: identifier ‘nullptr’ will become a keyword in C
> ++0x [-Wc++0x-compat]
> In file included from ./sdk_common.h:40:0,
> from ./sdk_precomp.h:13,
> from ./sdk.h:17:
> ./prep.h: In member function ‘ID:perator void*() const’:
> ./prep.h:333:45: warning: cast to pointer from integer of different size
> [-Wint-to-pointer-cast]
> /usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/crt1.o: In
> function `_start':
> (.text+0x20): undefined reference to `main'
> collect2: ld returned 1 exit status

Precompiled headers are, of course, a crutch for a broken language. But
given that...

It looks like gcc is treating the mere presence of -Wl,* as a request to
invoke the linker. This is a bit silly for precompiling headers, since
they're not objects, the linker couldn't link them if it wanted to. But
for example:

% gcc -c -o stdio.gch /usr/include/stdio.h
% gcc -c -o stdio.gch /usr/include/stdio.h -Wl,-z,relro
% gcc -o stdio.gch /usr/include/stdio.h -Wl,-z,relro
/usr/lib/gcc/x86_64-redhat-linux/4.6.0/../../../../lib64/crt1.o: In
function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status

So, ick. Probably we should do this the other way around: default ld to
-z relro (instead of -z norelro), and remove the -Wl bits from the
global cflags. Whether this is a gcc bug or not is debateable, I guess.

- ajax
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 07-07-2011, 02:49 PM
Jakub Jelinek
 
Default relro and precompiled headers

On Fri, Jul 01, 2011 at 02:15:08PM +0200, Dan Hork wrote:
> when I'm building Code::Block in rawhide I'm getting into troubles with
> the "relro" feature when combined with pre-compiled headers.
>
> with default flags I get:

Putting -Wl,-z,relro into CFLAGS or CXXFLAGS is a mistake, -Wl,-z,relro
should go into LDFLAGS instead.

Jakub
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 07-07-2011, 03:43 PM
Dan Horák
 
Default relro and precompiled headers

Jakub Jelinek p*še v Čt 07. 07. 2011 v 16:49 +0200:
> On Fri, Jul 01, 2011 at 02:15:08PM +0200, Dan Horák wrote:
> > when I'm building Code::Block in rawhide I'm getting into troubles with
> > the "relro" feature when combined with pre-compiled headers.
> >
> > with default flags I get:
>
> Putting -Wl,-z,relro into CFLAGS or CXXFLAGS is a mistake, -Wl,-z,relro
> should go into LDFLAGS instead.

Thanks for the info to both of you.

I have reassigned https://bugzilla.redhat.com/show_bug.cgi?id=718719 to
redhat-rpm-config. So a new variable will be needed for distr-wide
LDFLAGS, the %configure macro updated and maybe other stuff will have to
be touched too.


Dan


--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 07-07-2011, 04:13 PM
Ralf Corsepius
 
Default relro and precompiled headers

On 07/07/2011 05:43 PM, Dan Horák wrote:
> Jakub Jelinek p*še v Čt 07. 07. 2011 v 16:49 +0200:
>> On Fri, Jul 01, 2011 at 02:15:08PM +0200, Dan Horák wrote:
>>> when I'm building Code::Block in rawhide I'm getting into troubles with
>>> the "relro" feature when combined with pre-compiled headers.
>>>
>>> with default flags I get:
>>
>> Putting -Wl,-z,relro into CFLAGS or CXXFLAGS is a mistake, -Wl,-z,relro
>> should go into LDFLAGS instead.
>
> Thanks for the info to both of you.
>
> I have reassigned https://bugzilla.redhat.com/show_bug.cgi?id=718719 to
> redhat-rpm-config. So a new variable will be needed for distr-wide
> LDFLAGS, the %configure macro updated and maybe other stuff will have to
> be touched too.

Wouldn't it be better to patch GCC (GCC's spec) instead?

Ralf
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 07-07-2011, 05:02 PM
Adam Jackson
 
Default relro and precompiled headers

On Thu, 2011-07-07 at 16:49 +0200, Jakub Jelinek wrote:
> On Fri, Jul 01, 2011 at 02:15:08PM +0200, Dan Hork wrote:
> > when I'm building Code::Block in rawhide I'm getting into troubles with
> > the "relro" feature when combined with pre-compiled headers.
> >
> > with default flags I get:
>
> Putting -Wl,-z,relro into CFLAGS or CXXFLAGS is a mistake, -Wl,-z,relro
> should go into LDFLAGS instead.

We don't currently have global LDFLAGS in redhat-rpm-macros. But, no
time like the present I suppose.

- ajax
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 

Thread Tools




All times are GMT. The time now is 01:35 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org