Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 831165 - sys-devel/crossdev: fails to unset pie and ssp USE flags
Summary: sys-devel/crossdev: fails to unset pie and ssp USE flags
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Crossdev team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2022-01-14 07:56 UTC by Oskari Pirhonen
Modified: 2022-02-20 02:29 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
crossdev emerge --info (cross-arm-none-eabi-info.log,17.54 KB, text/plain)
2022-01-14 07:56 UTC, Oskari Pirhonen
Details
crossdev emerge -a -v gcc (cross-arm-none-eabi-gcc-stage1.log,545 bytes, text/plain)
2022-01-14 08:06 UTC, Oskari Pirhonen
Details
Fix the bug (0001-crossdev-use-package.use.-mask-force-for-pie-ssp.patch,3.75 KB, patch)
2022-01-14 08:11 UTC, Oskari Pirhonen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oskari Pirhonen 2022-01-14 07:56:16 UTC
Created attachment 762105 [details]
crossdev emerge --info

I was trying to build a bare-metal Arm cross-compiler for Raspberry Pi Pico development, but when I went to build the `blink` example [1] it failed during the linking stage with the following error (more or less, it's what I found in my browser search history):

    bs2_default.elf section .interp will not fit in region sram

Reading through the crossdev code, `*-eabi` targets are supposed to have the `pie` USE flag for gcc disabled, but I'm running a hardened profile which forces `pie`, so gcc was built with it enabled anyway.

After modifying crossdev to mask the USE flag gcc was built without `pie`, and I no longer ran into the linker error when doing a clean build of `blink` and its dependencies. Which worked as expected when booting the Pico with it installed.

[1]: https://github.com/raspberrypi/pico-examples/tree/afd1d2008f3fb3fa7a837dd1bdf17a6fecbc57fe#first--examples
Comment 1 Oskari Pirhonen 2022-01-14 08:06:46 UTC
Created attachment 762106 [details]
crossdev emerge -a -v gcc

Output from `emerge` showing that the `pie` USE flag is forced.
Comment 2 Oskari Pirhonen 2022-01-14 08:11:56 UTC
Created attachment 762107 [details, diff]
Fix the bug

This patch fixes the bug. It can be applied directly as a commit on top of proj/crossdev.git
Comment 3 Oskari Pirhonen 2022-01-22 22:44:32 UTC
Has anyone by any chance been able to look at this yet?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-22 23:04:30 UTC
(In reply to Oskari Pirhonen from comment #3)
> Has anyone by any chance been able to look at this yet?

It's only been a week, but I'd probably prefer vapier look at it rather than do it myself given I'm not sure if there's going to be a simpler way of doing it or something.

Thanks for the patch!
Comment 5 Larry the Git Cow gentoo-dev 2022-02-20 02:19:23 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=c439961a06625b27d39d683beee00e8c3a54005f

commit c439961a06625b27d39d683beee00e8c3a54005f
Author:     Oskari Pirhonen <xxc3ncoredxx@gmail.com>
AuthorDate: 2022-01-13 05:08:03 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-02-20 02:04:16 +0000

    crossdev: use package.use.{mask,force} for pie/ssp
    
    A hardened host profile forces the pie and ssp USE flags which is
    overriding GUSE="-pie -ssp". Use package.use.mask and package.use.force
    to control the flags.
    
    Closes: https://bugs.gentoo.org/831165
    Signed-off-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 crossdev | 45 +++++++++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 16 deletions(-)
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-02-20 02:29:19 UTC
Thanks for your contribution!