1 |
On czw, 2017-06-15 at 03:09 -0500, Matthias Maier wrote: |
2 |
> > > +# @FUNCTION: tc-enables-pie |
3 |
> > > +# @RETURN: Truth if the current compiler generates position-independent code (PIC) which can be linked into executables |
4 |
> > > +# @DESCRIPTION: |
5 |
> > > +# Return truth if the current compiler generates position-independent code (PIC) |
6 |
> > > +# which can be linked into executables. |
7 |
> > > +tc-enables-pie() { |
8 |
> > > + $($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null |
9 |
> > > + #if defined(__PIE__) |
10 |
> > > + true |
11 |
> > > + #else |
12 |
> > > + false |
13 |
> > > + #endif |
14 |
> > > + EOF |
15 |
> > > + ) |
16 |
> > |
17 |
> > Looks quite horrible. Why can't you just compare the output against |
18 |
> > a value instead of randomly executing it? |
19 |
> |
20 |
> Because we have to execute the compiler anyway and this is the quickest |
21 |
> way of getting the answer we need. Further, piping an unfiltered output |
22 |
> (e.g. -E -dM -x c) through grep is by no means prettier. |
23 |
> |
24 |
|
25 |
That's not what I mean. What I mean is that you are executing |
26 |
the filtered output, i.e. calling whatever gets spilt on stdout as shell |
27 |
script. |
28 |
|
29 |
-- |
30 |
Best regards, |
31 |
Michał Górny |