[Bug ld/31824] New: gcc 14 fails during link step on Windows when bootstrap-lto is specified

2024-05-31 Thread tanksherman27 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31824

Bug ID: 31824
   Summary: gcc 14 fails during link step on Windows when
bootstrap-lto is specified
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: tanksherman27 at gmail dot com
  Target Milestone: ---

gcc 14 seems to be unable to link itself when the bootstrap config that is
active is bootstrap-lto, to turn on Link Time Optimization for the gcc being
compiled. The following is the configure command:

  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105507#c3
  # At least with mingw32 + dwarf-2 exceptions there can only be one libgcc in
  # process, or exceptions will no longer work. Since some of the gcc deps are
  # linked dynamically like gmp/zlib/zstd and those pull in libgcc we can't
  # allow libgcc to be linked statically. The default is "-static-libstdc++
  # -static-libgcc" for both, so we drop "-static-libgcc" here:
  # GCC 14 Update: Since we dropped 32bit Ada with GCC 14.1 and GCC doesn't use
  # exceptions elsewhere this could in theory be removed, in case it makes
problems.
  _extra_config+=(
'--with-boot-ldflags="-static-libstdc++"'
'--with-stage1-ldflags="-static-libstdc++"'
  )

  # In addition adaint.c does `#include ` which pulls in msxml.h,
hacky hack:
  CPPFLAGS+=" -DCOM_NO_WINDOWS_H"

  ../${_sourcedir}/configure \
--prefix=${MINGW_PREFIX} \
--with-local-prefix=${MINGW_PREFIX}/local \
--with-build-config='bootstrap-lto' \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--with-native-system-header-dir=${MINGW_PREFIX}/include \
--libexecdir=${MINGW_PREFIX}/lib \
--enable-bootstrap \
--enable-checking=release \
--with-arch=${_arch} \
--with-tune=generic \
--enable-languages=${_languages} \
--enable-shared \
--enable-static \
--enable-libatomic \
--enable-threads=${_threads} \
--enable-graphite \
--enable-fully-dynamic-string \
--enable-libstdcxx-threads \
--enable-libstdcxx-filesystem-ts \
--enable-libstdcxx-time \
--disable-libstdcxx-pch \
--enable-lto \
--enable-libgomp \
--disable-libssp \
--disable-multilib \
--disable-rpath \
--disable-win32-registry \
--disable-nls \
--disable-werror \
--disable-symvers \
--with-libiconv \
--with-system-zlib \
--with-{gmp,mpfr,mpc,isl}=${MINGW_PREFIX} \
--with-pkgversion="Rev${pkgrel}, Built by MSYS2 project" \
--with-bugurl="https://github.com/msys2/MINGW-packages/issues"; \
--with-gnu-as \
--with-gnu-ld \
"${_extra_config[@]}"

...and the invocation of make:

  # https://gcc.gnu.org/onlinedocs/gccint/Makefile.html
  make -O STAGE1_CFLAGS="-O2" \
  --jobs profiledbootstrap

This fails with the following error:

C:\msys64\ucrt64\x86_64-w64-mingw32\bin\ld.exe: error: export ordinal too
large: 91917
C:\msys64\ucrt64\x86_64-w64-mingw32\bin\ld.exe: error: export ordinal too
large: 91820
collect2.exe: error: ld returned 1 exit status
make[3]: *** [../../gcc-14.1.0/gcc/lto/Make-lang.in:102: lto-dump.exe] Error 1
make[3]: *** Waiting for unfinished jobs
collect2.exe: error: ld returned 1 exit status
make[3]: *** [../../gcc-14.1.0/gcc/lto/Make-lang.in:96: lto1.exe] Error 1
C:\msys64\ucrt64\x86_64-w64-mingw32\bin\ld.exe: error: export ordinal too
large: 94928
collect2.exe: error: ld returned 1 exit status
make[3]: *** [../../gcc-14.1.0/gcc/c/Make-lang.in:87: cc1.exe] Error 1
C:\msys64\ucrt64\x86_64-w64-mingw32\bin\ld.exe: error: export ordinal too
large: 97453
collect2.exe: error: ld returned 1 exit status
make[3]: *** [../../gcc-14.1.0/gcc/cp/Make-lang.in:145: cc1plus.exe] Error 1
rm gcc.pod
make[2]: *** [Makefile:5228: all-stageprofile-gcc] Error 2
make[1]: *** [Makefile:23910: stageprofile-bubble] Error 2
make: *** [Makefile:24164: profiledbootstrap] Error 2
==> ERROR: A failure occurred in build().
Aborting...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


PE section extension

2024-05-31 Thread Joachim Schiele
Hello,

