ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Evgeny Sinelnikov <sin@altlinux.org>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] Проблема с debugedit при сборке ghc-9.2.8 на aarch64
Date: Mon, 25 Sep 2023 17:26:33 +0300
Message-ID: <CAK42-GrH+ke7fzO2+bdLy8X8mogmWfsDY+QwkJ9gfdo7PKL68w@mail.gmail.com> (raw)
In-Reply-To: <6d9fa048-d223-f406-34de-811139dd9117@basealt.ru>

Приветствую.

сб, 23 сент. 2023 г. в 12:44, Ilya Kurdyukov <ilyakurdyukov@basealt.ru>:
>
> On 9/23/23 16:36, Dmitry V. Levin wrote:
> >>   > --ldflags=-Wl,--build-id=sha1
> > Этой истории уже много лет, поэтому удивительно, что где-то до сих пор
> > по умолчанию создаётся 64-битный build id.  С точки зрения репозитория
> > важно не столько, чтобы конкретный пакет был исправлен, сколько чтобы
> > этого не происходило по умолчанию.
> >
> ghc (смотрел спеку 8.6.4) для armh/aarch64 собирается через LLVM:
[...]
> Это опции LLD, линковщика из LLVM:
>
[...]
> Если девятый ghc собирается так же - значит проблема в конфигурации
> LLVM, наверное там указано --build-id, что превращается в --build-id=fast.

ghc/mk/config.mk.in:
[...]
# Set to YES if ld has the --build-id flag.  Sometimes we need to
# disable it with --build-id=none.
LdHasBuildId<-->        = @LdHasBuildId@
[...]

Далее в коде не так много упоминаний об этом:

ghc/compiler/GHC/Driver/Pipeline/Execute.hs
[...]
Note [Merging object files for GHCi]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GHCi can usually loads standard linkable object files using GHC's linker
implementation. However, most users build their projects with -split-sections,
meaning that such object files can have an extremely high number of sections.
As the linker must map each of these sections individually, loading such object
files is very inefficient.

To avoid this inefficiency, we use the linker's `-r` flag and a linker script
to produce a merged relocatable object file. This file will contain a singe
text section section and can consequently be mapped far more efficiently. As
gcc tends to do unpredictable things to our linker command line, we opt to
invoke ld directly in this case, in contrast to our usual strategy of linking
via gcc.
-}

-- | See Note [Object merging].
joinObjectFiles :: HscEnv -> [FilePath] -> FilePath -> IO ()
joinObjectFiles hsc_env o_files output_fn
  | can_merge_objs = do
  let toolSettings' = toolSettings dflags
      ldIsGnuLd = toolSettings_ldIsGnuLd toolSettings'
      ld_r args = GHC.SysTools.runMergeObjects (hsc_logger hsc_env)
(hsc_tmpfs hsc_env) (hsc_dflags hsc_env) (
                        map GHC.SysTools.Option ld_build_id
                     ++ [ GHC.SysTools.Option "-o",
                          GHC.SysTools.FileOption "" output_fn ]
                     ++ args)

      -- suppress the generation of the .note.gnu.build-id section,
      -- which we don't need and sometimes causes ld to emit a
      -- warning:
      ld_build_id | toolSettings_ldSupportsBuildId toolSettings' =
["--build-id=none"]
                  | otherwise                                    = []
[...]

Ну, то есть, немного наоборот, вероятно, получается. --build-id явно
не указывается, а если и указывается, то в виде --build-id=none.


При этом вот такой вывод от бинаря

$ debugedit -i ./rts/dist/build/libHSrts_thr-ghc9.2.8.so
debugedit: Cannot handle 8-byte build ID

[builder@localhost ghc9.2.8-9.2.8]$ eu-readelf -n
./rts/dist/build/libHSrts_thr-ghc9.2.8.so | head

Note section [ 1] '.note.gnu.build-id' of 24 bytes at offset 0x270:
  Owner          Data size  Type
  GNU                    8  GNU_BUILD_ID
    Build ID: ba79f50a6074df4d


--
Sin (Sinelnikov Evgeny)

  reply	other threads:[~2023-09-25 14:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 22:51 Evgeny Sinelnikov
2023-09-23  8:26 ` Vitaly Chikunov
2023-09-23  9:36     ` Dmitry V. Levin
2023-09-23  9:44       ` Ilya Kurdyukov
2023-09-25 14:26         ` Evgeny Sinelnikov [this message]
2023-09-27 23:05         ` Arseny Maslennikov
2023-09-28  1:19           ` Ilya Kurdyukov
2023-10-19 22:40             ` Evgeny Sinelnikov
2023-10-20  5:28               ` Ivan A. Melnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK42-GrH+ke7fzO2+bdLy8X8mogmWfsDY+QwkJ9gfdo7PKL68w@mail.gmail.com \
    --to=sin@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git