Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linker section overlap #171

Open
bolives-hax opened this issue Jul 24, 2024 · 13 comments
Open

linker section overlap #171

bolives-hax opened this issue Jul 24, 2024 · 13 comments
Labels

Comments

@bolives-hax
Copy link

Hey when building this from master as well as the most recent release (2.33.1) im getting issues like these:

390x-unknown-linux-gnu-ld: section .stage2dump.tail LMA [0000000000004ff0,0000000000004fff] overlaps section .data LMA [0000000000004fe8,000000000000500b]

regardless of wether im cross compiling it or "natively" compiling it using qemu binfmt.

So looking at:

.data : { *(.data) }

and consequently changing some of the offsets there at "s390-tools/zipl/boot/stage2.lds.S" does seem to get zipl to compile but it obviously doesn't work properly afterwards then.

So I'm wondering what may be the cause for the .data section to overlap with

which denotes the definitive start of of the tail.

since the sections before like:

  .text : { *(.text) }
  __ex_table_start = .;
  .ex_table : { *(.ex_table) }
  __ex_table_stop = .;
  .rodata : {*(.rodata) }
  .data : { *(.data) }
  __stage2_params = .;

's position is relative to the starting point and previous section start + size. I take that as either .data , the params or .rotata and whats before being too big? And thus causing .data to be shifted closer towards the tail causing this overlap error

I'm suspecting that the compiler I am using GCC 13.3.0 may somehow emit code thats sized differently or it may have renamed some sections or some other compiler internal change may be the cause. I did try cross compiling as well as using binfmt to build it on various systems be it NixOS (for which im currently trying to package this) or dockercross.

Since I dind't find any information regarding a recommended compiler / binutils release I'm not entirely sure how recent my compiler can be. Esp as in https://github.com/ibm-s390-linux/s390-tools/blob/master/common.mak#L56 while only part of an example comment 4.8 is mentioned which was released 10 years ago.

@bolives-hax
Copy link
Author

using gcc 4.8 does not seem to be possible anymore due to inline assembly syntax errors, using version 8 does cause similar issues though sections are offset by a couple of bytes suggesting less size efficient code to be generated possibly. trying verison 10 now

@steffen-eiden
Copy link
Member

Thank you for opening this up.

I tried to replicate the issue, but failed to do so.

I used Ubuntu 24.04 on a native s390 system (LPAR) with gcc 13.2.0 - worked
on s390x - Fedora 40 (gcc 14.1.1) - worked as well.

I tried cross compiling the boot loader from x86 on a Fedora 40 as well
390x-linux-gnu-gcc (GCC) 14.1.1 20240507 (Red Hat Cross 14.1.1-1)

still no problems.

Let me check if I find a gcc13.3.0

How does your build environment looks like?

@bolives-hax
Copy link
Author

Thank you for opening this up.

I tried to replicate the issue, but failed to do so.

I used Ubuntu 24.04 on a native s390 system (LPAR) with gcc 13.2.0 - worked on s390x - Fedora 40 (gcc 14.1.1) - worked as well.

I tried cross compiling the boot loader from x86 on a Fedora 40 as well 390x-linux-gnu-gcc (GCC) 14.1.1 20240507 (Red Hat Cross 14.1.1-1)

still no problems.

Let me check if I find a gcc13.3.0

How does your build environment looks like?

It seems like I can get this to run under debian using

Using built-in specs.
COLLECT_GCC=/usr/bin/s390x-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/s390x-linux-gnu/12/lto-wrapper
Target: s390x-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --disable-werror --with-arch=z196 --enable-s390-excess-float-precision --with-long-double-128 --enable-multilib --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=s390x-linux-gnu --program-prefix=s390x-linux-gnu- --includedir=/usr/s390x-linux-gnu/include
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Debian 12.2.0-14)

the nix counterpart looks like this:

COLLECT_GCC=/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/bin/s390x-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/libexec/gcc/s390x-unknown-linux-gnu/13.3.0/lto-wrapper
Target: s390x-unknown-linux-gnu
Configured with: ../gcc-13.3.0/configure --prefix=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-s390x-unknown-linux-gnu-gcc-13.3.0 --with-gmp-include=/nix/
store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gmp-with-cxx-6.3.0-dev/include --with-gmp-lib=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gmp-with-cxx-6.3.0/lib -
-with-mpfr-include=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-mpfr-4.2.1-dev/include --with-mpfr-lib=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-mpfr-4.
2.1/lib --with-mpc=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libmpc-1.3.1 --with-native-system-header-dir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-g
libc-s390x-unknown-linux-gnu-2.39-52-dev/include --with-build-sysroot=/ --with-gxx-include-dir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-s390x-unknown-
linux-gnu-gcc-13.3.0/include/c++/13.3.0/ --program-prefix=s390x-unknown-linux-gnu- --enable-lto --disable-libstdcxx-pch --without-included-gettext --with
-system-zlib --enable-static --enable-languages=c,c++ --disable-multilib --enable-plugin --with-isl=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-isl-0.20 
--with-arch=z10 --with-as=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-s390x-unknown-linux-gnu-binutils-wrapper-2.42/bin/s390x-unknown-linux-gnu-as --with
-ld=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-s390x-unknown-linux-gnu-binutils-wrapper-2.42/bin/s390x-unknown-linux-gnu-ld --with-headers=/nix/store/ee
eeeeeeeeeeeeeeeeeeeeeeeeeeeeee-glibc-s390x-unknown-linux-gnu-2.39-52-dev/include --enable-__cxa_atexit --enable-long-long --enable-threads=posix --enable
-nls --disable-bootstrap --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=s390x-unknown-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.3.0 (GCC) 

@bolives-hax
Copy link
Author

