bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/30005] New: __declspec(code_seg("segname")) does not work


From: pali at kernel dot org
Subject: [Bug binutils/30005] New: __declspec(code_seg("segname")) does not work
Date: Sun, 15 Jan 2023 14:52:44 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30005

            Bug ID: 30005
           Summary: __declspec(code_seg("segname")) does not work
           Product: binutils
           Version: 2.39
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: pali at kernel dot org
  Target Milestone: ---

GCC/LD does not support __declspec(code_seg("segname")) declarator for
specifying name of PE/COFF segment name.

Instead GCC/LD supports different and custom syntax
__declspec(section("segname")) incompatible with other compilers, like MSVC.

Please add support for de-facto standard "code_seg" declarator into the PE/COFF
__declspec keyword and not custom declarator. It does not bring any value, just
make code incompatible with gcc.

Test case on Debian sid:

$ x86_64-w64-mingw32-ld -v
GNU ld (GNU Binutils) 2.39.90.20230110
$
$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/12-win32/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr
--includedir='/usr/include' --mandir='/usr/share/man'
--infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var
--disable-option-checking --disable-silent-rules
--libdir='/usr/lib/x86_64-linux-gnu' --libexecdir='/usr/lib/x86_64-linux-gnu'
--disable-maintainer-mode --disable-dependency-tracking --prefix=/usr
--enable-shared --enable-static --disable-multilib --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib
--enable-libstdcxx-time=yes --with-tune=generic --with-headers
--enable-version-specific-runtime-libs --enable-fully-dynamic-string
--enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto
--enable-threads=win32 --program-suffix=-win32
--program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32
--with-as=/usr/bin/x86_64-w64-mingw32-as
--with-ld=/usr/bin/x86_64-w64-mingw32-ld --enable-libatomic
--enable-libstdcxx-filesystem-ts=yes --enable-dependency-tracking SED=/bin/sed
Thread model: win32
Supported LTO compression algorithms: zlib
gcc version 12-win32 (GCC)
$
$ cat test-code-seg.c
__declspec(code_seg("segname"))
int test(void) { return 0; }
$
$ x86_64-w64-mingw32-gcc -c test-code-seg.c -o test-code-seg.o
test-code-seg.c:2:1: warning: 'code_seg' attribute directive ignored
[-Wattributes]
    2 | int test(void) { return 0; }
      | ^~~
$
$ x86_64-w64-mingw32-objdump -h test-code-seg.o | grep segname
$

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]