I'd like to extend the ld generated PE section with a custom section called 
.store in analogy to .idata and I would love a little guidance where to make 
this change. The new field must be generated after the idata has been 
generated. In addition I need to know where the dllname name, foo.dll is 
generated as I need to change this as well to reserve like 300 more chars for 
later changes of said dllname.

I found pe-dll.c but so far didn't find where the dllname is translated into 
the .idata section of the PE header. 

Regards, Joachim 
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

[Bug binutils/17466] objcopy corrupts Windows executables when adding a section

2024-05-31 Thread js at lastlog dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=17466

Joachim Schiele  changed:

   What|Removed |Added

 CC||js at lastlog dot de

--- Comment #2 from Joachim Schiele  ---
Maybe someone else reads your ticket therefore this is what I did instead:

https://stackoverflow.com/questions/78555828/adding-custom-section-to-pe-with-gcc-mingw

Basically I had the same issue like you but found a workaround:

$ echo 'int main() { puts ("Hello world"); }' | gcc -x c - -c -o main.o
$ echo "this is my special data" >mydata
$ objcopy --add-section .mydata=mydata main.o
$ gcc main.o -o main
$ objdump -h main.exe

The difference is one adds the new section to the .o file instead the exe.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/31828] New: Lack of support for HEASLR (high-entropy-va) for PE targets

2024-05-31 Thread ralf.habacker at freenet dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=31828

Bug ID: 31828
   Summary: Lack of support for HEASLR (high-entropy-va) for PE
targets
   Product: binutils
   Version: 2.39
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: ralf.habacker at freenet dot de
  Target Milestone: ---

Created attachment 15547
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15547&action=edit
Patch adding high-entropy-va support

For bug 19011, patches were added to add hardening options to ld, but these
were not fully included in the git repo. The attached patch adds the missing
support for HEASLR (high-entropy-va).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gold/31830] New: error: y.o: multiple definition of 'foo'

2024-05-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31830

Bug ID: 31830
   Summary: error: y.o: multiple definition of 'foo'
   Product: binutils
   Version: 2.43 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: hjl.tools at gmail dot com
CC: ian at airs dot com
  Target Milestone: ---

[hjl@gnu-tgl-3 gold-1]$ cat x.c
extern __inline __attribute__((__gnu_inline__)) void foo(void) {}
__attribute__((__symver__("foo@GLIBC_2.2.5")))
int __collector_foo_2_2(void) {}
[hjl@gnu-tgl-3 gold-1]$ cat y.c
void foo(void) {}
[hjl@gnu-tgl-3 gold-1]$ cat x.t
GLIBC_2.2.5 {
  global:
foo;
};
[hjl@gnu-tgl-3 gold-1]$ make
gcc -B./ -O2 -fPIC   -c -o x.o x.c
gcc -B./ -O2 -fPIC   -c -o y.o y.c
./ld --version-script=x.t -shared -o x.so x.o y.o
./ld: error: y.o: multiple definition of 'foo'
./ld: x.o: previous definition here
make: *** [Makefile:13: x.so] Error 1
[hjl@gnu-tgl-3 gold-1]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/31800] src-release.sh recursively changes permissions of everything in to 0777

2024-05-31 Thread rostiprodev at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31800

--- Comment #5 from Rostislav Krasny  ---
Created attachment 15549
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15549&action=edit
formatted patch with the fix

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/31800] src-release.sh recursively changes permissions of everything in to 0777

2024-05-31 Thread rostiprodev at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31800

--- Comment #6 from Rostislav Krasny  ---
The 'git reset --hard' works not stable. Sometimes it changes permissions
according to umask or to the git configuration, sometimes it doesn't. So I made
another fix.

I've attached a formatted patch with my fix. Please review and merge it.

I tested it on my Fedora 40.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/30281] error: multiple definition of `pwrite@GLIBC_2.2' with LTO and symver attribute

2024-05-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

--- Comment #18 from H.J. Lu  ---
(In reply to Andrey Sotnikov from comment #17)
> (In reply to H.J. Lu from comment #16)
> > You were using gold, not ld.  Please pass -fuse-ld=bfd to GCC.
> 
> I am not sure I understand. I used ld. I verified with strace that there
> were no other processes spawned. It just seems that ld was gold.

This is a different bug.  Please try

https://sourceware.org/pipermail/binutils/2024-June/134459.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/30281] error: multiple definition of `pwrite@GLIBC_2.2' with LTO and symver attribute

2024-05-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30281

H.J. Lu  changed:

   What|Removed |Added

   See Also||https://sourceware.org/bugz
   ||illa/show_bug.cgi?id=31830

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gold/31830] error: y.o: multiple definition of 'foo'

2024-05-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31830

H.J. Lu  changed:

   What|Removed |Added

   See Also||https://sourceware.org/bugz
   ||illa/show_bug.cgi?id=30281

-- 
You are receiving this mail because:
You are on the CC list for the bug.