update: using gcc14 seems to work but 13 nor 10 nor 12 do, this sort of is expected in the sense that I expected this to somehow depend on compiler internal/optimisation/flag interpretation foo. As for now under nix I have a construct like seen below (please note that its incomplete and the host architecture is hardcoded, also the makefile is patched to only build zipl not
all the other libs and tools. I will uncomment most of these things and fix the nix attributes a little before attempting to push this
into nixos/nixpkgs's master branch. This for now is sort of a debug construct but it does build if gcc14 is used.

{
  inputs = {
    nixpkgs_.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    utils.url = "github:numtide/flake-utils";


    nixpkgs = {
      url = "github:nixos/nixpkgs;
      ref = "staging";
      type = "git";
    };

    s390-tools = {
      url = "ssh://[email protected]/ibm-s390-linux/s390-tools";
      flake = false;
      type = "git";
    };
  };
  outputs = { self, nixpkgs, utils, naersk , s390-tools, nixpkgs_}:
    utils.lib.eachSystem ["x86_64-linux" "s390x-linux"] (system:
      let
        _pkgs = import nixpkgs_ { system="x86_64-linux"; };
        pkgs = import nixpkgs {
          # todo inherit system instead and all
          system = "x86_64-linux";
          crossSystem = { gcc.arch = "z10"; config = "s390x-unknown-linux-gnu"; }; 
        };
      in
      {
        defaultPackage = pkgs.gcc14Stdenv.mkDerivation {
        #defaultPackage = pkgs.stdenv.mkDerivation {
          name = "s390-tools";
          version = "2.33.1";
          src = "${s390-tools}";
	  buildInputs = with pkgs; [
	    systemd.dev
	    cryptsetup.dev
	    net-snmp.dev
            #glibc.static.out
            #ncurses.dev
	    fuse3
	    #pkgs.cargo
	    openssl_legacy
            #curl.dev
	    #json_c.dev
	    #libxml2.dev
	  ];
          hardeningDisable = [ "all" ];
          patchPhase = with _pkgs; ''
            patchShebangs --build .
            substituteInPlace \
            common.mak --replace-fail "override SHELL := /bin/bash" "override SHELL := ${bash}/bin/bash"

            substituteInPlace Makefile \
            --replace-fail "LIB_DIRS = libvtoc libzds libdasd libccw libvmcp libekmfweb \\" "LIB_DIRS = #\\" \
            --replace-fail "TOOL_DIRS = zipl zdump fdasd dasdfmt dasdview tunedasd \\" "TOOL_DIRS = zipl #\\"
          '';
          buildPhase = ''
            make V=1 -j 1 HOST_ARCH=s390x BUILD_ARCH=x86_64-linux CROSS_COMPILE=s390x-unknown-linux-gnu-  \
                HAVE_OPENSSL=0 \
                HAVE_CURL=0 \
	    	HAVE_CARGO=0 \
	    	HAVE_GLIB=0 \
		HAVE_GLIB2=0 \
		HAVE_PFM=0 \

          '';
          installPhase = ''
            mkdir -p $out
            make V=1 -j 1 HOST_ARCH=s390x BUILD_ARCH=x86_64-linux CROSS_COMPILE=s390x-unknown-linux-gnu- DEST_DIR=$out \
                HAVE_OPENSSL=0 \
                HAVE_CURL=0 \
	    	HAVE_CARGO=0 \
	    	HAVE_GLIB=0 \
		HAVE_GLIB2=0 \
		HAVE_PFM=0 \
          '';
        };
      }
    );
}

@bolives-hax
Copy link
Author

so essentially in nix terms setting

        defaultPackage = pkgs.gcc14Stdenv.mkDerivation {};

does seem to work but setting

        defaultPackage = pkgs.gcc13Stdenv.mkDerivation {}

does not. The version set there indirecty affects the source thats being used for building gcc as seen here
https://github.com/NixOS/nixpkgs/blob/dc14ed91132ee3a26255d01d8fd0c1f5bff27b2f/pkgs/development/compilers/gcc/default.nix#L262
and I don't see any behavior specific to 14 that does or does not apply to 13 that would explain this except it indeed being some compiler internal behavior. Though maybe there is something I'm missing. My assumption still is that its some compiler optimisation feature or something but then you got it to work with 13.2.0 though that was run natively and not cross compiled like in my case. Honestly I'm sort of confused and will inject some debug flags to the GCC calls as V=1 does not seem to tell me enough to maybe spot some difference but again I don't believe or seem to spot obvious cases where nix would treat version gcc 13 any different from version 14. This is certainly a weird issue

@mhartmay
Copy link
Contributor

mhartmay commented Jul 25, 2024

Can you please provide the corresponding .map file? You can create them by adding -Xlinker [email protected] to the following Makefile recipe (https://github.com/ibm-s390-linux/s390-tools/blob/master/zipl/boot/Makefile#L86):

e.g.

%.exec: %.o
        $(LINK) -Wl,-T,$(filter %.lds,$^) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ -Xlinker [email protected]

Hopefully they will be generated, even if the linking fails :/

@bolives-hax
Copy link
Author

Can you please provide the corresponding .map file? You can create them by adding -Xlinker [email protected] to the following Makefile recipe (https://github.com/ibm-s390-linux/s390-tools/blob/master/zipl/boot/Makefile#L86):

e.g.

%.exec: %.o
        $(LINK) -Wl,-T,$(filter %.lds,$^) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ -Xlinker [email protected]

Hopefully they will be generated, even if the linking fails :/

eckd2dump_mv.exec.map :


Discarded input sections

 .note.GNU-stack
                0x0000000000000000        0x0 eckd2dump_mv.o
 .note.GNU-stack
                0x0000000000000000        0x0 head.o
 .note.GNU-stack
                0x0000000000000000        0x0 stage2dump.o
 .note.GNU-stack
                0x0000000000000000        0x0 cio.o
 .note.GNU-stack
                0x0000000000000000        0x0 eckd2dump.o
 .note.GNU-stack
                0x0000000000000000        0x0 libc.o
 .note.GNU-stack
                0x0000000000000000        0x0 ebcdic.o
 .note.GNU-stack
                0x0000000000000000        0x0 sclp.o
 .note.GNU-stack
                0x0000000000000000        0x0 entry.o

Memory Configuration

Name             Origin             Length             Attributes
*default*        0x0000000000000000 0xffffffffffffffff

Linker script and memory map

                0x0000000000000078                . = 0x78
                0x0000000000000078                __stage2_desc = .
                0x0000000000002000                . = 0x2000

.stage2.head    0x0000000000002000        0x8
 *(.stage2.head)
 .stage2.head   0x0000000000002000        0x8 eckd2dump_mv.o
                0x0000000000002000                magic
                0x0000000000002018                . = 0x2018

.text.start     0x0000000000002018       0x2e
 *(.text.start)
 .text.start    0x0000000000002018       0x2e head.o
                0x0000000000002018                _start

.text           0x0000000000002048     0x2c04
 *(.text)
 .text          0x0000000000002048      0x4a0 eckd2dump_mv.o
                0x0000000000002048                dt_device_parm_setup
                0x00000000000020a0                dt_device_enable
                0x0000000000002238                dt_dump_mem
 .text          0x00000000000024e8        0x0 head.o
 .text          0x00000000000024e8      0x938 stage2dump.o
                0x0000000000002780                progress_print
                0x0000000000002810                is_zero_mb
                0x0000000000002858                find_dump_segment
                0x0000000000002960                create_ida_list
                0x00000000000029b8                df_s390_em_page_init
                0x00000000000029f8                panic_notify
                0x0000000000002a28                start
 .text          0x0000000000002e20      0x390 cio.o
                0x0000000000002ee0                store_subchannel
                0x0000000000002ef8                io_irq_enable
                0x0000000000002f28                io_irq_disable
                0x0000000000002f50                start_io
                0x00000000000030d0                set_device
 .text          0x00000000000031b0      0x948 eckd2dump.o
                0x0000000000003798                writeblock
                0x00000000000037f8                readblock
                0x0000000000003858                write_addr_range
                0x0000000000003970                write_dump_segment
                0x0000000000003a08                stage2dump_eckd_init
 .text          0x0000000000003af8      0xa70 libc.o
                0x0000000000003af8                memset
                0x0000000000003b18                memcpy
                0x0000000000003b38                memmove
                0x0000000000003b88                strcpy
                0x0000000000003bb8                strlen
                0x0000000000003bd8                strlcpy
                0x0000000000003c48                strcat
                0x0000000000003c90                strncmp
                0x0000000000003cd8                strchr
                0x0000000000003cf8                strhash
                0x0000000000003d48                load_wait_psw
                0x0000000000003db0                initialize
                0x0000000000003e00                libc_stop
                0x0000000000004308                snprintf
                0x0000000000004358                printf
                0x00000000000043d0                get_zeroed_page
                0x0000000000004488                free_page
                0x00000000000044e8                pgm_check_handler_fn
 .text          0x0000000000004568       0x68 ebcdic.o
                0x0000000000004568                ebcdic_strtoul
 .text          0x00000000000045d0      0x660 sclp.o
                0x00000000000045d0                sclp_wait_for_int
                0x00000000000046b0                start_sclp
                0x0000000000004730                sclp_setup
                0x0000000000004820                sclp_print
                0x0000000000004980                sclp_read_info
                0x0000000000004a18                sclp_param
                0x0000000000004a78                sclp_read
 .text          0x0000000000004c30       0x1c entry.o
                0x0000000000004c30                pgm_check_handler
                0x0000000000004c4c                __ex_table_start = .

.iplt           0x0000000000004c4c        0x0
 .iplt          0x0000000000004c4c        0x0 eckd2dump_mv.o

.fixup          0x0000000000004c4c       0x40
 .fixup         0x0000000000004c4c       0x30 stage2dump.o
 .fixup         0x0000000000004c7c       0x10 eckd2dump.o

.ex_table       0x0000000000004c8c       0x88
 *(.ex_table)
 .ex_table      0x0000000000004c8c       0x68 stage2dump.o
 .ex_table      0x0000000000004cf4       0x20 eckd2dump.o
                0x0000000000004d14                __ex_table_stop = .

.rodata         0x0000000000004d18       0x48
 *(.rodata)
 .rodata        0x0000000000004d18        0x8 stage2dump.o
 .rodata        0x0000000000004d20       0x18 libc.o
 .rodata        0x0000000000004d38       0x28 sclp.o

.rodata.str1.2  0x0000000000004d60      0x240
 .rodata.str1.2
                0x0000000000004d60      0x240 eckd2dump_mv.o
                                         0x7a (size before relaxing)
 .rodata.str1.2
                0x0000000000004fa0      0x15c stage2dump.o
 .rodata.str1.2
                0x0000000000004fa0       0x32 cio.o
 .rodata.str1.2
                0x0000000000004fa0       0x4e eckd2dump.o

.rodata.cst8    0x0000000000004fa0       0x48
 .rodata.cst8   0x0000000000004fa0        0x8 eckd2dump_mv.o
 .rodata.cst8   0x0000000000004fa8       0x40 libc.o

.rela.dyn       0x0000000000004fe8        0x0
 .rela.iplt     0x0000000000004fe8        0x0 eckd2dump_mv.o
 .rela.rodata.cst8
                0x0000000000004fe8        0x0 eckd2dump_mv.o
 .rela.rodata   0x0000000000004fe8        0x0 eckd2dump_mv.o

.data           0x0000000000004fe8       0x24
 *(.data)
 .data          0x0000000000004fe8        0x4 eckd2dump_mv.o
 .data          0x0000000000004fec        0x0 head.o
 .data          0x0000000000004fec        0x0 stage2dump.o
 .data          0x0000000000004fec        0x0 cio.o
 .data          0x0000000000004fec       0x20 eckd2dump.o
 .data          0x000000000000500c        0x0 libc.o
 .data          0x000000000000500c        0x0 ebcdic.o
 .data          0x000000000000500c        0x0 sclp.o
 .data          0x000000000000500c        0x0 entry.o
                0x000000000000500c                __stage2_params = .

.igot.plt       0x0000000000005010        0x0
 .igot.plt      0x0000000000005010        0x0 eckd2dump_mv.o
                0x0000000000004ff0                . = 0x4ff0

.stage2dump.tail
                0x0000000000004ff0       0x10
 *(.stage2dump.tail)
 .stage2dump.tail
                0x0000000000004ff0       0x10 stage2dump.o
                0x0000000000004ff0                parm_tail
                0x0000000000005000                . = 0x5000

.eckd2dump_mv.tail
                0x0000000000005000      0x200
 *(.eckd2dump_mv.tail)
 .eckd2dump_mv.tail
                0x0000000000005000      0x200 eckd2dump_mv.o
                0x0000000000005200                . = 0x5200
                0x0000000000005200                __bss_start = .

.bss            0x0000000000005200      0x5ac
 *(.bss)
 .bss           0x0000000000005200        0x4 eckd2dump_mv.o
 .bss           0x0000000000005204        0x0 head.o
 *fill*         0x0000000000005204        0x4 
 .bss           0x0000000000005208       0x20 stage2dump.o
                0x0000000000005208                dump_hdr
                0x0000000000005218                total_dump_size
 .bss           0x0000000000005228        0x8 cio.o
 .bss           0x0000000000005230      0x578 eckd2dump.o
                0x0000000000005240                device
                0x00000000000057a0                eckd_blk_max
 .bss           0x00000000000057a8        0x4 libc.o
 .bss           0x00000000000057ac        0x0 ebcdic.o
 .bss           0x00000000000057ac        0x0 sclp.o
 .bss           0x00000000000057ac        0x0 entry.o
                0x00000000000057ac                __bss_stop = .
                0x0000000000006000                . = 0x6000
                0x0000000000006000                __heap_start = .

.heap           0x0000000000006000     0x3000
                0x0000000000009000                . = (. + 0x3000)
 *fill*         0x0000000000006000     0x3000 
                0x0000000000000001                ASSERT (((__heap_stop - __heap_start) == 0x3000), Heap section doesn't conform to the described memory layout)
                0x0000000000009000                __heap_stop = .
                0x0000000000009000                . = 0x9000

.stage3         0x0000000000009000     0x5400
                0x000000000000a000                . = (. + 0x1000)
 *fill*         0x0000000000009000     0x1000 
                0x0000000000001000                . = 0x1000
                0x0000000000004000                . = (. + 0x3000)
 *fill*         0x000000000000a000     0x3000 
                0x0000000000005000                . = 0x5000
 *fill*         0x000000000000d000     0x1000 
                0x000000000000e400                . = (. + 0x400)
 *fill*         0x000000000000e000      0x400 
                0x000000000000e400                . = 0xe400
                0x000000000000e400                __stack_start = .

.stack          0x000000000000e400     0x1c00
                0x0000000000010000                . = (. + 0x1c00)
 *fill*         0x000000000000e400     0x1c00 
                0x0000000000000001                ASSERT (((__stack_end - __stack_start) == 0x1c00), Stack section doesn't conform to the described memory layout)
                0x0000000000010000                __stack_end = .

/DISCARD/
 *(.eh_frame)
 *(.interp)
 *(.note.GNU-stack)
LOAD eckd2dump_mv.o
LOAD head.o
LOAD stage2dump.o
LOAD cio.o
LOAD eckd2dump.o
LOAD libc.o
LOAD ebcdic.o
LOAD sclp.o
LOAD entry.o
OUTPUT(eckd2dump_mv.exec elf64-s390)

.debug_info     0x0000000000000000     0xa641
 .debug_info    0x0000000000000000     0x11df eckd2dump_mv.o
 .debug_info    0x00000000000011df       0x28 head.o
 .debug_info    0x0000000000001207     0x30e7 stage2dump.o
 .debug_info    0x00000000000042ee     0x153c cio.o
 .debug_info    0x000000000000582a     0x1a60 eckd2dump.o
 .debug_info    0x000000000000728a     0x1898 libc.o
 .debug_info    0x0000000000008b22      0x129 ebcdic.o
 .debug_info    0x0000000000008c4b     0x19ce sclp.o
 .debug_info    0x000000000000a619       0x28 entry.o

.debug_abbrev   0x0000000000000000     0x20d9
 .debug_abbrev  0x0000000000000000      0x41c eckd2dump_mv.o
 .debug_abbrev  0x000000000000041c       0x14 head.o
 .debug_abbrev  0x0000000000000430      0x702 stage2dump.o
 .debug_abbrev  0x0000000000000b32      0x3ec cio.o
 .debug_abbrev  0x0000000000000f1e      0x5e1 eckd2dump.o
 .debug_abbrev  0x00000000000014ff      0x5ea libc.o
 .debug_abbrev  0x0000000000001ae9       0xd0 ebcdic.o
 .debug_abbrev  0x0000000000001bb9      0x50c sclp.o
 .debug_abbrev  0x00000000000020c5       0x14 entry.o

.debug_loclists
                0x0000000000000000     0x3221
 .debug_loclists
                0x0000000000000000      0x228 eckd2dump_mv.o
 .debug_loclists
                0x0000000000000228      0x958 stage2dump.o
 .debug_loclists
                0x0000000000000b80      0x375 cio.o
 .debug_loclists
                0x0000000000000ef5      0xf7d eckd2dump.o
 .debug_loclists
                0x0000000000001e72      0xd93 libc.o
 .debug_loclists
                0x0000000000002c05       0x43 ebcdic.o
 .debug_loclists
                0x0000000000002c48      0x5d9 sclp.o

.debug_aranges  0x0000000000000000      0x1b0
 .debug_aranges
                0x0000000000000000       0x30 eckd2dump_mv.o
 .debug_aranges
                0x0000000000000030       0x30 head.o
 .debug_aranges
                0x0000000000000060       0x30 stage2dump.o
 .debug_aranges
                0x0000000000000090       0x30 cio.o
 .debug_aranges
                0x00000000000000c0       0x30 eckd2dump.o
 .debug_aranges
                0x00000000000000f0       0x30 libc.o
 .debug_aranges
                0x0000000000000120       0x30 ebcdic.o
 .debug_aranges
                0x0000000000000150       0x30 sclp.o
 .debug_aranges
                0x0000000000000180       0x30 entry.o

.debug_rnglists
                0x0000000000000000      0x35c
 .debug_rnglists
                0x0000000000000000       0x7c eckd2dump_mv.o
 .debug_rnglists
                0x000000000000007c      0x106 stage2dump.o
 .debug_rnglists
                0x0000000000000182       0x1c cio.o
 .debug_rnglists
                0x000000000000019e       0xc6 eckd2dump.o
 .debug_rnglists
                0x0000000000000264       0x9c libc.o
 .debug_rnglists
                0x0000000000000300       0x5c sclp.o

.debug_line     0x0000000000000000     0x2efe
 .debug_line    0x0000000000000000      0x52f eckd2dump_mv.o
 .debug_line    0x000000000000052f       0x53 head.o
 .debug_line    0x0000000000000582      0xb40 stage2dump.o
 .debug_line    0x00000000000010c2      0x440 cio.o
 .debug_line    0x0000000000001502      0x90a eckd2dump.o
 .debug_line    0x0000000000001e0c      0x936 libc.o
 .debug_line    0x0000000000002742       0xb7 ebcdic.o
 .debug_line    0x00000000000027f9      0x6b7 sclp.o
 .debug_line    0x0000000000002eb0       0x4e entry.o

.debug_str      0x0000000000000000     0x1c9a
 .debug_str     0x0000000000000000     0x1c9a eckd2dump_mv.o
                                        0x73f (size before relaxing)
 .debug_str     0x0000000000001c9a       0x49 head.o
 .debug_str     0x0000000000001c9a     0x1209 stage2dump.o
 .debug_str     0x0000000000001c9a      0xa60 cio.o
 .debug_str     0x0000000000001c9a      0x7d3 eckd2dump.o
 .debug_str     0x0000000000001c9a      0xba6 libc.o
 .debug_str     0x0000000000001c9a      0x218 ebcdic.o
 .debug_str     0x0000000000001c9a      0xccb sclp.o
 .debug_str     0x0000000000001c9a       0x4a entry.o

.comment        0x0000000000000000       0x12
 .comment       0x0000000000000000       0x12 eckd2dump_mv.o
                                         0x13 (size before relaxing)
 .comment       0x0000000000000012       0x13 stage2dump.o
 .comment       0x0000000000000012       0x13 cio.o
 .comment       0x0000000000000012       0x13 eckd2dump.o
 .comment       0x0000000000000012       0x13 libc.o
 .comment       0x0000000000000012       0x13 ebcdic.o
 .comment       0x0000000000000012       0x13 sclp.o

.debug_frame    0x0000000000000000      0xab0
 .debug_frame   0x0000000000000000       0xb0 eckd2dump_mv.o
 .debug_frame   0x00000000000000b0      0x1b8 stage2dump.o
 .debug_frame   0x0000000000000268      0x138 cio.o
 .debug_frame   0x00000000000003a0      0x220 eckd2dump.o
 .debug_frame   0x00000000000005c0      0x300 libc.o
 .debug_frame   0x00000000000008c0       0x40 ebcdic.o
 .debug_frame   0x0000000000000900      0x1b0 sclp.o

.debug_line_str
                0x0000000000000000       0x45
 .debug_line_str
                0x0000000000000000       0x45 head.o
                                         0x3d (size before relaxing)
 .debug_line_str
                0x0000000000000045       0x3e entry.o

@bolives-hax
Copy link
Author

it seems like this is the last time gcc was called when linking before failing, thus the map provided above is the result of that last call and the files did indeed not get deleted (assuming nix develop's shell is used rather than nix build ofc)

COMPILER_PATH=/nix/store/91316vi6ili62vdag2z5hzvpi16pqswy-glibc-s390x-unknown-linux-gnu-2.39-52/lib/:/nix/store/zi4v7adv6y1abynqh9ii1whdlxfhdx61-s390x-unkn
own-linux-gnu-gcc-13.3.0-lib/s390x-unknown-linux-gnu/lib/:/nix/store/0dgg9rkgsvpp2xcbqlh8ds76lvxnmszd-s390x-unknown-linux-gnu-gcc-wrapper-13.3.0/bin/:/nix/
store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/libexec/gcc/s390x-unknown-linux-gnu/13.3.0/:/nix/store/q3a04zj7a0gyz0j1wqnip04bvn
ywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/libexec/gcc/s390x-unknown-linux-gnu/13.3.0/:/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-g
cc-13.3.0/libexec/gcc/s390x-unknown-linux-gnu/:/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/lib/gcc/s390x-unknown-linux-g
nu/13.3.0/:/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/lib/gcc/s390x-unknown-linux-gnu/
LIBRARY_PATH=/nix/store/91316vi6ili62vdag2z5hzvpi16pqswy-glibc-s390x-unknown-linux-gnu-2.39-52/lib/:/nix/store/zi4v7adv6y1abynqh9ii1whdlxfhdx61-s390x-unkno
wn-linux-gnu-gcc-13.3.0-lib/s390x-unknown-linux-gnu/lib/:/nix/store/0dgg9rkgsvpp2xcbqlh8ds76lvxnmszd-s390x-unknown-linux-gnu-gcc-wrapper-13.3.0/bin/:/nix/s
tore/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/lib/gcc/s390x-unknown-linux-gnu/13.3.0/:/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx
7-s390x-unknown-linux-gnu-gcc-13.3.0/lib/gcc/s390x-unknown-linux-gnu/13.3.0/../../../../s390x-unknown-linux-gnu/lib/../lib64/:/nix/store/q3a04zj7a0gyz0j1wq
nip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/lib/gcc/s390x-unknown-linux-gnu/13.3.0/../../../../s390x-unknown-linux-gnu/lib/
COLLECT_GCC_OPTIONS='-march=z10' '-v' '-no-pie' '-m64' '-static' '-nostdlib' '-o' 'eckd2dump_mv.exec' '-B' '/nix/store/91316vi6ili62vdag2z5hzvpi16pqswy-gli
bc-s390x-unknown-linux-gnu-2.39-52/lib/' '-idirafter' '/nix/store/v0z231xg6fcc34va2srvc6lbc1p7ggrs-glibc-s390x-unknown-linux-gnu-2.39-52-dev/include' '-idi
rafter' '/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/lib/gcc/s390x-unknown-linux-gnu/13.3.0/include-fixed' '-B' '/nix/st
ore/zi4v7adv6y1abynqh9ii1whdlxfhdx61-s390x-unknown-linux-gnu-gcc-13.3.0-lib/s390x-unknown-linux-gnu/lib' '-B' '/nix/store/0dgg9rkgsvpp2xcbqlh8ds76lvxnmszd-
s390x-unknown-linux-gnu-gcc-wrapper-13.3.0/bin/' '-frandom-seed=7k9j88pacw' '-isystem' '/nix/store/3rbrgr4hkybrhq1wjcjwr5lcjvaycqsi-systemd-s390x-unknown-l
inux-gnu-255.9-dev/include' '-isystem' '/nix/store/76bzpck8akng39y62madswh4xq4xgn1c-cryptsetup-s390x-unknown-linux-gnu-2.7.3-dev/include' '-isystem' '/nix/
store/6n2mh154qigksbvcmfzc0bl0qd8pi1qi-net-snmp-s390x-unknown-linux-gnu-5.9.4-dev/include' '-isystem' '/nix/store/wkgvwzi8alj77iqdwk7i79w76frfsiy4-fuse-s39
0x-unknown-linux-gnu-3.16.2/include' '-isystem' '/nix/store/qvvxvh7j284g6dk30rsjl0gdrwjbl1bb-openssl-s390x-unknown-linux-gnu-3.0.14-dev/include' '-L/nix/st
ore/ayhz1m7vvwbas4ah429akmy02762z503-systemd-s390x-unknown-linux-gnu-255.9/lib' '-L/nix/store/4xdpjlmnglbigarn3q02qlvwzwyw4pyz-cryptsetup-s390x-unknown-lin
ux-gnu-2.7.3/lib' '-L/nix/store/347cvrrmq9qx38j1cpvzwgpgdqw9caqq-net-snmp-s390x-unknown-linux-gnu-5.9.4-lib/lib' '-L/nix/store/wkgvwzi8alj77iqdwk7i79w76frf
siy4-fuse-s390x-unknown-linux-gnu-3.16.2/lib' '-L/nix/store/4vy2gahd311xlzhvgx6mnj1642v3ahds-openssl-s390x-unknown-linux-gnu-3.0.14/lib' '-L/nix/store/9131
6vi6ili62vdag2z5hzvpi16pqswy-glibc-s390x-unknown-linux-gnu-2.39-52/lib' '-L/nix/store/zi4v7adv6y1abynqh9ii1whdlxfhdx61-s390x-unknown-linux-gnu-gcc-13.3.0-l
ib/s390x-unknown-linux-gnu/lib' '-mzarch' '-dumpdir' 'eckd2dump_mv.exec.'
 /nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/libexec/gcc/s390x-unknown-linux-gnu/13.3.0/collect2 -plugin /nix/store/q3a0
4zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/libexec/gcc/s390x-unknown-linux-gnu/13.3.0/liblto_plugin.so -plugin-opt=/nix/store/q3a04zj7
a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/libexec/gcc/s390x-unknown-linux-gnu/13.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/nix-shell.
lTXpih/cc63hYvy.res -m elf64_s390 -static -o eckd2dump_mv.exec -L/nix/store/ayhz1m7vvwbas4ah429akmy02762z503-systemd-s390x-unknown-linux-gnu-255.9/lib -L/n
ix/store/4xdpjlmnglbigarn3q02qlvwzwyw4pyz-cryptsetup-s390x-unknown-linux-gnu-2.7.3/lib -L/nix/store/347cvrrmq9qx38j1cpvzwgpgdqw9caqq-net-snmp-s390x-unknown
-linux-gnu-5.9.4-lib/lib -L/nix/store/wkgvwzi8alj77iqdwk7i79w76frfsiy4-fuse-s390x-unknown-linux-gnu-3.16.2/lib -L/nix/store/4vy2gahd311xlzhvgx6mnj1642v3ahd
s-openssl-s390x-unknown-linux-gnu-3.0.14/lib -L/nix/store/91316vi6ili62vdag2z5hzvpi16pqswy-glibc-s390x-unknown-linux-gnu-2.39-52/lib -L/nix/store/zi4v7adv6
y1abynqh9ii1whdlxfhdx61-s390x-unknown-linux-gnu-gcc-13.3.0-lib/s390x-unknown-linux-gnu/lib -L/nix/store/91316vi6ili62vdag2z5hzvpi16pqswy-glibc-s390x-unknow
n-linux-gnu-2.39-52/lib -L/nix/store/zi4v7adv6y1abynqh9ii1whdlxfhdx61-s390x-unknown-linux-gnu-gcc-13.3.0-lib/s390x-unknown-linux-gnu/lib -L/nix/store/0dgg9
rkgsvpp2xcbqlh8ds76lvxnmszd-s390x-unknown-linux-gnu-gcc-wrapper-13.3.0/bin -L/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0
/lib/gcc/s390x-unknown-linux-gnu/13.3.0 -L/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/lib/gcc/s390x-unknown-linux-gnu/13
.3.0/../../../../s390x-unknown-linux-gnu/lib/../lib64 -L/nix/store/q3a04zj7a0gyz0j1wqnip04bvnywgxx7-s390x-unknown-linux-gnu-gcc-13.3.0/lib/gcc/s390x-unknow
n-linux-gnu/13.3.0/../../../../s390x-unknown-linux-gnu/lib -T stage2.lds --no-warn-rwx-segments --build-id=none eckd2dump_mv.o head.o stage2dump.o cio.o ec
kd2dump.o libc.o ebcdic.o sclp.o entry.o -Map=eckd2dump_mv.exec.map -rpath /home/flandre/s390x-nix-zipl/outputs/out/lib
/nix/store/46wmb70il49hdx3pgbaqps5d9na3szj2-s390x-unknown-linux-gnu-binutils-2.42/bin/s390x-unknown-linux-gnu-ld: section .stage2dump.tail LMA [00000000000
04ff0,0000000000004fff] overlaps section .data LMA [0000000000004fe8,000000000000500b]
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:87: eckd2dump_mv.exec] Error 1
rm eckd0_ldl.o fba0.o eckd1.o eckd0_cdl.o tape0.o fba1b.o eckd1b.o
make[2]: Leaving directory '/home/flandre/s390x-nix-zipl/dbg/s390-tools/zipl/boot'
make[1]: *** [Makefile:5: all] Error 2
make[1]: Leaving directory '/home/flandre/s390x-nix-zipl/dbg/s390-tools/zipl'
make: *** [Makefile:56: zipl] Error 2

I will also attach the gcc 14 one which works below:


Discarded input sections

 .note.GNU-stack
                0x0000000000000000        0x0 eckd2dump_mv.o
 .note.GNU-stack
                0x0000000000000000        0x0 head.o
 .note.GNU-stack
                0x0000000000000000        0x0 stage2dump.o
 .note.GNU-stack
                0x0000000000000000        0x0 cio.o
 .note.GNU-stack
                0x0000000000000000        0x0 eckd2dump.o
 .note.GNU-stack
                0x0000000000000000        0x0 libc.o
 .note.GNU-stack
                0x0000000000000000        0x0 ebcdic.o
 .note.GNU-stack
                0x0000000000000000        0x0 sclp.o
 .note.GNU-stack
                0x0000000000000000        0x0 entry.o

Memory Configuration

Name             Origin             Length             Attributes
*default*        0x0000000000000000 0xffffffffffffffff

Linker script and memory map

                0x0000000000000078                . = 0x78
                0x0000000000000078                __stage2_desc = .
                0x0000000000002000                . = 0x2000

.stage2.head    0x0000000000002000        0x8
 *(.stage2.head)
 .stage2.head   0x0000000000002000        0x8 eckd2dump_mv.o
                0x0000000000002000                magic
                0x0000000000002018                . = 0x2018

.text.start     0x0000000000002018       0x2e
 *(.text.start)
 .text.start    0x0000000000002018       0x2e head.o
                0x0000000000002018                _start

.text           0x0000000000002048     0x2b7c
 *(.text)
 .text          0x0000000000002048      0x4a0 eckd2dump_mv.o
                0x0000000000002048                dt_device_parm_setup
                0x00000000000020a0                dt_device_enable
                0x0000000000002238                dt_dump_mem
 .text          0x00000000000024e8        0x0 head.o
 .text          0x00000000000024e8      0x918 stage2dump.o
                0x0000000000002780                progress_print
                0x0000000000002810                is_zero_mb
                0x0000000000002858                find_dump_segment
                0x0000000000002948                create_ida_list
                0x00000000000029a0                df_s390_em_page_init
                0x00000000000029e0                panic_notify
                0x0000000000002a10                start
 .text          0x0000000000002e00      0x390 cio.o
                0x0000000000002ec0                store_subchannel
                0x0000000000002ed8                io_irq_enable
                0x0000000000002f08                io_irq_disable
                0x0000000000002f30                start_io
                0x00000000000030b0                set_device
 .text          0x0000000000003190      0x928 eckd2dump.o
                0x0000000000003760                writeblock
                0x00000000000037c0                readblock
                0x0000000000003820                write_addr_range
                0x0000000000003938                write_dump_segment
                0x00000000000039c8                stage2dump_eckd_init
 .text          0x0000000000003ab8      0xa38 libc.o
                0x0000000000003ab8                memset
                0x0000000000003ad8                memcpy
                0x0000000000003af8                memmove
                0x0000000000003b48                strcpy
                0x0000000000003b78                strlen
                0x0000000000003b98                strlcpy
                0x0000000000003c08                strcat
                0x0000000000003c50                strncmp
                0x0000000000003c98                strchr
                0x0000000000003cb8                strhash
                0x0000000000003d08                load_wait_psw
                0x0000000000003d70                initialize
                0x0000000000003dc8                libc_stop
                0x00000000000042a0                snprintf
                0x00000000000042f0                printf
                0x0000000000004368                get_zeroed_page
                0x0000000000004428                free_page
                0x0000000000004480                pgm_check_handler_fn
 .text          0x00000000000044f0       0x68 ebcdic.o
                0x00000000000044f0                ebcdic_strtoul
 .text          0x0000000000004558      0x650 sclp.o
                0x0000000000004558                sclp_wait_for_int
                0x0000000000004638                start_sclp
                0x00000000000046b8                sclp_setup
                0x00000000000047a8                sclp_print
                0x0000000000004900                sclp_read_info
                0x0000000000004990                sclp_param
                0x00000000000049f0                sclp_read
 .text          0x0000000000004ba8       0x1c entry.o
                0x0000000000004ba8                pgm_check_handler
                0x0000000000004bc4                __ex_table_start = .

.iplt           0x0000000000004bc4        0x0
 .iplt          0x0000000000004bc4        0x0 eckd2dump_mv.o

.fixup          0x0000000000004bc4       0x40
 .fixup         0x0000000000004bc4       0x30 stage2dump.o
 .fixup         0x0000000000004bf4       0x10 eckd2dump.o

.ex_table       0x0000000000004c04       0x88
 *(.ex_table)
 .ex_table      0x0000000000004c04       0x68 stage2dump.o
 .ex_table      0x0000000000004c6c       0x20 eckd2dump.o
                0x0000000000004c8c                __ex_table_stop = .

.rodata         0x0000000000004c90       0x40
 *(.rodata)
 .rodata        0x0000000000004c90        0x8 stage2dump.o
 .rodata        0x0000000000004c98       0x10 libc.o
 .rodata        0x0000000000004ca8       0x28 sclp.o

.rodata.str1.2  0x0000000000004cd0      0x240
 .rodata.str1.2
                0x0000000000004cd0      0x240 eckd2dump_mv.o
                                         0x7a (size before relaxing)
 .rodata.str1.2
                0x0000000000004f10      0x15c stage2dump.o
 .rodata.str1.2
                0x0000000000004f10       0x32 cio.o
 .rodata.str1.2
                0x0000000000004f10       0x4e eckd2dump.o

.rela.dyn       0x0000000000004f10        0x0
 .rela.iplt     0x0000000000004f10        0x0 eckd2dump_mv.o
 .rela.text     0x0000000000004f10        0x0 eckd2dump_mv.o

.data           0x0000000000004f10       0x24
 *(.data)
 .data          0x0000000000004f10        0x4 eckd2dump_mv.o
 .data          0x0000000000004f14        0x0 head.o
 .data          0x0000000000004f14        0x0 stage2dump.o
 .data          0x0000000000004f14        0x0 cio.o
 .data          0x0000000000004f14       0x20 eckd2dump.o
 .data          0x0000000000004f34        0x0 libc.o
 .data          0x0000000000004f34        0x0 ebcdic.o
 .data          0x0000000000004f34        0x0 sclp.o
 .data          0x0000000000004f34        0x0 entry.o
                0x0000000000004f34                __stage2_params = .

.igot.plt       0x0000000000004f38        0x0
 .igot.plt      0x0000000000004f38        0x0 eckd2dump_mv.o
                0x0000000000004ff0                . = 0x4ff0

.stage2dump.tail
                0x0000000000004ff0       0x10
 *(.stage2dump.tail)
 .stage2dump.tail
                0x0000000000004ff0       0x10 stage2dump.o
                0x0000000000004ff0                parm_tail
                0x0000000000005000                . = 0x5000

.eckd2dump_mv.tail
                0x0000000000005000      0x200
 *(.eckd2dump_mv.tail)
 .eckd2dump_mv.tail
                0x0000000000005000      0x200 eckd2dump_mv.o
                0x0000000000005200                . = 0x5200
                0x0000000000005200                __bss_start = .

.bss            0x0000000000005200      0x5ac
 *(.bss)
 .bss           0x0000000000005200        0x4 eckd2dump_mv.o
 .bss           0x0000000000005204        0x0 head.o
 *fill*         0x0000000000005204        0x4 
 .bss           0x0000000000005208       0x20 stage2dump.o
                0x0000000000005208                dump_hdr
                0x0000000000005218                total_dump_size
 .bss           0x0000000000005228        0x8 cio.o
 .bss           0x0000000000005230      0x578 eckd2dump.o
                0x0000000000005240                device
                0x00000000000057a0                eckd_blk_max
 .bss           0x00000000000057a8        0x4 libc.o
 .bss           0x00000000000057ac        0x0 ebcdic.o
 .bss           0x00000000000057ac        0x0 sclp.o
 .bss           0x00000000000057ac        0x0 entry.o
                0x00000000000057ac                __bss_stop = .
                0x0000000000006000                . = 0x6000
                0x0000000000006000                __heap_start = .

.heap           0x0000000000006000     0x3000
                0x0000000000009000                . = (. + 0x3000)
 *fill*         0x0000000000006000     0x3000 
                0x0000000000000001                ASSERT (((__heap_stop - __heap_start) == 0x3000), Heap section doesn't conform to the described memory layout)
                0x0000000000009000                __heap_stop = .
                0x0000000000009000                . = 0x9000

.stage3         0x0000000000009000     0x5400
                0x000000000000a000                . = (. + 0x1000)
 *fill*         0x0000000000009000     0x1000 
                0x0000000000001000                . = 0x1000
                0x0000000000004000                . = (. + 0x3000)
 *fill*         0x000000000000a000     0x3000 
                0x0000000000005000                . = 0x5000
 *fill*         0x000000000000d000     0x1000 
                0x000000000000e400                . = (. + 0x400)
 *fill*         0x000000000000e000      0x400 
                0x000000000000e400                . = 0xe400
                0x000000000000e400                __stack_start = .

.stack          0x000000000000e400     0x1c00
                0x0000000000010000                . = (. + 0x1c00)
 *fill*         0x000000000000e400     0x1c00 
                0x0000000000000001                ASSERT (((__stack_end - __stack_start) == 0x1c00), Stack section doesn't conform to the described memory layout)
                0x0000000000010000                __stack_end = .

/DISCARD/
 *(.eh_frame)
 *(.interp)
 *(.note.GNU-stack)
LOAD eckd2dump_mv.o
LOAD head.o
LOAD stage2dump.o
LOAD cio.o
LOAD eckd2dump.o
LOAD libc.o
LOAD ebcdic.o
LOAD sclp.o
LOAD entry.o
OUTPUT(eckd2dump_mv.exec elf64-s390)

.debug_info     0x0000000000000000     0xa624
 .debug_info    0x0000000000000000     0x11df eckd2dump_mv.o
 .debug_info    0x00000000000011df       0x28 head.o
 .debug_info    0x0000000000001207     0x30e9 stage2dump.o
 .debug_info    0x00000000000042f0     0x1536 cio.o
 .debug_info    0x0000000000005826     0x1a37 eckd2dump.o
 .debug_info    0x000000000000725d     0x18b5 libc.o
 .debug_info    0x0000000000008b12      0x129 ebcdic.o
 .debug_info    0x0000000000008c3b     0x19c1 sclp.o
 .debug_info    0x000000000000a5fc       0x28 entry.o

.debug_abbrev   0x0000000000000000     0x2133
 .debug_abbrev  0x0000000000000000      0x422 eckd2dump_mv.o
 .debug_abbrev  0x0000000000000422       0x14 head.o
 .debug_abbrev  0x0000000000000436      0x71e stage2dump.o
 .debug_abbrev  0x0000000000000b54      0x404 cio.o
 .debug_abbrev  0x0000000000000f58      0x5f8 eckd2dump.o
 .debug_abbrev  0x0000000000001550      0x5d8 libc.o
 .debug_abbrev  0x0000000000001b28       0xd0 ebcdic.o
 .debug_abbrev  0x0000000000001bf8      0x527 sclp.o
 .debug_abbrev  0x000000000000211f       0x14 entry.o

.debug_loclists
                0x0000000000000000     0x2f49
 .debug_loclists
                0x0000000000000000      0x228 eckd2dump_mv.o
 .debug_loclists
                0x0000000000000228      0x93a stage2dump.o
 .debug_loclists
                0x0000000000000b62      0x375 cio.o
 .debug_loclists
                0x0000000000000ed7      0xfe4 eckd2dump.o
 .debug_loclists
                0x0000000000001ebb      0xa96 libc.o
 .debug_loclists
                0x0000000000002951       0x3c ebcdic.o
 .debug_loclists
                0x000000000000298d      0x5bc sclp.o

.debug_aranges  0x0000000000000000      0x1b0
 .debug_aranges
                0x0000000000000000       0x30 eckd2dump_mv.o
 .debug_aranges
                0x0000000000000030       0x30 head.o
 .debug_aranges
                0x0000000000000060       0x30 stage2dump.o
 .debug_aranges
                0x0000000000000090       0x30 cio.o
 .debug_aranges
                0x00000000000000c0       0x30 eckd2dump.o
 .debug_aranges
                0x00000000000000f0       0x30 libc.o
 .debug_aranges
                0x0000000000000120       0x30 ebcdic.o
 .debug_aranges
                0x0000000000000150       0x30 sclp.o
 .debug_aranges
                0x0000000000000180       0x30 entry.o

.debug_rnglists
                0x0000000000000000      0x328
 .debug_rnglists
                0x0000000000000000       0x77 eckd2dump_mv.o
 .debug_rnglists
                0x0000000000000077      0x102 stage2dump.o
 .debug_rnglists
                0x0000000000000179       0x1c cio.o
 .debug_rnglists
                0x0000000000000195       0xd1 eckd2dump.o
 .debug_rnglists
                0x0000000000000266       0x66 libc.o
 .debug_rnglists
                0x00000000000002cc       0x5c sclp.o

.debug_line     0x0000000000000000     0x2e5f
 .debug_line    0x0000000000000000      0x523 eckd2dump_mv.o
 .debug_line    0x0000000000000523       0x53 head.o
 .debug_line    0x0000000000000576      0xb27 stage2dump.o
 .debug_line    0x000000000000109d      0x440 cio.o
 .debug_line    0x00000000000014dd      0x908 eckd2dump.o
 .debug_line    0x0000000000001de5      0x8cf libc.o
 .debug_line    0x00000000000026b4       0xb5 ebcdic.o
 .debug_line    0x0000000000002769      0x6a8 sclp.o
 .debug_line    0x0000000000002e11       0x4e entry.o

.debug_str      0x0000000000000000     0x1c9a
 .debug_str     0x0000000000000000     0x1c9a eckd2dump_mv.o
                                        0x73f (size before relaxing)
 .debug_str     0x0000000000001c9a       0x49 head.o
 .debug_str     0x0000000000001c9a     0x1209 stage2dump.o
 .debug_str     0x0000000000001c9a      0xa60 cio.o
 .debug_str     0x0000000000001c9a      0x7d3 eckd2dump.o
 .debug_str     0x0000000000001c9a      0xba6 libc.o
 .debug_str     0x0000000000001c9a      0x218 ebcdic.o
 .debug_str     0x0000000000001c9a      0xccb sclp.o
 .debug_str     0x0000000000001c9a       0x4a entry.o

.comment        0x0000000000000000       0x12
 .comment       0x0000000000000000       0x12 eckd2dump_mv.o
                                         0x13 (size before relaxing)
 .comment       0x0000000000000012       0x13 stage2dump.o
 .comment       0x0000000000000012       0x13 cio.o
 .comment       0x0000000000000012       0x13 eckd2dump.o
 .comment       0x0000000000000012       0x13 libc.o
 .comment       0x0000000000000012       0x13 ebcdic.o
 .comment       0x0000000000000012       0x13 sclp.o

.debug_frame    0x0000000000000000      0xaa8
 .debug_frame   0x0000000000000000       0xb0 eckd2dump_mv.o
 .debug_frame   0x00000000000000b0      0x1b8 stage2dump.o
 .debug_frame   0x0000000000000268      0x138 cio.o
 .debug_frame   0x00000000000003a0      0x220 eckd2dump.o
 .debug_frame   0x00000000000005c0      0x2f8 libc.o
 .debug_frame   0x00000000000008b8       0x40 ebcdic.o
 .debug_frame   0x00000000000008f8      0x1b0 sclp.o

.debug_line_str
                0x0000000000000000       0x45
 .debug_line_str
                0x0000000000000000       0x45 head.o
                                         0x3d (size before relaxing)
 .debug_line_str
                0x0000000000000045       0x3e entry.o

thus the diff diff zipl/boot/eckd2dump_mv.exec.map zipl/boot/eckd2dump_mv.exec.map.13
of the gcc13 vs gcc14 map returns the following:

45c45
< .text           0x0000000000002048     0x2b7c
---
> .text           0x0000000000002048     0x2c04
52c52
<  .text          0x00000000000024e8      0x918 stage2dump.o
---
>  .text          0x00000000000024e8      0x938 stage2dump.o
56,110c56,110
<                 0x0000000000002948                create_ida_list
<                 0x00000000000029a0                df_s390_em_page_init
<                 0x00000000000029e0                panic_notify
<                 0x0000000000002a10                start
<  .text          0x0000000000002e00      0x390 cio.o
<                 0x0000000000002ec0                store_subchannel
<                 0x0000000000002ed8                io_irq_enable
<                 0x0000000000002f08                io_irq_disable
<                 0x0000000000002f30                start_io
<                 0x00000000000030b0                set_device
<  .text          0x0000000000003190      0x928 eckd2dump.o
<                 0x0000000000003760                writeblock
<                 0x00000000000037c0                readblock
<                 0x0000000000003820                write_addr_range
<                 0x0000000000003938                write_dump_segment
<                 0x00000000000039c8                stage2dump_eckd_init
<  .text          0x0000000000003ab8      0xa38 libc.o
<                 0x0000000000003ab8                memset
<                 0x0000000000003ad8                memcpy
<                 0x0000000000003af8                memmove
<                 0x0000000000003b48                strcpy
<                 0x0000000000003b78                strlen
<                 0x0000000000003b98                strlcpy
<                 0x0000000000003c08                strcat
<                 0x0000000000003c50                strncmp
<                 0x0000000000003c98                strchr
<                 0x0000000000003cb8                strhash
<                 0x0000000000003d08                load_wait_psw
<                 0x0000000000003d70                initialize
<                 0x0000000000003dc8                libc_stop
<                 0x00000000000042a0                snprintf
<                 0x00000000000042f0                printf
<                 0x0000000000004368                get_zeroed_page
<                 0x0000000000004428                free_page
<                 0x0000000000004480                pgm_check_handler_fn
<  .text          0x00000000000044f0       0x68 ebcdic.o
<                 0x00000000000044f0                ebcdic_strtoul
<  .text          0x0000000000004558      0x650 sclp.o
<                 0x0000000000004558                sclp_wait_for_int
<                 0x0000000000004638                start_sclp
<                 0x00000000000046b8                sclp_setup
<                 0x00000000000047a8                sclp_print
<                 0x0000000000004900                sclp_read_info
<                 0x0000000000004990                sclp_param
<                 0x00000000000049f0                sclp_read
<  .text          0x0000000000004ba8       0x1c entry.o
<                 0x0000000000004ba8                pgm_check_handler
<                 0x0000000000004bc4                __ex_table_start = .
< 
< .iplt           0x0000000000004bc4        0x0
<  .iplt          0x0000000000004bc4        0x0 eckd2dump_mv.o
< 
< .fixup          0x0000000000004bc4       0x40
<  .fixup         0x0000000000004bc4       0x30 stage2dump.o
<  .fixup         0x0000000000004bf4       0x10 eckd2dump.o
---
>                 0x0000000000002960                create_ida_list
>                 0x00000000000029b8                df_s390_em_page_init
>                 0x00000000000029f8                panic_notify
>                 0x0000000000002a28                start
>  .text          0x0000000000002e20      0x390 cio.o
>                 0x0000000000002ee0                store_subchannel
>                 0x0000000000002ef8                io_irq_enable
>                 0x0000000000002f28                io_irq_disable
>                 0x0000000000002f50                start_io
>                 0x00000000000030d0                set_device
>  .text          0x00000000000031b0      0x948 eckd2dump.o
>                 0x0000000000003798                writeblock
>                 0x00000000000037f8                readblock
>                 0x0000000000003858                write_addr_range
>                 0x0000000000003970                write_dump_segment
>                 0x0000000000003a08                stage2dump_eckd_init
>  .text          0x0000000000003af8      0xa70 libc.o
>                 0x0000000000003af8                memset
>                 0x0000000000003b18                memcpy
>                 0x0000000000003b38                memmove
>                 0x0000000000003b88                strcpy
>                 0x0000000000003bb8                strlen
>                 0x0000000000003bd8                strlcpy
>                 0x0000000000003c48                strcat
>                 0x0000000000003c90                strncmp
>                 0x0000000000003cd8                strchr
>                 0x0000000000003cf8                strhash
>                 0x0000000000003d48                load_wait_psw
>                 0x0000000000003db0                initialize
>                 0x0000000000003e00                libc_stop
>                 0x0000000000004308                snprintf
>                 0x0000000000004358                printf
>                 0x00000000000043d0                get_zeroed_page
>                 0x0000000000004488                free_page
>                 0x00000000000044e8                pgm_check_handler_fn
>  .text          0x0000000000004568       0x68 ebcdic.o
>                 0x0000000000004568                ebcdic_strtoul
>  .text          0x00000000000045d0      0x660 sclp.o
>                 0x00000000000045d0                sclp_wait_for_int
>                 0x00000000000046b0                start_sclp
>                 0x0000000000004730                sclp_setup
>                 0x0000000000004820                sclp_print
>                 0x0000000000004980                sclp_read_info
>                 0x0000000000004a18                sclp_param
>                 0x0000000000004a78                sclp_read
>  .text          0x0000000000004c30       0x1c entry.o
>                 0x0000000000004c30                pgm_check_handler
>                 0x0000000000004c4c                __ex_table_start = .
> 
> .iplt           0x0000000000004c4c        0x0
>  .iplt          0x0000000000004c4c        0x0 eckd2dump_mv.o
> 
> .fixup          0x0000000000004c4c       0x40
>  .fixup         0x0000000000004c4c       0x30 stage2dump.o
>  .fixup         0x0000000000004c7c       0x10 eckd2dump.o
112c112
< .ex_table       0x0000000000004c04       0x88
---
> .ex_table       0x0000000000004c8c       0x88
114,116c114,116
<  .ex_table      0x0000000000004c04       0x68 stage2dump.o
<  .ex_table      0x0000000000004c6c       0x20 eckd2dump.o
<                 0x0000000000004c8c                __ex_table_stop = .
---
>  .ex_table      0x0000000000004c8c       0x68 stage2dump.o
>  .ex_table      0x0000000000004cf4       0x20 eckd2dump.o
>                 0x0000000000004d14                __ex_table_stop = .
118c118
< .rodata         0x0000000000004c90       0x40
---
> .rodata         0x0000000000004d18       0x48
120,122c120,122
<  .rodata        0x0000000000004c90        0x8 stage2dump.o
<  .rodata        0x0000000000004c98       0x10 libc.o
<  .rodata        0x0000000000004ca8       0x28 sclp.o
---
>  .rodata        0x0000000000004d18        0x8 stage2dump.o
>  .rodata        0x0000000000004d20       0x18 libc.o
>  .rodata        0x0000000000004d38       0x28 sclp.o
124c124
< .rodata.str1.2  0x0000000000004cd0      0x240
---
> .rodata.str1.2  0x0000000000004d60      0x240
126c126
<                 0x0000000000004cd0      0x240 eckd2dump_mv.o
---
>                 0x0000000000004d60      0x240 eckd2dump_mv.o
129c129
<                 0x0000000000004f10      0x15c stage2dump.o
---
>                 0x0000000000004fa0      0x15c stage2dump.o
131c131
<                 0x0000000000004f10       0x32 cio.o
---
>                 0x0000000000004fa0       0x32 cio.o
133c133
<                 0x0000000000004f10       0x4e eckd2dump.o
---
>                 0x0000000000004fa0       0x4e eckd2dump.o
135,137c135,143
< .rela.dyn       0x0000000000004f10        0x0
<  .rela.iplt     0x0000000000004f10        0x0 eckd2dump_mv.o
<  .rela.text     0x0000000000004f10        0x0 eckd2dump_mv.o
---
> .rodata.cst8    0x0000000000004fa0       0x48
>  .rodata.cst8   0x0000000000004fa0        0x8 eckd2dump_mv.o
>  .rodata.cst8   0x0000000000004fa8       0x40 libc.o
> 
> .rela.dyn       0x0000000000004fe8        0x0
>  .rela.iplt     0x0000000000004fe8        0x0 eckd2dump_mv.o
>  .rela.rodata.cst8
>                 0x0000000000004fe8        0x0 eckd2dump_mv.o
>  .rela.rodata   0x0000000000004fe8        0x0 eckd2dump_mv.o
139c145
< .data           0x0000000000004f10       0x24
---
> .data           0x0000000000004fe8       0x24
141,150c147,156
<  .data          0x0000000000004f10        0x4 eckd2dump_mv.o
<  .data          0x0000000000004f14        0x0 head.o
<  .data          0x0000000000004f14        0x0 stage2dump.o
<  .data          0x0000000000004f14        0x0 cio.o
<  .data          0x0000000000004f14       0x20 eckd2dump.o
<  .data          0x0000000000004f34        0x0 libc.o
<  .data          0x0000000000004f34        0x0 ebcdic.o
<  .data          0x0000000000004f34        0x0 sclp.o
<  .data          0x0000000000004f34        0x0 entry.o
<                 0x0000000000004f34                __stage2_params = .
---
>  .data          0x0000000000004fe8        0x4 eckd2dump_mv.o
>  .data          0x0000000000004fec        0x0 head.o
>  .data          0x0000000000004fec        0x0 stage2dump.o
>  .data          0x0000000000004fec        0x0 cio.o
>  .data          0x0000000000004fec       0x20 eckd2dump.o
>  .data          0x000000000000500c        0x0 libc.o
>  .data          0x000000000000500c        0x0 ebcdic.o
>  .data          0x000000000000500c        0x0 sclp.o
>  .data          0x000000000000500c        0x0 entry.o
>                 0x000000000000500c                __stage2_params = .
152,153c158,159
< .igot.plt       0x0000000000004f38        0x0
<  .igot.plt      0x0000000000004f38        0x0 eckd2dump_mv.o
---
> .igot.plt       0x0000000000005010        0x0
>  .igot.plt      0x0000000000005010        0x0 eckd2dump_mv.o
233c239
< .debug_info     0x0000000000000000     0xa624
---
> .debug_info     0x0000000000000000     0xa641
236,253c242,259
<  .debug_info    0x0000000000001207     0x30e9 stage2dump.o
<  .debug_info    0x00000000000042f0     0x1536 cio.o
<  .debug_info    0x0000000000005826     0x1a37 eckd2dump.o
<  .debug_info    0x000000000000725d     0x18b5 libc.o
<  .debug_info    0x0000000000008b12      0x129 ebcdic.o
<  .debug_info    0x0000000000008c3b     0x19c1 sclp.o
<  .debug_info    0x000000000000a5fc       0x28 entry.o
< 
< .debug_abbrev   0x0000000000000000     0x2133
<  .debug_abbrev  0x0000000000000000      0x422 eckd2dump_mv.o
<  .debug_abbrev  0x0000000000000422       0x14 head.o
<  .debug_abbrev  0x0000000000000436      0x71e stage2dump.o
<  .debug_abbrev  0x0000000000000b54      0x404 cio.o
<  .debug_abbrev  0x0000000000000f58      0x5f8 eckd2dump.o
<  .debug_abbrev  0x0000000000001550      0x5d8 libc.o
<  .debug_abbrev  0x0000000000001b28       0xd0 ebcdic.o
<  .debug_abbrev  0x0000000000001bf8      0x527 sclp.o
<  .debug_abbrev  0x000000000000211f       0x14 entry.o
---
>  .debug_info    0x0000000000001207     0x30e7 stage2dump.o
>  .debug_info    0x00000000000042ee     0x153c cio.o
>  .debug_info    0x000000000000582a     0x1a60 eckd2dump.o
>  .debug_info    0x000000000000728a     0x1898 libc.o
>  .debug_info    0x0000000000008b22      0x129 ebcdic.o
>  .debug_info    0x0000000000008c4b     0x19ce sclp.o
>  .debug_info    0x000000000000a619       0x28 entry.o
> 
> .debug_abbrev   0x0000000000000000     0x20d9
>  .debug_abbrev  0x0000000000000000      0x41c eckd2dump_mv.o
>  .debug_abbrev  0x000000000000041c       0x14 head.o
>  .debug_abbrev  0x0000000000000430      0x702 stage2dump.o
>  .debug_abbrev  0x0000000000000b32      0x3ec cio.o
>  .debug_abbrev  0x0000000000000f1e      0x5e1 eckd2dump.o
>  .debug_abbrev  0x00000000000014ff      0x5ea libc.o
>  .debug_abbrev  0x0000000000001ae9       0xd0 ebcdic.o
>  .debug_abbrev  0x0000000000001bb9      0x50c sclp.o
>  .debug_abbrev  0x00000000000020c5       0x14 entry.o
256c262
<                 0x0000000000000000     0x2f49
---
>                 0x0000000000000000     0x3221
260c266
<                 0x0000000000000228      0x93a stage2dump.o
---
>                 0x0000000000000228      0x958 stage2dump.o
262c268
<                 0x0000000000000b62      0x375 cio.o
---
>                 0x0000000000000b80      0x375 cio.o
264c270
<                 0x0000000000000ed7      0xfe4 eckd2dump.o
---
>                 0x0000000000000ef5      0xf7d eckd2dump.o
266c272
<                 0x0000000000001ebb      0xa96 libc.o
---
>                 0x0000000000001e72      0xd93 libc.o
268c274
<                 0x0000000000002951       0x3c ebcdic.o
---
>                 0x0000000000002c05       0x43 ebcdic.o
270c276
<                 0x000000000000298d      0x5bc sclp.o
---
>                 0x0000000000002c48      0x5d9 sclp.o
293c299
<                 0x0000000000000000      0x328
---
>                 0x0000000000000000      0x35c
295c301
<                 0x0000000000000000       0x77 eckd2dump_mv.o
---
>                 0x0000000000000000       0x7c eckd2dump_mv.o
297c303
<                 0x0000000000000077      0x102 stage2dump.o
---
>                 0x000000000000007c      0x106 stage2dump.o
299c305
<                 0x0000000000000179       0x1c cio.o
---
>                 0x0000000000000182       0x1c cio.o
301c307
<                 0x0000000000000195       0xd1 eckd2dump.o
---
>                 0x000000000000019e       0xc6 eckd2dump.o
303c309
<                 0x0000000000000266       0x66 libc.o
---
>                 0x0000000000000264       0x9c libc.o
305c311
<                 0x00000000000002cc       0x5c sclp.o
---
>                 0x0000000000000300       0x5c sclp.o
307,316c313,322
< .debug_line     0x0000000000000000     0x2e5f
<  .debug_line    0x0000000000000000      0x523 eckd2dump_mv.o
<  .debug_line    0x0000000000000523       0x53 head.o
<  .debug_line    0x0000000000000576      0xb27 stage2dump.o
<  .debug_line    0x000000000000109d      0x440 cio.o
<  .debug_line    0x00000000000014dd      0x908 eckd2dump.o
<  .debug_line    0x0000000000001de5      0x8cf libc.o
<  .debug_line    0x00000000000026b4       0xb5 ebcdic.o
<  .debug_line    0x0000000000002769      0x6a8 sclp.o
<  .debug_line    0x0000000000002e11       0x4e entry.o
---
> .debug_line     0x0000000000000000     0x2efe
>  .debug_line    0x0000000000000000      0x52f eckd2dump_mv.o
>  .debug_line    0x000000000000052f       0x53 head.o
>  .debug_line    0x0000000000000582      0xb40 stage2dump.o
>  .debug_line    0x00000000000010c2      0x440 cio.o
>  .debug_line    0x0000000000001502      0x90a eckd2dump.o
>  .debug_line    0x0000000000001e0c      0x936 libc.o
>  .debug_line    0x0000000000002742       0xb7 ebcdic.o
>  .debug_line    0x00000000000027f9      0x6b7 sclp.o
>  .debug_line    0x0000000000002eb0       0x4e entry.o
340c346
< .debug_frame    0x0000000000000000      0xaa8
---
> .debug_frame    0x0000000000000000      0xab0
345,347c351,353
<  .debug_frame   0x00000000000005c0      0x2f8 libc.o
<  .debug_frame   0x00000000000008b8       0x40 ebcdic.o
<  .debug_frame   0x00000000000008f8      0x1b0 sclp.o
---
>  .debug_frame   0x00000000000005c0      0x300 libc.o
>  .debug_frame   0x00000000000008c0       0x40 ebcdic.o
>  .debug_frame   0x0000000000000900      0x1b0 sclp.o

@bolives-hax
Copy link
Author

what sticks out right away is

45c45
< .text           0x0000000000002048     0x2b7c
---
> .text           0x0000000000002048     0x2c04

with 0x2b7c being gcc14 and 0x2c04 being gcc13.

Since the linker script mentioned above defines:

SECTIONS
{
  . = STAGE2_DESC;
  __stage2_desc = .;

  . = STAGE2_LOAD_ADDRESS;
  .stage2.head : { *(.stage2.head) }
  . = STAGE2_ENTRY;
  .text.start : {
    *(.text.start)
  }

the

  .text : { *(.text) }

sections size affects what comes behind from my remote understanding of linker scripts

  __ex_table_start = .;
  .ex_table : { *(.ex_table) }
  __ex_table_stop = .;
  .rodata : {*(.rodata) }
  .data : { *(.data) }
  __stage2_params = .;

since judging by the diff 0x2c04 - 0x2b7c = 0x88 there is a 0x88 / 136 byte difference shifting what comes behind by 0x88/136 bytes which in the context of gcc13 vs gcc14 seems like a lot and would somewhat fit in my theory of whats going on
but I may very be wrong about this of course

@bolives-hax
Copy link
Author

comparing the .o files in zipl/boot emitted by gcc 14 vs 13 does reveal quite the difference in terms of optimisation.
Comparing the output of radare2's radiff2 -AA -C libc_13.o libc_14.o shows the following:
(offset/location1 | similarity | offset/location2)

              sym.memset  12 0x8000040 |   MATCH  (1.000000) | 0x8000040   12 sym.memset
              sym.memcpy  12 0x8000060 |   MATCH  (1.000000) | 0x8000060   12 sym.memcpy
             sym.memmove  30 0x8000080 |   MATCH  (1.000000) | 0x8000080   30 sym.memmove
              sym.strcpy  44 0x80000d0 |   MATCH  (1.000000) | 0x80000d0   44 sym.strcpy
              sym.strlen  32 0x8000100 |   MATCH  (1.000000) | 0x8000100   32 sym.strlen
             sym.strlcpy 112 0x8000120 |   MATCH  (1.000000) | 0x8000120  112 sym.strlcpy
              sym.strcat  66 0x8000190 |   MATCH  (1.000000) | 0x8000190   66 sym.strcat
             sym.strncmp  22 0x80001d8 |   MATCH  (1.000000) | 0x80001d8   22 sym.strncmp
              sym.strchr  18 0x8000220 |   MATCH  (1.000000) | 0x8000220   18 sym.strchr
             sym.strhash  58 0x8000240 |   MATCH  (1.000000) | 0x8000240   58 sym.strhash
       sym.load_wait_psw 104 0x8000290 |   MATCH  (1.000000) | 0x8000290  104 sym.load_wait_psw
          sym.initialize  78 0x80002f8 |   MATCH  (0.768293) | 0x80002f8   82 sym.initialize
           sym.libc_stop  48 0x8000348 |   MATCH  (1.000000) | 0x8000350   48 sym.libc_stop
           sym.vsnprintf 426 0x8000378 | UNMATCH  (0.298193) | 0x8000380  188 sym.vsnprintf
            fcn.0800057a  34 0x800057a |   MATCH  (0.342105) | 0x8000656   32 fcn.08000656
            fcn.0800084a   6 0x800084a |   MATCH  (1.000000) | 0x800081c    6 fcn.0800081c
            sym.snprintf  76 0x8000850 |   MATCH  (1.000000) | 0x8000828   76 sym.snprintf
              sym.printf 114 0x80008a0 |   MATCH  (1.000000) | 0x8000878  114 sym.printf
     sym.get_zeroed_page  82 0x8000918 |   MATCH  (0.743902) | 0x80008f0   82 sym.get_zeroed_page
            fcn.0800096e  12 0x800096e |   MATCH  (1.000000) | 0x8000946   12 fcn.08000946
            fcn.080009ac  32 0x80009ac |   MATCH  (1.000000) | 0x800098a   32 fcn.0800098a
           sym.free_page  92 0x80009d0 | UNMATCH  (0.315217) | 0x80009b0   86 sym.free_page
sym.pgm_check_handler_fn  76 0x8000a30 | UNMATCH  (0.526316) | 0x8000a08   52 sym.pgm_check_handler_fn
            fcn.08000a7c  50 0x8000a7c |   MATCH  (0.720000) | 0x8000a50   38 fcn.08000a50
            fcn.080005d2  10 0x80005d2 |     NEW  (0.000000)

the gcc14 zipl libc's vsnprintf for example is 0x00000000000007e8 - 0x0000000000000340 = 1192 bytes bit
while gcc13's vsnprintf spans from 0x0000000000000810 - 0x0000000000000338 = 1240 bytes

troughout the object files when compared there is plenty of cases where the gcc13 version is bigger, while not by much it seems to add up regardless.

But what I don't get is why this compiled for other people in the past just fine using older gcc versions ...

@bolives-hax
Copy link
Author

bolives-hax commented Jul 26, 2024

update:

update: using gcc14 seems to work but 13 nor 10 nor 12 do, this sort of is expected in the sense that I expected this to somehow depend on compiler internal/optimisation/flag interpretation foo. As for now under nix I have a construct like seen below (please note that its incomplete and the host architecture is hardcoded, also the makefile is patched to only build zipl not all the other libs and tools. I will uncomment most of these things and fix the nix attributes a little before attempting to push this into nixos/nixpkgs's master branch. This for now is sort of a debug construct but it does build if gcc14 is used.

{
  inputs = {
    nixpkgs_.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    utils.url = "github:numtide/flake-utils";


    nixpkgs = {
      url = "github:nixos/nixpkgs;
      ref = "staging";
      type = "git";
    };

    s390-tools = {
      url = "ssh://[email protected]/ibm-s390-linux/s390-tools";
      flake = false;
      type = "git";
    };
  };
  outputs = { self, nixpkgs, utils, naersk , s390-tools, nixpkgs_}:
    utils.lib.eachSystem ["x86_64-linux" "s390x-linux"] (system:
      let
        _pkgs = import nixpkgs_ { system="x86_64-linux"; };
        pkgs = import nixpkgs {
          # todo inherit system instead and all
          system = "x86_64-linux";
          crossSystem = { gcc.arch = "z10"; config = "s390x-unknown-linux-gnu"; }; 
        };
      in
      {
        defaultPackage = pkgs.gcc14Stdenv.mkDerivation {
        #defaultPackage = pkgs.stdenv.mkDerivation {
          name = "s390-tools";
          version = "2.33.1";
          src = "${s390-tools}";
	  buildInputs = with pkgs; [
	    systemd.dev
	    cryptsetup.dev
	    net-snmp.dev
            #glibc.static.out
            #ncurses.dev
	    fuse3
	    #pkgs.cargo
	    openssl_legacy
            #curl.dev
	    #json_c.dev
	    #libxml2.dev
	  ];
          hardeningDisable = [ "all" ];
          patchPhase = with _pkgs; ''
            patchShebangs --build .
            substituteInPlace \
            common.mak --replace-fail "override SHELL := /bin/bash" "override SHELL := ${bash}/bin/bash"

            substituteInPlace Makefile \
            --replace-fail "LIB_DIRS = libvtoc libzds libdasd libccw libvmcp libekmfweb \\" "LIB_DIRS = #\\" \
            --replace-fail "TOOL_DIRS = zipl zdump fdasd dasdfmt dasdview tunedasd \\" "TOOL_DIRS = zipl #\\"
          '';
          buildPhase = ''
            make V=1 -j 1 HOST_ARCH=s390x BUILD_ARCH=x86_64-linux CROSS_COMPILE=s390x-unknown-linux-gnu-  \
                HAVE_OPENSSL=0 \
                HAVE_CURL=0 \
	    	HAVE_CARGO=0 \
	    	HAVE_GLIB=0 \
		HAVE_GLIB2=0 \
		HAVE_PFM=0 \

          '';
          installPhase = ''
            mkdir -p $out
            make V=1 -j 1 HOST_ARCH=s390x BUILD_ARCH=x86_64-linux CROSS_COMPILE=s390x-unknown-linux-gnu- DEST_DIR=$out \
                HAVE_OPENSSL=0 \
                HAVE_CURL=0 \
	    	HAVE_CARGO=0 \
	    	HAVE_GLIB=0 \
		HAVE_GLIB2=0 \
		HAVE_PFM=0 \
          '';
        };
      }
    );
}

as you can see here gcc.arch = "z10" it turns out that choosing z900 z9ec and z196 fails, but choosing z10 or z13 , z16 works. Gcc by default picks z900 which also fails

@sharkcz
Copy link
Contributor

sharkcz commented Jul 30, 2024

Most likely no one used the bad combination, in Fedora we are now at z13 as the arch level, we were on zEC12 for a long time and on z10 before that. The booloader is logically space constrained so it might be affected by a bad compiler version & flags combination. You probably want to build for something newer even than z10 anyway, because there are unlikely any z10 systems still in active service.

@bolives-hax
Copy link
Author

bolives-hax commented Jul 31, 2024

Most likely no one used the bad combination, in Fedora we are now at z13 as the arch level, we were on zEC12 for a long time and on z10 before that. The booloader is logically space constrained so it might be affected by a bad compiler version & flags combination.You probably want to build for something newer even than z10 anyway,

I see thanks

because there are unlikely any z10 systems still in active service.

well I got a Z10 to toy around with :) specifically because z10's are no longer in service unlike newer models which makes it possible to own these unlike newer versions without spending more than most ppl earn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants