1 |
> On 22 Apr 2021, at 22:07, Nekun <nekokun@××××××××.cc> wrote: |
2 |
> |
3 |
> Hi all, |
4 |
> |
5 |
|
6 |
Hi! |
7 |
|
8 |
> Working on the fasm ebuild, have some questions: |
9 |
> |
10 |
> 1. fasm is written on itself and has two variants: self-contained binary for x86 and amd64 and linked with libc only for x86. Also, there are tools for working with the proprietary symbolic information format which is libc-linked and only x86. So, I provide two USEs, fail in pkg_setup if we on amd64 host and hasn't multilib profile if they are set and link it with default CC with -m32. Not sure it's a 'clean' way, would be happy to get some clarification about handling such cases. |
11 |
|
12 |
Such pkg_setups are best avoided if possible because they can be confusing and we have other tools to handle it, so I’m glad you asked! I’d provide a USE flag for this tool and mask it on non-multilib amd64 profiles (or mask everywhere and unmask on the multilib amd64 profiles). |
13 |
|
14 |
> |
15 |
> 2. When running my ebuild, got two warnings: one about text relocations, other about executable stack. Second problem seems trivial, just apply patches which adds corresponding ELF sections. But the first one is not clear: I found that TEXTRELs occurs due to default '--pie' option passed to ld by gcc and seems like it isn't possible to remove default ld options (only add to), so I can construct ld commandline for linking with libc manually and resolve a bunch of corner cases... But is avoiding TEXTRELs in assembly programs really necessary? Performance issues in case of assembly-written assembler seems negligible... What's best according to ::gentoo policies? |
16 |
> |
17 |
|
18 |
Two points. |
19 |
|
20 |
1) The TEXTREL QA warning primarily exists because of the security issues associated with them - they prevent PIC. |
21 |
|
22 |
The following links may be useful: |
23 |
- https://flameeyes.blog/2016/01/16/textrels-text-relocations-and-their-impact-on-hardening-techniques/ |
24 |
- https://wiki.gentoo.org/wiki/Hardened/Textrels_Guide |
25 |
|
26 |
However, I think it’s not really likely to be a real world issue if the program in question is an assembler. You’re just going to hit possible portability issues |
27 |
but I’m not sure what the details are there. |
28 |
|
29 |
2) Passing -fno-PIE and friends should work if you use append-* from flag-o-matic.eclass? |
30 |
|
31 |
But yeah, we have a nice legacy there in terms of good defaults which made their way upstream. See the Gentoo Hardened project’s history for more information. |
32 |
|
33 |
|
34 |
> See ebuild draft in attachment. |
35 |
|
36 |
Can’t see it here. |
37 |
|
38 |
Regards, |
39 |
sam |