Subject: Re: bug#20614: Segmentation fault when building on Power8 Little Endian

From: Petr Hracek <[email-masked]>
Date: Thu, 1 Oct 2015 16:05:57 +0200

On 10/01/2015 02:22 PM, Eli Zaretskii wrote:
>> From: Petr Hracek <[email-masked]>
>> Date: Thu, 1 Oct 2015 13:53:14 +0200
>>
>> Some update regarding this bug.
>> I have add some defines like:
>> $ cat emacs-segment-bss.patch
>> diff --git a/src/unexelf.c b/src/unexelf.c
>> index d365940..55d7ba6 100644
>> --- a/src/unexelf.c
>> +++ b/src/unexelf.c
>> @@ -846,7 +846,7 @@ unexec (const char *new_name, const char *old_name)
>>          if ((OLD_SECTION_H (old_bss_index)).sh_addralign > alignment)
>>        alignment = OLD_SECTION_H (old_bss_index).sh_addralign;
>>
>> -#ifdef __sgi
>> +#if defined __sgi || defined __ppc64le__ || defined __ppc64__
>>          /* According to [email-masked] (Karsten Kuenne)
>>             and [email-masked] (Alexandre Oliva), on IRIX 5.2, we
>>             always get "Program segment above .bss" when dumping
>> $
>>
>> Here is a full backtrace executed on PPC64LE
> Thanks.  Can you repeat this in an unoptimized build?  Otherwise the
> backtrace cannot be trusted (and makes little sense).
Hi Eli,

Here is full backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x00003fffb5a9a870 in strcmp () from /lib64/power8/libc.so.6
Missing separate debuginfos, use: debuginfo-install 
GConf2-3.2.6-8.el7.ppc64le ImageMagick-6.7.8.9-10.el7.ppc64le 
OpenEXR-libs-1.7.1-7.el7.ppc64le alsa-lib-1.0.28-2.el7.ppc64le 
at-spi2-atk-2.8.1-4.el7.ppc64le at-spi2-core-2.8.0-6.el7.ppc64le 
atk-2.14.0-1.el7.ppc64le avahi-libs-0.6.31-15.el7.ppc64le 
bzip2-libs-1.0.6-13.el7.ppc64le cairo-1.14.2-1.el7.ppc64le 
cairo-gobject-1.14.2-1.el7.ppc64le cups-libs-1.6.3-22.el7.ppc64le 
dbus-glib-0.100-7.el7.ppc64le dbus-libs-1.6.12-13.el7.ppc64le 
expat-2.1.0-8.el7.ppc64le fontconfig-2.10.95-7.el7.ppc64le 
freetype-2.4.11-11.el7.ppc64le gdk-pixbuf2-2.31.1-1.el7.ppc64le 
ghostscript-9.07-18.el7.ppc64le giflib-4.1.6-9.el7.ppc64le 
glib2-2.42.2-3.el7.ppc64le glibc-2.17-103.el7.ppc64le 
gmp-6.0.0-11.el7.ppc64le gnutls-3.3.8-13.el7.ppc64le 
gtk3-3.14.13-13.el7.ppc64le harfbuzz-0.9.36-1.el7.ppc64le 
ilmbase-1.0.3-7.el7.ppc64le jasper-libs-1.900.1-29.el7.ppc64le 
jbigkit-libs-2.0-11.el7.ppc64le keyutils-libs-1.5.8-3.el7.ppc64le 
krb5-libs-1.13.2-3.el7.ppc64le lcms2-2.6-2.el7.ppc64le 
libICE-1.0.9-2.el7.ppc64le libSM-1.2.2-2.el7.ppc64le 
libX11-1.6.3-2.el7.ppc64le libXau-1.0.8-2.1.el7.ppc64le 
libXcomposite-0.4.4-4.1.el7.ppc64le libXcursor-1.1.14-2.1.el7.ppc64le 
libXdamage-1.1.4-4.1.el7.ppc64le libXext-1.3.3-3.el7.ppc64le 
libXfixes-5.0.1-2.1.el7.ppc64le libXft-2.3.2-2.el7.ppc64le 
libXi-1.7.4-2.el7.ppc64le libXinerama-1.1.3-2.1.el7.ppc64le 
libXpm-3.5.11-3.el7.ppc64le libXrandr-1.4.2-2.el7.ppc64le 
libXrender-0.9.8-2.1.el7.ppc64le libXt-1.1.4-6.1.el7.ppc64le 
libXxf86vm-1.1.3-2.1.el7.ppc64le libcom_err-1.42.9-7.el7.ppc64le 
libcroco-0.6.8-5.el7.ppc64le libdrm-2.4.60-3.el7.ppc64le 
libffi-3.0.13-16.el7.ppc64le libgcc-4.8.5-4.el7.ppc64le 
libgomp-4.8.5-4.el7.ppc64le libjpeg-turbo-1.2.90-5.el7.ppc64le 
libotf-0.9.13-4.el7.ppc64le libpng-1.5.13-5.el7.ppc64le 
librsvg2-2.39.0-1.el7.ppc64le libselinux-2.2.2-6.el7.ppc64le 
libstdc++-4.8.5-4.el7.ppc64le libtasn1-3.8-2.el7.ppc64le 
libthai-0.1.14-9.el7.ppc64le libtiff-4.0.3-14.el7.ppc64le 
libtool-ltdl-2.4.2-20.el7.ppc64le libuuid-2.23.2-24.el7.ppc64le 
libwmf-lite-0.2.8.4-41.el7.ppc64le libxcb-1.11-4.el7.ppc64le 
libxml2-2.9.1-5.el7_1.2.ppc64le libxshmfence-1.2-1.el7.ppc64le 
m17n-lib-1.6.4-14.el7.ppc64le mesa-libEGL-10.6.0-1.20150616.el7.ppc64le 
mesa-libGL-10.6.0-1.20150616.el7.ppc64le 
mesa-libgbm-10.6.0-1.20150616.el7.ppc64le 
mesa-libglapi-10.6.0-1.20150616.el7.ppc64le 
ncurses-libs-5.9-13.20130511.el7.ppc64le nettle-2.7.1-4.el7.ppc64le 
nss-softokn-freebl-3.16.2.3-13.el7.ppc64le 
openssl-libs-1.0.1e-42.el7_1.9.ppc64le p11-kit-0.20.7-3.el7.ppc64le 
pango-1.36.8-2.el7.ppc64le pcre-8.32-15.el7.ppc64le 
pixman-0.32.6-3.el7.ppc64le trousers-0.3.13-1.el7.ppc64le 
xz-libs-5.1.2-10alpha.el7.ppc64le zlib-1.2.7-15.el7.ppc64le
(gdb) bt full
#0  0x00003fffb5a9a870 in strcmp () at /lib64/power8/libc.so.6
#1  0x00000000102e3724 in unexec (new_name=0x116387e8 
"/home/phracek/rpmbuild/BUILD/emacs-24.3/src/emacs", old_name=0x11638838 
"/home/phracek/rpmbuild/BUILD/emacs-24.3/src/temacs") at unexelf.c:1258
         section =
           {sh_name = 122, sh_type = 4, sh_flags = 2, sh_addr = 
268483528, sh_offset = 48072, sh_size = 768, sh_link = 5, sh_info = 0, 
sh_addralign = 8, sh_entsize = 24}
         new_file = 10
         old_file = 9
         new_file_size = 30790315
         new_break = 0x116f0000
         old_base = 0x3fffaa800000 "\177ELF\002\001\001"
         new_base = 0x3fffa8aa0000 "\177ELF\002\001\001"
         old_file_h = 0x3fffaa800000
         new_file_h = 0x3fffa8aa0000
         old_program_h = 0x3fffaa800040
         new_program_h = 0x3fffa8aa0040
         old_section_h = 0x3fffab1dc110
         new_section_h = 0x3fffaa78c110
         old_section_names = 0x3fffab1dbfcc ""
         old_bss_addr = 272498688
         new_bss_addr = 292487168
         old_bss_size = 563072
         new_data2_size = 19988480
         new_data2_offset = 4063232
         new_data2_addr = 272498688
         old_bss_offset = 4063232
         new_data2_incr = 19988480
         n = 9
         nn = 0
         old_bss_index = 22
         old_sbss_index = -1
         old_plt_index = 20
         old_data_index = 21
         new_data2_index = 20
         stat_buf =
           {st_dev = 2050, st_ino = 5119871, st_nlink = 1, st_mode = 
33261, st_uid = 20582, st_gid = 20582, __pad2 = 0, st_rdev = 0, st_size 
= 10801771, st_blksize = 4096, st_blocks = 20984, st_atim = {tv_sec = 
1443707449, tv_nsec = 95539783}, st_mtim = {tv_sec = 1443707448, tv_nsec 
= 975539771}, st_ctim = {tv_sec = 1443707448, tv_nsec = 975539771}, 
__unused4 = 0, __unused5 = 0, __unused6 = 0}
         old_file_size = 10801771
---Type <return> to continue, or q <return> to quit---
#2  0x00000000101a1170 in Fdump_emacs (filename=291602193, 
symfile=291602097) at emacs.c:2030
         tem = 276285906
         symbol = 279411634
         count = 16
#3  0x000000001027f368 in eval_sub (form=280596326) at eval.c:2146
         numargs = 8
         args_left = 276285906
         i = 2
         maxargs = 2
         argvals = {291604241, 291604209, 70368744168448, 
70368744168656, 277773798, 271328908, 0, 276398802}
         fun = 272527693
         val = 276285906
         original_fun = 276445394
         original_args = 280253382
         funcar = 277773862
         backtrace = {next = 0x3fffffffddb0, function = 276445394, args 
= 0x3fffffffdbe8, nargs = 2, debug_on_exit = 0}
         gcpro1 = {next = 0x3fffffffddb0, var = 0x107a38d2, nvars = 
70368744168424}
         gcpro2 = {next = 0x3fffffffddb0, var = 0x107a38d2, nvars = 
70368744168424}
         gcpro3 = {next = 0x10776596, var = 0x3fffffffdbe8, nvars = 2}
#4  0x000000001027a010 in Fprogn (args=280793446) at eval.c:360
         val = 276285906
         gcpro1 = {next = 0x3ec63d1348a97a00, var = 0x3fffffffde20, 
nvars = 6}
#5  0x000000001027ef94 in eval_sub (form=280194102) at eval.c:2091
         numargs = 24
         args_left = 280625926
         i = 278384886
         maxargs = 276605808
         argvals = {276260246, 70368744169024, 277773894, 
70368744168992, 4523370028772981248, 276234832, 276285906, 70368744169024}
         fun = 275399253
         val = 278384886
         original_fun = 276403954
         original_args = 280625926
         funcar = 276285906
         backtrace = {next = 0x3fffffffdfa0, function = 276403954, args 
= 0x3fffffffdd28, nargs = -1, debug_on_exit = 0}
         gcpro1 = {next = 0x3fffffffdfa0, var = 0x107996f2, nvars = 
70368744168744}
         gcpro2 = {next = 0x3fffffffdfa0, var = 0x107996f2, nvars = 
70368744168744}
         gcpro3 = {next = 0x1077c9d2, var = 0x3fffffffddd8, nvars = 1}
#6  0x0000000010279e58 in Fif (args=280088390) at eval.c:310
         cond = 278384886
---Type <return> to continue, or q <return> to quit---
         gcpro1 = {next = 0x3fffb7fefc80 <_dl_argv_internal>, var = 
0x3fffb7ff0000 <_rtld_local>, nvars = 2}
#7  0x000000001027ef94 in eval_sub (form=276260150) at eval.c:2091
         numargs = 8
         args_left = 280088390
         i = 276260150
         maxargs = 276605808
         argvals = {291932193, 276285906, 16, 276285906, 276285906, 
276285906, 276398802, 276285906}
         fun = 275399157
         val = 70368744169264
         original_fun = 276403858
         original_args = 280088390
         funcar = 70368744169408
         backtrace = {next = 0x3fffffffe490, function = 276403858, args 
= 0x3fffffffdf18, nargs = -1, debug_on_exit = 0}
         gcpro1 = {next = 0x3fffffffe490, var = 0x10799692, nvars = 
70368744169240}
         gcpro2 = {next = 0x3fffffffe490, var = 0x10799692, nvars = 
70368744169240}
         gcpro3 = {next = 0x103e7968 <Smake_keymap+40>, var = 0x0, nvars 
= 276398802}
#8  0x00000000102bd1a4 in readevalloop (readcharfun=276398802, 
stream=0x107cab70, sourcename=276604337, printflag=false, 
unibyte=276285906, readfun=276285906, start=276285906, end=276285906) at 
lread.c:1843
         count1 = 16
         c = 276260150
         val = 276260150
         count = 12
         gcpro1 = {next = 0x10798562, var = 0x10798560, nvars = 32}
         gcpro2 = {next = 0x10798562, var = 0x10798560, nvars = 32}
         gcpro3 = {next = 0x10798562, var = 0x10798560, nvars = 32}
         gcpro4 = {next = 0x10798562, var = 0x10798560, nvars = 32}
         b = 0x0
         continue_reading_p = true
         lex_bound = 276285906
         whole_buffer = false
         first_sexp = false
         macroexpand = 276285906
#9  0x00000000102bb560 in Fload (file=276604081, noerror=276285906, 
nomessage=276285906, nosuffix=276285906, must_suffix=276285906) at 
lread.c:1316
         stream = 0x107cab70
         fd = 8
         count = 3
         gcpro1 = {next = 0x1f, var = 0x1f, nvars = 31}
         gcpro2 = {next = 0x1f, var = 0x1f, nvars = 31}
         gcpro3 = {next = 0x1f, var = 0x1f, nvars = 31}
---Type <return> to continue, or q <return> to quit---
         found = 276604273
         efound = 70367536151680
         hist_file_name = 276604337
         newer = false
         compiled = false
         handler = 24
         safe_p = true
         fmode = 0x10398788 "r"
         tmp = {276285906, 276604305}
         version = 0
#10 0x000000001027f44c in eval_sub (form=276523222) at eval.c:2157
         numargs = 4
         args_left = 276285906
         i = 5
         maxargs = 5
         argvals = {276604081, 276285906, 276285906, 276285906, 
276285906, 276285906, 276403666, 276403664}
         fun = 275407901
         val = 276285906
         original_fun = 276398514
         original_args = 276523206
         funcar = 276312672
         backtrace = {next = 0x0, function = 276398514, args = 
0x3fffffffe4b8, nargs = 1, debug_on_exit = 0}
         gcpro1 = {next = 0x0, var = 0x107981b2, nvars = 70368744170680}
         gcpro2 = {next = 0x0, var = 0x107981b2, nvars = 70368744170680}
         gcpro3 = {next = 0x3fffffffe480, var = 0x3fffffffe4b8, nvars = 5}
#11 0x000000001027eb44 in Feval (form=276523222, lexical=276285906) at 
eval.c:2005
         count = 2
#12 0x00000000101a4284 in top_level_2 () at keyboard.c:1177
#13 0x000000001027c86c in internal_condition_case (bfun=0x101a4244 
<top_level_2>, handlers=276337522, hfun=0x101a3adc <cmd_error>) at 
eval.c:1289
         val = 70368744171024
         c =
           {tag = 276285906, val = 276285906, next = 0x3fffffffe9d0, 
gcpro = 0x0, jmp = {{__jmpbuf = {7811300748338917787, 272529768, 
7811334515022091259, 0 <repeats 13 times>, 70367536151680, 
70367536152576, 70367536150448, 276398514, 70368744170912, 
2449960692665548799, 0 <repeats 42 times>}, __mask_was_saved = 0, 
__saved_mask = {__val = {4294967295, 0 <repeats 13 times>, 272500336, 
0}}}}, backlist = 0x0, handlerlist = 0x0, lisp_eval_depth = 0, pdlcount 
= 2, poll_suppress_count = 1, interrupt_input_blocked = 0, byte_stack = 0x0}
         h = {handler = 276337522, var = 276285906, chosen_clause = 0, 
tag = 0x3fffffffe610, next = 0x0}
#14 0x00000000101a4314 in top_level_1 (ignore=276285906) at keyboard.c:1185
#15 0x000000001027bf5c in internal_catch (tag=276333362, func=0x101a42b0 
<top_level_1>, arg=276285906) at eval.c:1060
         c =
---Type <return> to continue, or q <return> to quit---
           {tag = 276333362, val = 276285906, next = 0x0, gcpro = 0x0, 
jmp = {{__jmpbuf = {7811300748338920875, 272529768, 7811334515022080783, 
0 <repeats 13 times>, 70367536151680, 70367536152576, 70367536150448, 
276398514, 70368744171920, 2449960692665548799, 0 <repeats 42 times>}, 
__mask_was_saved = 0, __saved_mask = {__val = {276309864, 
72057594037927940, 276285906, 276285906, 276506162, 70368744172656, 
272151100, 70368744172656, 276506160, 276604080, 276506162, 276312672, 
275426328, 276398514, 70368744172656, 70368744172816}}}}, backlist = 
0x0, handlerlist = 0x0, lisp_eval_depth = 0, pdlcount = 2, 
poll_suppress_count = 1, interrupt_input_blocked = 0, byte_stack = 0x0}
#16 0x00000000101a4104 in command_loop () at keyboard.c:1146
#17 0x00000000101a3260 in recursive_edit_1 () at keyboard.c:779
         count = 1
         val = 270153060
#18 0x00000000101a3520 in Frecursive_edit () at keyboard.c:843
         count = 0
         buffer = 276285906
#19 0x000000001019ff18 in main (argc=5, argv=0x3ffffffff2d8) at emacs.c:1528
         dummy = 70368744173184
         stack_bottom_variable = 0 '\000'
         do_initial_setlocale = true
         dumping = true
         skip_args = 3
         rlim = {rlim_cur = 8720000, rlim_max = 18446744073709551615}
         no_loadup = false
         junk = 0x0
         dname_arg = 0x0
         ch_to_dir = 0x0
(gdb)

-- 
Petr Hracek
Software Engineer
Developer Experience
Red Hat, Inc
Mob: +420777056169
email: [email-masked]