strip: Include `.o` files in strip operation

Message ID 20221005152834.2bd36rlwt7gg2d6a@mail.tty42.de
State Accepted, archived
Headers show
Series strip: Include `.o` files in strip operation | expand

Commit Message

Frederik Schwan Oct. 5, 2022, 3:28 p.m. UTC
`.o` objects used to be omitted by strip.sh due to a missing match in
the `Relocatable file` section. This patch fixes the issue by handling
`.o` objects similar to kernel modules.

fixes FS#74941
---
 scripts/libmakepkg/tidy/strip.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.36.1

Comments

Frederik Schwan Oct. 5, 2022, 3:35 p.m. UTC | #1
On Wed, Oct 05, 2022 at 05:28:47PM +0200, Frederik Schwan wrote:
> `.o` objects used to be omitted by strip.sh due to a missing match in
> the `Relocatable file` section. This patch fixes the issue by handling
> `.o` objects similar to kernel modules.
> 
> fixes FS#74941
> ---
>  scripts/libmakepkg/tidy/strip.sh.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
> index 688bcf1b..71fe8e88 100644
> --- a/scripts/libmakepkg/tidy/strip.sh.in
> +++ b/scripts/libmakepkg/tidy/strip.sh.in
> @@ -155,7 +155,7 @@ tidy_strip() {
>           if ar t "$binary" &>/dev/null; then # Libraries (.a)
>             strip_flags="$STRIP_STATIC"
>             STRIPLTO=1
> -         elif [[ $binary = *'.ko' ]]; then # Kernel module
> +         elif [[ $binary = *'.ko' || $binary = *'.o' ]]; then # Kernel module or object
>             strip_flags="$STRIP_SHARED"
>           else
>             continue
> --
> 2.36.1


Tested with glibc-2.36-5 and pacman-6.0.2-1. lgtm
Many pkgs that link against glibc ended up with messages like

> cp: cannot stat '/build/glibc/src/glibc/csu/../sysdeps/x86_64/crti.S': No such
> file or directory
> cp: cannot stat '/build/glibc/src/glibc/csu/../sysdeps/x86_64/crtn.S': No such
> file or directory

in the stripping phase. This is gone and the objects are stripped correctly now.
Though while building glibc, debugedit prints

> DWARF version 0 unhandled

The resulting objects seem fine nontheless.
This patch will fix FS#74941.

Cheers,
Frederik

Patch

diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
index 688bcf1b..71fe8e88 100644
--- a/scripts/libmakepkg/tidy/strip.sh.in
+++ b/scripts/libmakepkg/tidy/strip.sh.in
@@ -155,7 +155,7 @@  tidy_strip() {
          if ar t "$binary" &>/dev/null; then # Libraries (.a)
            strip_flags="$STRIP_STATIC"
            STRIPLTO=1
-         elif [[ $binary = *'.ko' ]]; then # Kernel module
+         elif [[ $binary = *'.ko' || $binary = *'.o' ]]; then # Kernel module or object
            strip_flags="$STRIP_SHARED"
          else
            continue